{"id":24512383,"url":"https://github.com/weiyx16/leaf-classification-segmentation","last_synced_at":"2026-05-21T07:46:50.637Z","repository":{"id":134507990,"uuid":"188073475","full_name":"weiyx16/Leaf-Classification-Segmentation","owner":"weiyx16","description":"Deep learning based interesting\u0026small class assignment","archived":false,"fork":false,"pushed_at":"2019-05-25T08:42:38.000Z","size":5415,"stargazers_count":1,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-01-22T00:46:17.063Z","etag":null,"topics":["classification","fcn","pytorch","resnet-50","segmentation","u-net"],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/weiyx16.png","metadata":{"files":{"readme":"Readme.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-05-22T16:13:19.000Z","updated_at":"2021-10-19T13:05:33.000Z","dependencies_parsed_at":"2023-03-13T11:06:33.560Z","dependency_job_id":null,"html_url":"https://github.com/weiyx16/Leaf-Classification-Segmentation","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/weiyx16%2FLeaf-Classification-Segmentation","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/weiyx16%2FLeaf-Classification-Segmentation/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/weiyx16%2FLeaf-Classification-Segmentation/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/weiyx16%2FLeaf-Classification-Segmentation/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/weiyx16","download_url":"https://codeload.github.com/weiyx16/Leaf-Classification-Segmentation/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243713415,"owners_count":20335567,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["classification","fcn","pytorch","resnet-50","segmentation","u-net"],"created_at":"2025-01-22T00:46:22.094Z","updated_at":"2026-05-21T07:46:45.618Z","avatar_url":"https://github.com/weiyx16.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Leaf Classification and Vein Segmentation\n\n*Class Assignment in junior year* : see [Requirement](img/requirement.pdf)  \n\n## Leaf Classification\n\nFor all, three kinds of leaves are provided, and each one is organized in a certain directory, like this (I set them into different parts):  \n\n\u003e data_dir/train/Leaf_0/xxx.png  \n\u003e data_dir/train/Leaf_1/xy.png  \n\u003e data_dir/train/Leaf_2/xxz.png  \n\u003e data_dir/val/Leaf_0/lxx.png  \n\u003e data_dir/val/Leaf_1/gy.png  \n\u003e data_dir/val/Leaf_2/llz.png  \n\nIt's easy to finish this classical task using pretrained model on ImageNet or something else. So I directly use feature extraction of Resnet-50 and train the last dense layer, under guide of [tutorial](https://pytorch.org/tutorials/beginner/finetuning_torchvision_models_tutorial.html) on pytorch official website.  \n\n### File Included  \n\n+ main_task1.py -\u003e main function including training and loading  \n+ predict_task1.py -\u003e prediction function taking one image a time \\[I think you can transform it into multi-input one easily\\]. And I add in softmax on the final output, so the output value can be responsible for the posibility.  \n\n## Leaf Vein Segmentation\n\nFor all, three kinds of leaves and their scratch vein images are provided and some data maybe totally wrong, so please do data filting first. Data structure is like this (I set them into different parts) and notice the mask has same name with the input image, so you can use it to load the label:  \n\n\u003e data_dir/train/input/xxx.png  \n\u003e data_dir/train/mask/xxx.png  \n\u003e data_dir/val/input/yy.png  \n\u003e data_dir/val/mask/yy.png\n\nI think it's more like a segmentation task, so use a image-to-image network, with top-down\u0026bottom-up (U-Net) or other encoder-decoder structure (FCN).  \nAs for U-Net, I both try standard U-Net structure and [adapted U-Net structure](https://github.com/milesial/Pytorch-UNet/). I find that the adapted one has better result... Although I can't figure out why.  \nAs for FCN, actually I just modify the last two layer of Resnet-50 and add in some layers of transpose convolution to upsample the feature maps until the target resolution. You can use the pretrained resnet model or not, for I both earn enough good result.  \n\n### File Included\n\n+ main_task2.py -\u003e main function including training and loading. You can set some important hyperparameters just at the beginning of the file.  \n+ dataset_task2.py -\u003e rewrite the dataset object of pytorch, so you can load the input image and mask label according to their name in the same time.  \n+ predict_task2.py -\u003e prediction function taking one image a time \\[I think you can transform it into multi-input one easily\\].  \n+ U_Net.py -\u003e standard U-Net Structure Model.  \n+ UNet_Adapted.py -\u003e adapted U-Net Structure Model.  \n+ FCN -\u003e resnet-based naive model.  \n\n### Training And Evaluation  \n\n+ Adapted-Unet  \n\n\u003cdiv align=\"center\"\u003e\n\u003cimg src=\"./img/Figure_Unet.png\" width = \"600\" height = \"400\" alt=\"U-Net Training\" align=center /\u003e\n\u003c/div\u003e\n\n+ Naive FCN  \n\n\u003cdiv align=\"center\"\u003e\n\u003cimg src=\"./img/Figure_fcn.png\" width = \"600\" height = \"400\" alt=\"FCN Training\" align=center /\u003e\n\u003c/div\u003e\n\n+ Evaluation  \n\n\u003cp align = \"center\"\u003e\n\u003cimg src=\"./img/test.jpg\" width = \"200\" height = \"200\" alt=\"test\"\u003e\n\u003cimg src=\"./img/test_img_mask.png\" width = \"200\" height = \"200\" alt=\"test_mask\"\u003e\n\u003c/p\u003e\n\n\u003cp align = \"center\"\u003e\n\u003cimg src=\"./img/test2.jpg\" width = \"200\" height = \"200\" alt=\"test2\"\u003e\n\u003cimg src=\"./img/test2_img_mask.png\" width = \"200\" height = \"200\" alt=\"test2_mask\"\u003e\n\u003c/p\u003e\n\n## Data and Pretrained Model\n\nData \u0026 Pretrained Model: If you really need it, feel free to connect to me...  \n\n## Requirement\n\n+ pytorch\n+ torchvision\n+ numpy\n+ matplotlib\n+ tqdm\n+ pillow\n\nSee: [config requirement](./img/config.yaml)  \n\n## Citing\n\nIf you really need this repo, please follow this BibTex:  \n```\n@misc{LeafVein, \n    author = {Yixuan, Wei},\n    title = {Leaf Classification and Vein Segmentation},\n    howpublished = {\\url{https://github.com/weiyx16/Leaf-Classification-Segmentation}},\n    year = {2019}\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fweiyx16%2Fleaf-classification-segmentation","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fweiyx16%2Fleaf-classification-segmentation","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fweiyx16%2Fleaf-classification-segmentation/lists"}