{"id":20268931,"url":"https://github.com/eniddealla/leaffliction","last_synced_at":"2026-06-04T18:31:13.854Z","repository":{"id":261153681,"uuid":"852306956","full_name":"EniddeallA/Leaffliction","owner":"EniddeallA","description":"Deep Learning - Disease recognition on leaves Using CNNs","archived":false,"fork":false,"pushed_at":"2024-11-12T10:14:09.000Z","size":60629,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-10T23:08:34.175Z","etag":null,"topics":["cnn","computer-vision","data-science","deep-learning","machine-learning","python","resnet-18"],"latest_commit_sha":null,"homepage":"","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/EniddeallA.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":"2024-09-04T15:27:53.000Z","updated_at":"2024-11-12T10:21:52.000Z","dependencies_parsed_at":"2024-11-05T01:39:14.929Z","dependency_job_id":null,"html_url":"https://github.com/EniddeallA/Leaffliction","commit_stats":null,"previous_names":["eniddealla/leaffliction"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/EniddeallA/Leaffliction","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EniddeallA%2FLeaffliction","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EniddeallA%2FLeaffliction/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EniddeallA%2FLeaffliction/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EniddeallA%2FLeaffliction/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/EniddeallA","download_url":"https://codeload.github.com/EniddeallA/Leaffliction/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EniddeallA%2FLeaffliction/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33916320,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-04T02:00:06.755Z","response_time":64,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["cnn","computer-vision","data-science","deep-learning","machine-learning","python","resnet-18"],"created_at":"2024-11-14T12:21:38.547Z","updated_at":"2026-06-04T18:31:13.755Z","avatar_url":"https://github.com/EniddeallA.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Leaffliction\n#### The project is an introduction to Deep Learning/Computer Vision\n\nThis project implements a deep learning solution using ResNet18 to classify plant diseases from leaf images, with comprehensive data preprocessing and augmentation pipelines.\n\n## Project Structure\n```\n./\n├── Distribution.py          # Dataset distribution analysis\n├── Augmentation.py          # Image augmentation implementation\n├── Transformation.py        # PlantCV-based image transformations\n├── PlantDiseaseDataset.py   # Custom PyTorch dataset\n├── train.py                 # Model training script\n├── predict.py               # Disease prediction script\n└── Leaves.zip               # Leave image dataset information\n```\n\n## Leaves Directory Structure\n```\ndataset/\n├── Plant_Type1/\n│   ├── Disease1/\n│   │   ├── original_images/\n│   │   └── Augmented/\n│   │   └── Transformed/\n│   └── Disease2/\n│       ├── original_images/\n│       └── Augmented/\n│   │   └── Transformed/\n└── Plant_Type2/\n    └── ...\n```\n\n## Components\n\n### 1. Data Analysis\nOur `Distribution.py` script analyzes and visualizes the dataset structure:\n```bash\npython Distribution.py ./path/to/dataset\n```\nFeatures:\n- Pie chart visualization of disease distribution\n- Bar chart showing image count per disease\n- Handles both original and augmented images\n- Excludes augmented directories from double-counting\n\n### 2. Data Augmentation\nThe `Augmentation.py` script implements various augmentation techniques using torchvision:\n```bash\npython Augmentation.py ./path/to/image.jpg\n# or\npython Augmentation.py ./path/to/directory\n```\nImplemented transformations:\n- Gaussian Blur (kernel_size=(3, 7), sigma=(1.5, 6))\n- Random Rotation (-80° to 80°)\n- Color Jitter (brightness, contrast, saturation)\n- Random Resized Crop (200x200)\n- Random Affine Shear (45°)\n- Random Horizontal/Vertical Flip\n\n### 3. Image Transformation\n`Transformation.py` uses PlantCV for advanced image processing:\n```bash\npython Transformation.py ./path/to/image.jpg\n# or\npython Transformation.py -src source_dir -dst destination_dir\n```\nPipeline includes:\n- LAB colorspace conversion\n- Binary thresholding\n- Gaussian blur\n- Mask application\n- ROI extraction\n- Shape analysis\n- X/Y axis pseudolandmarks\n\n### 4. Custom Dataset\n`PlantDiseaseDataset.py` implements a PyTorch Dataset class with:\n- Automatic data balancing\n- Support for multiple image formats\n- Caching mechanism for faster loading\n- Minimum image count validation (500 images)\n- Even distribution across classes\n\n### 5. Model Architecture and Training\nWe use a modified ResNet18 architecture with transfer learning:\n```python\nmodel = models.resnet18(weights=ResNet18_Weights.DEFAULT)\nnum_features = model.fc.in_features\nmodel.fc = torch.nn.Linear(num_features, num_classes)\n```\n\nTraining pipeline features:\n- 80/20 train-validation split\n- Batch size of 32\n- Adam optimizer with learning rate 0.0001 and weight decay 1e-5\n- CrossEntropyLoss criterion\n- Training progress monitoring with loss and accuracy metrics\n- Validation accuracy evaluation after each epoch\n\nImage preprocessing pipeline:\n```python\ntransform = transforms.Compose([\n    transforms.Resize((224, 224)),\n    transforms.GaussianBlur(kernel_size=(3, 3), sigma=(0.1, 2.0)),\n    transforms.RandomGrayscale(0.1),\n    transforms.ToTensor(),\n    transforms.Normalize(\n        mean=[0.485, 0.456, 0.406],\n        std=[0.229, 0.224, 0.225]\n    )\n])\n```\n\nTo train the model:\n```bash\npython train.py --data_train /path/to/dataset --total_images 1000\n```\n\nThe trained model is saved as 'plant_disease_model.pth' with both the model state dictionary and class labels.\n\n### 6. Prediction\nThe `predict.py` script provides disease classification with visualization:\n```bash\npython predict.py path/to/image1.jpg path/to/image2.jpg ...\n```\nFeatures:\n- Side-by-side visualization of original and transformed images\n- Clear prediction display\n- Batch prediction support\n- CPU/GPU compatibility\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feniddealla%2Fleaffliction","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Feniddealla%2Fleaffliction","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feniddealla%2Fleaffliction/lists"}