Showing preview only (212K chars total). Download the full file or copy to clipboard to get everything.
Repository: manthan89-py/Plant-Disease-Detection
Branch: main
Commit: 077e03a35b1b
Files: 20
Total size: 203.7 KB
Directory structure:
gitextract_w46t93c5/
├── Flask Deployed App/
│ ├── CNN.py
│ ├── Procfile
│ ├── Readme.md
│ ├── app.py
│ ├── disease_info.csv
│ ├── requirements.txt
│ ├── static/
│ │ └── uploads/
│ │ └── Readme.md
│ ├── supplement_info.csv
│ └── templates/
│ ├── base.html
│ ├── contact-us.html
│ ├── home.html
│ ├── index.html
│ ├── market.html
│ └── submit.html
├── Model/
│ ├── Plant Disease Detection Code.ipynb
│ ├── Plant Disease Detection Code.md
│ └── Readme.md
├── README.md
├── demo_images/
│ └── Readme.md
└── test_images/
└── Readme.md
================================================
FILE CONTENTS
================================================
================================================
FILE: Flask Deployed App/CNN.py
================================================
import pandas as pd
import torch.nn as nn
class CNN(nn.Module):
def __init__(self, K):
super(CNN, self).__init__()
self.conv_layers = nn.Sequential(
# conv1
nn.Conv2d(in_channels=3, out_channels=32,
kernel_size=3, padding=1),
nn.ReLU(),
nn.BatchNorm2d(32),
nn.Conv2d(in_channels=32, out_channels=32,
kernel_size=3, padding=1),
nn.ReLU(),
nn.BatchNorm2d(32),
nn.MaxPool2d(2),
# conv2
nn.Conv2d(in_channels=32, out_channels=64,
kernel_size=3, padding=1),
nn.ReLU(),
nn.BatchNorm2d(64),
nn.Conv2d(in_channels=64, out_channels=64,
kernel_size=3, padding=1),
nn.ReLU(),
nn.BatchNorm2d(64),
nn.MaxPool2d(2),
# conv3
nn.Conv2d(in_channels=64, out_channels=128,
kernel_size=3, padding=1),
nn.ReLU(),
nn.BatchNorm2d(128),
nn.Conv2d(in_channels=128, out_channels=128,
kernel_size=3, padding=1),
nn.ReLU(),
nn.BatchNorm2d(128),
nn.MaxPool2d(2),
# conv4
nn.Conv2d(in_channels=128, out_channels=256,
kernel_size=3, padding=1),
nn.ReLU(),
nn.BatchNorm2d(256),
nn.Conv2d(in_channels=256, out_channels=256,
kernel_size=3, padding=1),
nn.ReLU(),
nn.BatchNorm2d(256),
nn.MaxPool2d(2),
)
self.dense_layers = nn.Sequential(
nn.Dropout(0.4),
nn.Linear(50176, 1024),
nn.ReLU(),
nn.Dropout(0.4),
nn.Linear(1024, K),
)
def forward(self, X):
out = self.conv_layers(X)
# Flatten
out = out.view(-1, 50176)
# Fully connected
out = self.dense_layers(out)
return out
idx_to_classes = {0: 'Apple___Apple_scab',
1: 'Apple___Black_rot',
2: 'Apple___Cedar_apple_rust',
3: 'Apple___healthy',
4: 'Background_without_leaves',
5: 'Blueberry___healthy',
6: 'Cherry___Powdery_mildew',
7: 'Cherry___healthy',
8: 'Corn___Cercospora_leaf_spot Gray_leaf_spot',
9: 'Corn___Common_rust',
10: 'Corn___Northern_Leaf_Blight',
11: 'Corn___healthy',
12: 'Grape___Black_rot',
13: 'Grape___Esca_(Black_Measles)',
14: 'Grape___Leaf_blight_(Isariopsis_Leaf_Spot)',
15: 'Grape___healthy',
16: 'Orange___Haunglongbing_(Citrus_greening)',
17: 'Peach___Bacterial_spot',
18: 'Peach___healthy',
19: 'Pepper,_bell___Bacterial_spot',
20: 'Pepper,_bell___healthy',
21: 'Potato___Early_blight',
22: 'Potato___Late_blight',
23: 'Potato___healthy',
24: 'Raspberry___healthy',
25: 'Soybean___healthy',
26: 'Squash___Powdery_mildew',
27: 'Strawberry___Leaf_scorch',
28: 'Strawberry___healthy',
29: 'Tomato___Bacterial_spot',
30: 'Tomato___Early_blight',
31: 'Tomato___Late_blight',
32: 'Tomato___Leaf_Mold',
33: 'Tomato___Septoria_leaf_spot',
34: 'Tomato___Spider_mites Two-spotted_spider_mite',
35: 'Tomato___Target_Spot',
36: 'Tomato___Tomato_Yellow_Leaf_Curl_Virus',
37: 'Tomato___Tomato_mosaic_virus',
38: 'Tomato___healthy'}
================================================
FILE: Flask Deployed App/Procfile
================================================
web: gunicorn app:app
================================================
FILE: Flask Deployed App/Readme.md
================================================
# 🌟Make Sure You Read all Instructions :
##### This code is fully funcional web app which is already deployed in heroku cloud server
##### You have install requirements.txt for run this code in your pc
##### For heroku we also have to create on Procfile
##### Your "plant_disease_model_1_latest.pt" should be in this folder. You have to trained that model in your pc/laptop and drag it to this folder
##### First check the Model section of this Repo. After that you can understand deployed app.
##### Make sure if you change the model name then also change the name of the model argument in the app.py
# ⭐Requirements
#### You have to Installed all the requirments. Save all the below requirements in requirements.txt
#### Run this line in cmd/shell : pip install -r requirements.txt
================================================
FILE: Flask Deployed App/app.py
================================================
import os
from flask import Flask, redirect, render_template, request
from PIL import Image
import torchvision.transforms.functional as TF
import CNN
import numpy as np
import torch
import pandas as pd
disease_info = pd.read_csv('disease_info.csv' , encoding='cp1252')
supplement_info = pd.read_csv('supplement_info.csv',encoding='cp1252')
model = CNN.CNN(39)
model.load_state_dict(torch.load("plant_disease_model_1_latest.pt"))
model.eval()
def prediction(image_path):
image = Image.open(image_path)
image = image.resize((224, 224))
input_data = TF.to_tensor(image)
input_data = input_data.view((-1, 3, 224, 224))
output = model(input_data)
output = output.detach().numpy()
index = np.argmax(output)
return index
app = Flask(__name__)
@app.route('/')
def home_page():
return render_template('home.html')
@app.route('/contact')
def contact():
return render_template('contact-us.html')
@app.route('/index')
def ai_engine_page():
return render_template('index.html')
@app.route('/mobile-device')
def mobile_device_detected_page():
return render_template('mobile-device.html')
@app.route('/submit', methods=['GET', 'POST'])
def submit():
if request.method == 'POST':
image = request.files['image']
filename = image.filename
file_path = os.path.join('static/uploads', filename)
image.save(file_path)
print(file_path)
pred = prediction(file_path)
title = disease_info['disease_name'][pred]
description =disease_info['description'][pred]
prevent = disease_info['Possible Steps'][pred]
image_url = disease_info['image_url'][pred]
supplement_name = supplement_info['supplement name'][pred]
supplement_image_url = supplement_info['supplement image'][pred]
supplement_buy_link = supplement_info['buy link'][pred]
return render_template('submit.html' , title = title , desc = description , prevent = prevent ,
image_url = image_url , pred = pred ,sname = supplement_name , simage = supplement_image_url , buy_link = supplement_buy_link)
@app.route('/market', methods=['GET', 'POST'])
def market():
return render_template('market.html', supplement_image = list(supplement_info['supplement image']),
supplement_name = list(supplement_info['supplement name']), disease = list(disease_info['disease_name']), buy = list(supplement_info['buy link']))
if __name__ == '__main__':
app.run(debug=True)
================================================
FILE: Flask Deployed App/disease_info.csv
================================================
index,disease_name,description,Possible Steps,image_url
0,Apple : Scab,"Apple scab is the most common disease of apple and crabapple trees in Minnesota.
Scab is caused by a fungus that infects both leaves and fruit.
Scabby fruit are often unfit for eating.
Infected leaves have olive green to brown spots.
Leaves with many leaf spots turn yellow and fall off early.
Leaf loss weakens the tree when it occurs many years in a row.
Planting disease resistant varieties is the best way to manage scab.","Choose resistant varieties when possible.
Rake under trees and destroy infected leaves to reduce the number of fungal spores available to start the disease cycle over again next spring.
Water in the evening or early morning hours (avoid overhead irrigation) to give the leaves time to dry out before infection can occur.
Spread a 3- to 6-inch layer of compost under trees, keeping it away from the trunk, to cover soil and prevent splash dispersal of the fungal spores.
For best control, spray liquid copper soap early, two weeks before symptoms normally appear. Alternatively, begin applications when disease first appears, and repeat at 7 to 10 day intervals up to blossom drop.",https://extension.umn.edu/sites/extension.umn.edu/files/apple-scab-1.jpg
1,Apple : Black Rot,"Leaf symptoms first occur early in the spring when the leaves are unfolding.
They appear as small, purple specks on the upper surface of the leaves that enlarge into circular lesions 1/8 to 1/4 inch (3-6 mm) in diameter.
The margin of the lesions remains purple, while the center turns tan to brown. In a few weeks, secondary enlargement of these leaf spots occurs.
Heavily infected leaves become chlorotic and defoliation occurs.
As the rotted area enlarges, a series of concentric bands of uniform width form which alternate in color from black to brown. The flesh of the rotted area remains firm and leathery. Black pycnidia are often seen on the surface of the infected fruit.","Remove the cankers by pruning at least 15 inches below the end and burn or bury them. Also take preventative care with new season prunings and burn them, too.You are better off pruning during the dormant season. This will minimize the odds that fire blight will infect your tree and produce dead tissue that can easily be infected by Botryosphaeria.You should also take precautions if the bark is damaged by hail, or branches break during a windstorm. Using a copper-based fungicide will protect against both black rot and fire blight.",http://www.omafra.gov.on.ca/english/crops/facts/blackrotf1.jpg
2,Apple : Cedar rust,"Cedar apple rust (Gymnosporangium juniperi-virginianae) is a fungal disease that requires juniper plants to complete its complicated two year life-cycle. Spores overwinter as a reddish-brown gall on young twigs of various juniper species. In early spring, during wet weather, these galls swell and bright orange masses of spores are blown by the wind where they infect susceptible apple and crab-apple trees. The spores that develop on these trees will only infect junipers the following year. From year to year, the disease must pass from junipers to apples to junipers again; it cannot spread between apple trees.","Choose resistant cultivars when available.
Rake up and dispose of fallen leaves and other debris from under trees.
Remove galls from infected junipers. In some cases, juniper plants should be removed entirely.
Apply preventative, disease-fighting fungicides labeled for use on apples weekly, starting with bud break, to protect trees from spores being released by the juniper host. This occurs only once per year, so additional applications after this springtime spread are not necessary.
On juniper, rust can be controlled by spraying plants with a copper solution (0.5 to 2.0 oz/ gallon of water) at least four times between late August and late October.
Safely treat most fungal and bacterial diseases with SERENADE Garden. This broad spectrum bio-fungicide uses a patented strain of Bacillus subtilis that is registered for organic use. Best of all, SERENADE is completely non-toxic to honey bees and beneficial insects.",https://www.planetnatural.com/wp-content/uploads/2012/12/apple-rust.jpg
3,Apple : Healthy,"As with most fruit, apples produce best when grown in full sun, which means six or more hours of direct summer Sun daily.The best exposure for apples is a north side of a house, tree line, or rise rather than the south.Apple trees need well-drained soil, but should be able to retain some moisture.","Apples Are Nutritious.
Apples May Be Good for Weight Loss.
Apples May Be Good for Your Heart.
They're Linked to a Lower Risk of Diabetes.
They May Have Prebiotic Effects and Promote Good Gut Bacteria.
Substances in Apples May Help Prevent Cancer.",https://previews.123rf.com/images/msnobody/msnobody1508/msnobody150800002/43698436-red-apple-on-a-branch-of-an-apple-tree-on-a-sunny-day-organic-farmingagriculture-fresh-healthy-natur.jpg
4,Background Without Leaves,There is no leaf in the given image,please reupload image with leaf,https://cdn.onlinewebfonts.com/svg/img_332817.png
5,Blueberry : Healthy,"Blueberries Are Low in Calories But High in Nutrients. ...
Blueberries are the King of Antioxidant Foods. ...
Blueberries Reduce DNA Damage, Which May Help Protect Against Aging and Cancer. ...
Blueberries Protect Cholesterol in Your Blood From Becoming Damaged. ...
Blueberries May Lower Blood Pressure.","Deep, low pH mulch like peat moss, pine needles or well aged sawdust conserves water and minimizes soil water fluctuations. Water blueberry plants during the day. Keep the soil moist but not soggy. Give them at least 1"" per week during growing season and up to 4"" per week during fruit ripening.The blueberry is a shallow-rooted plant. Therefore, it requires a soil that holds moisture, but also drains well and doesnt stay wet. Dont plant blueberries in sites that have heavy, clayey soils that stay wet.",https://image.shutterstock.com/image-photo/blueberry-leaf-collection-isolated-on-260nw-308491814.jpg
6,Cherry : Powdery Mildew,"Initial symptoms, often occurring 7 to 10 days after the onset of the first irrigation, are light roughly-circular, powdery looking patches on young, susceptible leaves (newly unfolded, and light green expanding leaves). Older leaves develop an age-related (ontogenic) resistance to powdery mildew and are naturally more resistant to infection than younger leaves. Look for early leaf infections on root suckers, the interior of the canopy or the crotch of the tree where humidity is high. In contrast to other fungi, powdery mildews do not need free water to germinate but germination and fungal growth are favored by high humidity. The disease is more likely to initiate on the undersides (abaxial) of leaves but will occur on both sides at later stages. As the season progresses and infection is spread by wind, leaves may become distorted, curling upward. Severe infections may cause leaves to pucker and twist. Newly developed leaves on new shoots become progressively smaller, are often pale and may be distorted.","Disinfect the cutting edges, then prune out and discard the diseased portions of the plant immediately. At the same time, apply fungicides to protect the remaining leaves on the fruit tree. You'll need to repeat the fungicide applications according to label instructions to protect the trees over the entire season.",http://treefruit.wsu.edu/wp-content/uploads/2017/05/Fig1.png
7,Cherry : Healthy,"There is no difference in care between sour and sweet cherries.
Apply mulch to retain moisture.
Drape netting over trees to protect the fruit from birds.
Water routinely in dry areas.
Thinning the fruit is not necessary for cherry trees, as they typically thin naturally in early summer.","Packed with nutrients.
Rich in antioxidants and anti-inflammatory compounds.
Can boost exercise recovery.
May benefit heart health.
May improve symptoms of arthritis and gout.
May improve sleep quality.
Easy to add to your diet.",https://previews.123rf.com/images/annafrby/annafrby1907/annafrby190700078/127086189-cherry-on-branch-with-green-leaf-healthy-food-fresh-fruit-two-ripe-berries-of-a-cherry-on-a-branch-l.jpg
8,Corn : Cercospora Leaf Spot | Gray Leaf Spot,"Gray leaf spot on corn, caused by the fungus Cercospora zeae-maydis, is a peren- nial and economically damaging disease in the United States. Since the mid-1990s, the disease has increased in importance in Indiana, and now is the one of the most important foliar diseases of corn in the state.Gray leaf spot disease is caused by the fungus Pyricularia grisea, also referred to as Magnaporthe grisea. The frequent warm rainy periods common in Florida create favorable conditions for this fungal disease. This fungus slows grow-in, thins established stands and can kill large areas of St.","Irrigate deeply, but infrequently.
Avoid using post-emergent weed killers on the lawn while the disease is active.
Avoid medium to high nitrogen fertilizer levels.
Improve air circulation and light level on lawn.
Mow at the proper height and only mow when the grass is dry.",https://upload.wikimedia.org/wikipedia/commons/thumb/1/12/Gray_leaf_spot_Cercospora_zeae-maydis_5465607.png/330px-Gray_leaf_spot_Cercospora_zeae-maydis_5465607.png
9,Corn : Common Rust,"Although a few rust pustules can always be found in corn fields throughout the growing season, symptoms generally do not appear until after tasseling. These can be easily recognized and distinguished from other diseases by the development of dark, reddish-brown pustules (uredinia) scattered over both the upper and lower surfaces of the corn leaves. These pustules may appear on any above ground part of the plant, but are most abundant on the leaves. Pustules appear oval to elongate in shape, are generally small, less than 1/4 inch long, and are surrounded by the leaf epidermal layer, where it has broken through. ","To reduce the incidence of corn rust, plant only corn that has resistance to the fungus. Resistance is either in the form of race-specific resistance or partial rust resistance. In either case, no sweet corn is completely resistant. If the corn begins to show symptoms of infection, immediately spray with a fungicide.",https://ohioline.osu.edu/sites/ohioline/files/imce/Plant_Pathology/PLNTPTH-CER-02_Figure_1.png
10,Corn : Northern Leaf Blight,"Northern corn leaf blight (NCLB) is caused by the fungus Setosphaeria turcica. Symptoms usually appear first on the lower leaves. Leaf lesions are long (1 to 6 inches) and elliptical, gray-green at first but then turn pale gray or tan. Under moist conditions, dark gray spores are produced, usually on the lower leaf surface, which give lesions a ""dirty"" gray appearance. Entire leaves on severely blighted plants can die, so individual lesions are not visible. Lesions may occur on the outer husk of ears, but the kernels are not infected. On hybrids that contain an Ht gene for resistance to the fungus, lesions are smaller, chlorotic, and may develop into linear streaks. These lesions rarely produce spores.","Fungicide applications reduced Northern Corn Leaf Blight damage and protected yield. Fungicide value was higher in reducing yield in susceptible corn hybrids. Fungicide were most effective if they were applied at disease onset. Disease onset varied in growth stages, and so the best stage to apply fungicides.",https://crop-protection-network.s3.amazonaws.com/articles/NLB-Daren-Mueller-02.jpg
11,Corn : Healthy,"Corn plants prefer daytime temperatures of 75 to 80 degrees F and 65 to 70 degrees F during the night. The soil should be kept consistently moist, but not soggy and they only need fertilizer every 6 months. Although dracaena can take low light conditions, they do best when placed in bright but indirect light.Its just natural for a plant to produce a few yellow leaves, its nothing to get alarmed about.However if it produces a lot of yellow leaves all at once, say five or six, you may be over-watering or the plant may be suffering from a lack of light.","Corn has several health benefits. Because of the high fiber content, it can aid with digestion. It also contains valuable B vitamins, which are important to your overall health. Corn also provides our bodies with essential minerals such as zinc, magnesium, copper, iron and manganese.",https://c8.alamy.com/comp/A85TR2/young-healthy-green-leaves-of-corn-maize-plant-in-pretty-unfolding-A85TR2.jpg
12,Grape : Black Rot,"Grape black rot is a fungal disease caused by an ascomycetous fungus, Guignardia bidwellii, that attacks grape vines during hot and humid weather. Grape black rot originated in eastern North America, but now occurs in portions of Europe, South America, and Asia. It can cause complete crop loss in warm, humid climates, but is virtually unknown in regions with arid summers. The name comes from the black fringe that borders growing brown patches on the leaves. The disease also attacks other parts of the plant, all green parts of the vine: the shoots, leaf and fruit stems, tendrils, and fruit. The most damaging effect is to the fruit",Mancozeb is available as BONIDE MANCOZEB FLOWABLE fungicide. It contains 37% Mancozeb and should be very effective for controlling black rot. Nova (myclobutanil) is available in IMMUNOX FUNGICIDE. It is 1.55 % myclobutanil and should be effective for controlling black rot.,https://upload.wikimedia.org/wikipedia/commons/thumb/c/cb/Guignardia_bidwellii_08.jpg/330px-Guignardia_bidwellii_08.jpg
13,Grape : Esca | Black Measles,"Grapevine measles, also called esca, black measles or Spanish measles, has long plagued grape growers with its cryptic expression of symptoms and, for a long time, a lack of identifiable causal organism(s). The name measles refers to the superficial spots found on the fruit (Fig. 1). During the season, the spots may coalesce over the skin surface, making berries black in appearance. Spotting can develop anytime between fruit set and a few days prior to harvest. Berries affected at fruit set tend not to mature and will shrivel and dry up. In addition to spotting, fruit affected later in the season will also have an acrid taste.Leaf symptoms are characterized by a tiger stripe pattern (Fig 2-bottom leaf) when infections are severe from year to year. Mild infections can produce leaf symptoms (Fig. 2-upper leaf) that can be confused with other diseases or nutritional deficiencies. White cultivars will display areas of chlorosis followed by necrosis, while red cultivars are characterized by red areas followed by necrosis. Early spring symptoms include shoot tip dieback, leaf discoloration and complete defoliation in severe cases.","Till date there is no effective method to control this disease. Remove the infected berries, leaves and trunk and destroy them. Protect the prune wounds to minimize fungal infection using wound sealant (5% boric acid in acrylic paint) or essential oil or suitable fungicides.",https://www.researchgate.net/profile/Laura-Mugnai/publication/43161073/figure/fig1/AS:340404659605512@1458170203496/Symptoms-associated-with-esca-of-grapevine-chlorosis-and-necrosis-on-the-leaves-showing_Q320.jpg
14,Grape : Leaf Blight | Isariopsis Leaf Spot,"The fungus is an obligate pathogen which can attack all green parts of the vine.
Symptoms of this disease are frequently confused with those of powdery mildew. Infected leaves develop pale yellow-green lesions which gradually turn brown. Severely infected leaves often drop prematurely.Infected petioles, tendrils, and shoots often curl, develop a shepherd's crook, and eventually turn brown and die.
Young berries are highly susceptible to infection and are often covered with white fruiting structures of the fungus. Infected older berries of white cultivars may turn dull gray-green, whereas those of black cultivars turn pinkish red.","Apply dormant sprays to reduce inoculum levels.
Cut it out.
Open up that canopy.
Don't let down your defenses.
Scout early, scout often.
Use protectant and systemic fungicides.
Consider fungicide resistance.
Watch the weather.",https://www.goodfruit.com/wp-content/uploads/Black-rot-lesions-on-leaves-indicate-potential-for-fruit-infection-1-feat2.jpg
15,Grape : Healthy,Apply water only to the root zone. Avoid getting grape foliage wet as this can encourage many grape diseases. Reduce watering young vines in the fall to encourage the plant to harden-off its canes to prepare for winter. Older vines seldom need any watering unless on sandy or other very well drained soils.,"Packed With Nutrients, Especially Vitamins C and K.
High Antioxidant Contents May Prevent Chronic Diseases.
Plant Compounds May Protect Against Certain Types of Cancer.
Beneficial for Heart Health in Various Impressive Ways.
May Decrease Blood Sugar Levels and Protect Against Diabetes.",https://images.indianexpress.com/2021/02/grapes-1200.jpg
16,Orange : Haunglongbing | Citrus Greening,"Citrus greening disease is a disease of citrus caused by a vector-transmitted pathogen. HLB is distinguished by the common symptoms of yellowing of the veins and adjacent tissues; followed by splotchy mottling of the entire leaf, premature defoliation, dieback of twigs, decay of feeder rootlets and lateral roots, and decline in vigor, ultimately followed by the death of the entire plant. Affected trees have stunted growth, bear multiple off-season flowers (most of which fall off), and produce small, irregularly shaped fruit with a thick, pale peel that remains green at the bottom and tastes very bitter. Common symptoms can often be mistaken for nutrient deficiencies; however, the distinguishing factor between nutrient deficiencies is the pattern of symmetry. Nutrient deficiencies tend to be symmetrical along the leaf vein margin, while HLB has an asymmetrical yellowing around the vein. The most noticeable symptom of HLB is greening and stunting of the fruit, especially after ripening","The only way to prevent the spread of Citrus Greening Disease is to control ACP(Asian Citrus Psyllid). Since citrus is such a popular and widely-planted garden tree, homeowners are on the front lines of this important battle.Spray the lemon tree with Neem oil insecticide, both the top and undersides of the foliage. You may need to repeat in 10-14 days, depending upon the extent of the infestation. Follow up by treating the mold growth with liquid copper fungicide.",https://www.universityofcalifornia.edu/sites/default/files/CitrusGreening.jpg
17,Peach : Bacterial Spot,"Bacterial spot is an important disease of peaches, nectarines, apricots, and plums caused by Xanthomonas campestris pv. pruni. Symptoms of this disease include fruit spots, leaf spots, and twig cankers. Fruit symptoms include pitting, cracking, gumming, and watersoaked tissue, which can make the fruit more susceptible to brown rot, rhizopus, and other fungal infections. Severe leaf spot infections can cause early defoliation. Severe defoliation can result in reduced fruit size, and sunburn and cracking of fruit. Early defoliated trees are reduced in vigor and winter hardiness.","Fruit symptoms of bacterial spot may be confused with peach scab, caused by the fungus Cladosporium carpophyllium, however scab spots are more circular, have a dark brown/greenish, fuzzy appearance, and do not pit the fruit surface, although skin cracking can occur. Scab does not cause leaf symptoms but can cause spots on twigs. Initial fruit spots of bacterial spot may be superficial but develop into craters.",https://www.gardeningknowhow.com/wp-content/uploads/2016/07/bacterial-spot-peach.jpg
18,Peach : Healthy,"Peach trees grow in USDA Zones 5 to 8 or 9, and theyre available in dwarf or standard sizes, making them a great choice for backyard orchards.Unlike most ornamentals, peach trees need regular pruning, fertilizing, and spraying to stay healthy and productive. Keep the ground around your tree clear of grass and weeds that would compete for water and nutrients, and mulch generously.","Packed With Nutrients and Antioxidants.
May Aid Digestion.
May Improve Heart Health.
May Protect Your Skin.
May Prevent Certain Types of Cancer.
May Reduce Allergy Symptoms.
Widely Available and Easy to Add to Your Diet.",https://www.tasteofhome.com/wp-content/uploads/2019/06/peaches-shutterstock_297863489-1.jpg
19,Pepper bell : Bacterial Spot,"Leaf spots that appear on the lower surface of older leaves as small, pimples and on the upper leaf surface as small water-soaked spots are a symptom of bacterial spot. This is an important pepper disease in Maryland. It also occasionally attacks tomatoes. Eventually, the spots develop gray to tan centers with darker borders. Lesions enlarge during warm, humid weather. Leaves may then turn yellow, then brown and drop. Lesions may also develop on stems. Fruits develop small, raised rough spots that do not affect eating quality. Severely infected leaves will drop resulting in sunscald of peppers. Bacterial leaf spot is spread by splashing rain and working with wet, infected plants. This disease can defoliate plants during wet weather. Hot, dry weather slows the spread of this disease. The disease can come in on seed or transplants and can overwinter in crop residue and soil.","Select resistant varieties
Purchase disease-free seed and transplants.
Treat seeds by soaking them for 2 minutes in a 10% chlorine bleach solution (1 part bleach; 9 parts water). Thoroughly rinse seeds and dry them before planting.
Mulch plants deeply with a thick organic material like newspaper covered with straw or grass clippings.
Avoid overhead watering.
Remove and discard badly infected plant parts and all debris at the end of the season.
Spray every 10-14 days with fixed copper (organic fungicide) to slow down the spread of infection.
Rotate peppers to a different location if infections are severe and cover the soil with black plastic mulch or black landscape fabric prior to planting.",https://extension.umd.edu/sites/default/files/_images/programs/grow_it_eat_it/diseases/BacterialLeafSpot/bacterial_leaf_spot_pepper_plant_l.jpg
20,Pepper bell : Healthy,"Keep bell peppers well-watered, but never leave soil soggy. Water to moisten soil about 6 inches deep, then let it dry slightly. Watering is especially important during fruit set, when tiny peppers take the place of blossoms, and as the bells mature. Consistent moisture helps keep peppers firm and healthy.","Red, Orange, and Yellow Bell Peppers are full of great health benefitsthey're packed with vitamins and low in calories! They are an excellent source of vitamin A, vitamin C, and potassium. Bell Peppers also contain a healthy dose of fiber, folate, and iron.",https://www.healthbenefitstimes.com/9/gallery/bell-peppers/Bell-pepper-leaves.jpg
21,Potato : Early Blight,"In most production areas, early blight occurs annually to some degree. The severity of early blight is dependent upon the frequency of foliar wetness from rain, dew, or irrigation; the nutritional status of the foliage; and cultivar susceptibility.The first symptoms of early blight appear as small, circular or irregular, dark-brown to black spots on the older (lower) leaves. These spots enlarge up to 3/8 inch in diameter and gradually may become angular-shaped.Initial lesions on young, fully expanded leaves may be confused with brown spot lesions. These first lesions appear about two to three days after infection, with further sporulation on the surface of these lesions occurring three to five days later.",Treatment of early blight includes prevention by planting potato varieties that are resistant to the disease; late maturing are more resistant than early maturing varieties. Avoid overhead irrigation and allow for sufficient aeration between plants to allow the foliage to dry as quickly as possible.,https://www.ag.ndsu.edu/publications/crops/early-blight-in-potato/figure-1-opt.jpeg/@@images/468990cc-77a9-4e29-8779-0eb3e94e0407.jpeg
22,Potato : Late Blight,"The primary host is potato, but P. infestans also can infect other solanaceous plants, including tomatoes, petunias and hairy nightshade, that can act as source of inoculum to potato.The first symptoms of late blight in the field are small, light to dark green, circular to irregular-shaped water-soaked spots. These lesions usually appear first on the lower leaves. Lesions often begin to develop near the leaf tips or edges, where dew is retained the longest.During cool, moist weather, these lesions expand rapidly into large, dark brown or black lesions, often appearing greasy. Leaf lesions also frequently are surrounded by a yellow chlorotic halo",The severe late blight can be effectively managed with prophylactic spray of mancozeb at 0.25% followed by cymoxanil+mancozeb or dimethomorph+mancozeb at 0.3% at the onset of disease and one more spray of mancozeb at 0.25% seven days after application of systemic fungicides in West Bengal ,https://www.ag.ndsu.edu/publications/crops/late-blight-in-potato/figure-2-opt.jpeg/@@images/dfe1e0b4-08d4-404a-8e66-474de72b1e91.jpeg
23,Potato : Healthy,"Many potatoes need consistent moisture levels to develop, so water regularly on a daily basis when tubers establish. When you the water the potato plants it should reach to the ground level of about 8-10 inches. During hot or warm seasons water the potato plants in huge amounts twice a day as the soil gets dry quickly.","Packed With Nutrients. Share on Pinterest.
Contain Antioxidants. Potatoes are rich in compounds like flavonoids, carotenoids and phenolic acids (4).
May Improve Blood Sugar Control.
May Improve Digestive Health.
Naturally Gluten-Free.
Incredibly Filling.
Extremely Versatile.",https://www.garden.eco/wp-content/uploads/2018/06/can-you-eat-potato-leaves.jpg
24,Raspberry : Healthy,"Water one inch per week from spring until after harvest. Regular watering is better than infrequent deep soaking. Keep your raspberry bushes tidy by digging up any suckers or canes that grow well away from the rows; if you don't dig them up, they'll draw nutrients away and you'll have less berries next year.","They provide potassium, essential to heart function, and proven to lower blood pressure. The omega-3 fatty acids in raspberries can help prevent stroke and heart disease. They also contain a mineral called manganese, which is necessary for healthy bones and skin and helps regulate blood sugar.",https://www.gardeningknowhow.com/wp-content/uploads/2009/04/raspberry.jpg
25,Soybean : Healthy,Keep planting beds evenly moist until soybeans have pushed through the soil. Water regularly during flowering and pod formation. Avoid overhead watering which can cause flowers and pods to fall off. Mulch when the soil warms to greater than 60F (16C) to conserve soil moisture.,"high in fibre
high in protein
low in saturated fat
cholesterol free
lactose free
a good source of omega-3 fatty acids
a source of antioxidants
high in phytoestrogens.",https://upload.wikimedia.org/wikipedia/commons/a/ac/Soybean_leaves.jpg
26,Squash : Powdery Mildew,"White powdery spots can form on both upper and lower leaf surfaces, and quickly expand into large blotches.
Powdery mildew weakens the plant and the fruit ripens prematurely. Fewer and smaller fruit grow on infected plants.
In warm, dry conditions, new spores form and easily spread the disease.
Symptoms of powdery mildew first appear mid to late summer in Minnesota.
Provide good air movement around plants through proper spacing, staking of plants and weed control.
If susceptible varieties are growing in an area where powdery mildew has resulted in yield loss in the past, fungicide may be necessary.","Combine one tablespoon baking soda and one-half teaspoon of liquid, non-detergent soap with one gallon of water, and spray the mixture liberally on the plants. Mouthwash. The mouthwash you may use on a daily basis for killing the germs in your mouth can also be effective at killing powdery mildew spores.",https://extension.umn.edu/sites/extension.umn.edu/files/styles/caption_medium/public/powdery-mildew-2.jpg?itok=Un68av52
27,Strawberry : Leaf Scorch,"Leaf scorch symptoms are very similar to the early stages of common (Mycosphaerella) leaf spot, with irregular dark purple spots being scattered over the upper leaf surface. As the spots enlarge, they begin to look like drops of tar, and are actually the accumulations of black fruiting bodies (acervuli) of the fungus. The centers of the spots remain purple (in Mycosphaerella leaf spot they are white) and there is no well-defined lesion border. In heavy infections, these regions coalesce and the tissue between the lesions often takes on a purplish to bright red color that is dependent on cultivar, temperature, or other factors. The leaves eventually turn brown, dry up, and curl at the margins giving the leaf a scorched appearance. Examination of the acervuli and conidial morphology can help to distinguish between leaf spot and leaf scorch at this advanced stage of disease. On the upper leaf surfaces of leaf scorch lesions, the acervuli are dark with glistening spore masses and dark apothecia. Petiole lesions are elongate, sunken, with a purplish to brown color and can kill the leaf by girdling the petiole. Runners, fruit stalks, fruit and caps can also become infected. Plants may become weakened and the number and vigor of crowns reduced. Infection predisposes the plants to winter and drought stress. In severe infestations, flowers and fruit may die.","While leaf scorch on strawberry plants can be frustrating, there are some strategies which home gardeners may employ to help prevent its spread in the garden. The primary means of strawberry leaf scorch control should always be prevention. Since this fungal pathogen overwinters on the fallen leaves of infected plants, proper garden sanitation is key. This includes the removal of infected garden debris from the strawberry patch, as well as the frequent establishment of new strawberry transplants. The creation of new plantings and strawberry patches is key to maintaining a consistent strawberry harvest, as older plants are more likely to show signs of severe infection.",https://content.ces.ncsu.edu/media/images/17531_IMG_2126.JPG
28,Strawberry : Healthy,"Find them a sunny spot because they love and need lots of light. I prefer a spot where they receive the morning sun.
If you have them in pots and/or other containers, it is good to move them during the day to take advantage of changing sunlight.
They are thirsty plants. Water them daily, especially if they are producing fruit. It is best to do it in the morning and to avoid wetting the leaves for disease prevention.
Keep them guarded from extreme weather conditions and wind. Please note that even if they like sunlight, being exposed to direct midday sunlight can be damaging as well.
Check the pots for good drainage.
Keep weeds and unwanted plants in check.
You need to fertilize them because they need a lot of energy to produce strawberries. Buy a balanced fertilizer (10-10-10, 12-12-12, etc). Follow the directions because too much fertilizer can reduce the fruit yield and it may also stimulate runner production.","The heart-shaped silhouette of the strawberry is the first clue that this fruit is good for you. These potent little packages protect your heart, increase HDL (good) cholesterol, lower your blood pressure, and guard against cancer.
Packed with vitamins, fiber, and particularly high levels of antioxidants known as polyphenols, strawberries are a sodium-free, fat-free, cholesterol-free, low-calorie food. They are among the top 20 fruits in antioxidant capacity and are a good source of manganese and potassium. Just one serving -- about eight strawberries -- provides more vitamin C than an orange.",https://www.canr.msu.edu/uploads/images/7-12-11-MARK-plhstrw4.jpg
29,Tomato : Bacterial Spot,"Bacterial spot of tomato is a potentially devastating disease that, in severe cases, can lead to unmarketable fruit and even plant death. Bacterial spot can occur wherever tomatoes are grown, but is found most frequently in warm, wet climates, as well as in greenhouses. The disease is often an issue in Wisconsin.Bacterial spot can affect all above ground parts of a tomato plant, including the leaves, stems, and fruit. Bacterial spot appears on leaves as small (less than ? inch), sometimes water-soaked (i.e., wet-looking) circular areas. Spots may initially be yellow-green, but darken to brownish-red as they age. When the disease is severe, extensive leaf yellowing and leaf loss can also occur. On green fruit, spots are typically small, raised and blister-like, and may have a yellowish halo. As fruit mature, the spots enlarge (reaching a maximum size of inch) and turn brown, scabby and rough. Mature spots may be raised, or sunken with raised edges.","Plant pathogen-free seed or transplants to prevent the introduction of bacterial spot pathogens on contaminated seed or seedlings. If a clean seed source is not available or you suspect that your seed is contaminated, soak seeds in water at 122F for 25 min. to kill the pathogens. To keep leaves dry and to prevent the spread of the pathogens, avoid overhead watering (e.g., with a wand or sprinkler) of established plants and instead use a drip-tape or soaker-hose. Also to prevent spread, DO NOT handle plants when they are wet (e.g., from dew) and routinely sterilize tools with either 10% bleach solution or (better) 70% alcohol (e.g., rubbing alcohol). Where bacterial spot has been a recurring problem, consider using preventative applications of copper-based products registered for use on tomato, especially during warm, wet periods. Keep in mind however, that if used excessively or for prolonged periods, copper may no longer control the disease. Be sure to read and follow all label instructions of the product that you select to ensure that you use it in the safest and most effective manner possible.",https://www.growingproduce.com/wp-content/uploads/2019/08/bacterial_spot_tomato.jpg
30,Tomato : Early Blight,"Early blight is one of the most common tomato diseases, occurring nearly every season wherever tomatoes are grown.
It affects leaves, fruits and stems and can be severely yield limiting when susceptible cultivars are used and weather is favorable.
Severe defoliation can occur and result in sunscald on the fruit.
Early blight is common in both field and high tunnel tomato production in Minnesota.","Prune or stake plants to improve air circulation and reduce fungal problems.
Make sure to disinfect your pruning shears (one part bleach to 4 parts water) after each cut.
Keep the soil under plants clean and free of garden debris. Add a layer of organic compost to prevent the spores from splashing back up onto vegetation.
Drip irrigation and soaker hoses can be used to help keep the foliage dry.
For best control, apply copper-based fungicides early, two weeks before disease normally appears or when weather forecasts predict a long period of wet weather. Alternatively, begin treatment when disease first appears, and repeat every 7-10 days for as long as needed.
Containing copper and pyrethrins, Bonide Garden Dust is a safe, one-step control for many insect attacks and fungal problems. For best results, cover both the tops and undersides of leaves with a thin uniform film or dust. Depending on foliage density, 10 oz will cover 625 sq ft. Repeat applications every 7-10 days, as needed.",https://extension.umn.edu/sites/extension.umn.edu/files/styles/large/public/early-blight-leaf-tomato.jpg?itok=woYQQlrF
31,Tomato : Late Blight,"Late blight is caused by the oomycete Phytophthora infestans. Oomycetes are fungus-like organisms also called water molds, but they are not true fungi.
There are many different strains of P. infestans. These are called clonal lineages and designated by a number code (i.e. US-23). Many clonal lineages affect both tomato and potato, but some lineages are specific to one host or the other.Late blight is a potentially devastating disease of tomato and potato, infecting leaves, stems and fruits of tomato plants.
The disease spreads quickly in fields and can result in total crop failure if untreated.
Late blight of potato was responsible for the Irish potato famine of the late 1840s.","Sanitation is the first step in controlling tomato late blight. Clean up all debris and fallen fruit from the garden area. This is particularly essential in warmer areas where extended freezing is unlikely and the late blight tomato disease may overwinter in the fallen fruit. Currently, there are no strains of tomato available that are resistant to late tomato blight, so plants should be inspected at least twice a week. Since late blight symptoms are more likely to occur during wet conditions, more care should be taken during those times. For the home gardener, fungicides that contain maneb, mancozeb, chlorothanolil or fixed copper can help protect plants from late tomato blight. Repeated applications are necessary throughout the growing season as the disease can strike at any time. For organic gardeners, there are some fixed copper products approved for use; otherwise, all infected plants must be immediately removed and destroyed.","https://www.canr.msu.edu/contentAsset/image/e97d1ef0-5b55-49b0-ab4e-c57dcbeca65e/fileAsset/filter/Resize,Jpeg/resize_w/750/jpeg_q/80"
32,Tomato : Leaf Mold,"Tomato leaf mold is a fungal disease that can develop when there are extended periods of leaf wetness and the relative humidity is high (greater than 85 percent). Due to this moisture requirement, the disease is seen primarily in hoophouses and greenhouses. Tomato leaf mold can develop during early spring temperatures (50.9 degrees Fahrenheit) or those characteristic of summer (90 F). The optimal temperature tomato leaf mold is in the low 70s.
Symptoms of disease include yellow spots on the upper leaf surface. Discrete masses of olive-green spores can be seen on the underside of the affected leaves.","When treating tomato plants with fungicide, be sure to cover all areas of the plant that are above the soil, especially the underside of leaves, where the disease often forms. Calcium chloride-based sprays are recommended for treating leaf mold issues. Organic fungicide options are also available.",https://www.gardeningknowhow.com/wp-content/uploads/2018/04/tomato-leaf-mold-400x300.jpg
33,Tomato : Septoria Leaf Spot,"Septoria leaf spot is caused by a fungus, Septoria lycopersici. It is one of the most destructive diseases of tomato foliage and is particularly severe in areas where wet, humid weather persists for extended periods.Septoria leaf spot usually appears on the lower leaves after the first fruit sets. Spots are circular, about 1/16 to 1/4 inch in diameter with dark brown margins and tan to gray centers with small black fruiting structures. Characteristically, there are many spots per leaf. This disease spreads upwards from oldest to youngest growth. If leaf lesions are numerous, the leaves turn slightly yellow, then brown, and then wither. Fruit infection is rare.","Remove diseased leaves.
Improve air circulation around the plants.
Mulch around the base of the plants. Mulching will reduce splashing soil, which may contain fungal spores associated with debris. Apply mulch after the soil has warmed.
Do not use overhead watering. Overhead watering facilitates infection and spreads the disease. Use a soaker hose at the base of the plant to keep the foliage dry. Water early in the day.
Control weeds. Nightshade and horsenettle are frequently hosts of Septoria leaf spot and should be eradicated around the garden site.
Use crop rotation. Next year do not plant tomatoes back in the same location where diseased tomatoes grew. Wait 12 years before replanting tomatoes in these areas.
Use fungicidal sprays.",https://www.missouribotanicalgarden.org/portals/0/Gardening/Gardening%20Help/images/Pests/Septoria_Leaf_Spot_of_Tomato187.jpg
34,Tomato : Spider Mites | Two-Spotted Spider Mite,"The two-spotted spider mite is the most common mite species that attacks vegetable and fruit crops in New England. Spider mites can occur in tomato, eggplant, potato, vine crops such as melons, cucumbers, and other crops. Two-spotted spider mites are one of the most important pests of eggplant. They have up to 20 generations per year and are favored by excess nitrogen and dry and dusty conditions. Outbreaks are often caused by the use of broad-spectrum insecticides which interfere with the numerous natural enemies that help to manage mite populations. As with most pests, catching the problem early will mean easier control.","Avoid weedy fields and do not plant eggplant adjacent to legume forage crops.
Avoid early season, broad-spectrum insecticide applications for other pests.
Do not over-fertilize.
Overhead irrigation or prolonged periods of rain can help reduce populations.",https://entomology.ca.uky.edu/files/styles/panopoly_image_original/public/310a.jpg?itok=XNlP0H9H
35,Tomato : Target Spot,"The disease starts on the older leaves and spreads upwards. The first signs are irregular-shaped spots (less than 1 mm) with a yellow margin . Some of the spots enlarge up to 10 mm and show characteristics rings, hence the name of ""target spot"" . Spread to all leaflets and to other leaves is rapid , causing the leaves to turn yellow, collapse and die . Spots also occur on the stems. They are long and thin. Small light brown spots with dark margins may also occur on the fruit.
The spores are spread by wind-blown rain, and if windy wet weather continues for a few days, spread is fast and plants lose their leaves quickly.","Cultural control is important. The following should be done:
Do not plant new crops next to older ones that have the disease.
Plant as far as possible from papaya, especially if leaves have small angular spots (Photo 5).
Check all seedlings in the nursery, and throw away any with leaf spots.
Remove a few branches from the lower part of the plants to allow better airflow at the base
Remove and burn the lower leaves as soon as the disease is seen, especially after the lower fruit trusses have been picked.
Keep plots free from weeds, as some may be hosts of the fungus.
Do not use overhead irrigation; otherwise, it will create conditions for spore production and infection.
Collect and burn as much of the crop as possible when the harvest is complete.
Practise crop rotation, leaving 3 years before replanting tomato on the same land.",https://barmac.com.au/wp-content/uploads/sites/3/2016/01/Target-Spot-Tomato1.jpg
36,Tomato : Yellow Leaf Curl Virus,"Tomato yellow leaf curl virus is a species in the genus Begomovirus and family Geminiviridae. Tomato yellow leaf curl virus (TYLCV) infection induces severe symptoms on tomato plants and causes serious yield losses worldwide. TYLCV is persistently transmitted by the sweetpotato whitefly, Bemisia tabaci (Gennadius). Cultivars and hybrids with a single or few genes conferring resistance against TYLCV are often planted to mitigate TYLCV-induced losses. These resistant genotypes (cultivars or hybrids) are not immune to TYLCV. They typically develop systemic infection, display mild symptoms, and produce more marketable tomatoes than susceptible genotypes under TYLCV pressure.In several pathosystems, extensive use of resistant cultivars with single dominant resistance-conferring gene has led to intense selection pressure on the virus, development of highly virulent strains, and resistance breakdown.",Use only virus-and whitefly-free tomato and pepper transplants. Transplants should be treated with Capture (bifenthrin) or Venom (dinotefuran) for whitefly adults and Oberon for eggs and nymphs. Imidacloprid or thiamethoxam should be used in transplant houses at least seven days before shipping. Imidacloprid should be sprayed on the entire plant and below the leaves; eggs and flies are often found below the leaves. Spray every 14-21 days and rotate on a monthly basis with Abamectin so that the whiteflies do not build-up resistance to chemicals.,https://gd.eppo.int/media/data/taxon/T/TYLCV0/pics/1024x0/10609.jpg
37,Tomato : Mosaic Virus,"Tomato mosaic virus (ToMV) and Tobacco mosaic virus (TMV) are hard to distinguish.
Tomato mosaic virus (ToMV) can cause yellowing and stunting of tomato plants resulting in loss of stand and reduced yield.
ToMV may cause uneven ripening of fruit, further reducing yield.
Tobacco mosaic virus (TMV) was once thought to be more common on tomato.
TMV is usually more of a tobacco pathogen than a tomato pathogen.Mottled light and dark green on leaves.
Young tomato leaf that is mottled light and dark green, stunted growth, curled and malformed leaves.
Tobacco Mosaic virus symptoms on a tomato seedling
If plants are infected early, they may appear yellow and stunted overall.
Leaves may be curled, malformed, or reduced in size.","Use certified disease-free seed or treat your own seed.
Soak seeds in a 10% solution of trisodium phosphate (Na3PO4) for at least 15 minutes.
Or heat dry seeds to 158 F and hold them at that temperature for two to four days.
Purchase transplants only from reputable sources. Ask about the sanitation procedures they use to prevent disease.
Inspect transplants prior to purchase. Choose only transplants showing no clear symptoms.
Avoid planting in fields where tomato root debris is present, as the virus can survive long-term in roots.
Wash hands with soap and water before and during the handling of plants to reduce potential spread between plants.",http://ucanr.edu/blogs/dirt/blogfiles/71403_original.jpg
38,Tomato : Healthy,"Fertilize one week before as well as on the day of planting. They especially love phosphorous, which promotes the formation of blossoms and the fruits or vegetables that grow from them. Avoid high nitrogen when your tomato plants have blossoms as it promotes vine growth rather than fruit growth.Don't Crowd Tomato Seedlings.Provide Lots of Light.Preheat the Garden Soil.Bury the Stems.Mulch Tomatoes After the Soil Has Warmed.Remove the Bottom Leaves.Pinch and Prune for More Tomatoes.Water Regularly.","The tomato (Solanum lycopersicum) is a fruit from the nightshade family native to South America.
Despite botanically being a fruit, its generally eaten and prepared like a vegetable.
Tomatoes are the major dietary source of the antioxidant lycopene, which has been linked to many health benefits, including reduced risk of heart disease and cancer.
They are also a great source of vitamin C, potassium, folate, and vitamin K.",https://cdn8.dissolve.com/p/D869_27_632/D869_27_632_1200.jpg
================================================
FILE: Flask Deployed App/static/uploads/Readme.md
================================================
#### Why this folder ?
At the Runtime what ever local image will test that are saved in this folder and use this folder path in model prediction phase.
================================================
FILE: Flask Deployed App/supplement_info.csv
================================================
index,disease_name,supplement name,supplement image,buy link
0,Apple___Apple_scab,Katyayani Prozol Propiconazole 25% EC Systematic Fungicide,https://encrypted-tbn1.gstatic.com/shopping?q=tbn:ANd9GcRfq9MLrPL9tFkuFbGb98fMGDdl67v4I2iDLYCVprdsdGaXURCl9UNEr8v_65X1hKrYF5NjSvB01HOGexg-3CJxjkVSu9zPNJ2AunP09vPa0gjEILskTILx&usqp=CAE,https://agribegri.com/products/buy-propiconazole--25-ec-systematic-fungicide-online-.php
1,Apple___Black_rot,Magic FungiX For Fungal disease,https://encrypted-tbn3.gstatic.com/shopping?q=tbn:ANd9GcTZZH2SUe7Hufpd49iFoF_04c96J-fZeywsYQXDb0gFerGOYyL7xPBxLN05LIx6s36u6C_qMvtescsDbrTEzniJp0yhfEsvJoTCMD7FDnI&usqp=CAE,https://agribegri.com/products/buy-fungicide-online-india--organic-fungicide--yield-enhancer.php
2,Apple___Cedar_apple_rust,Katyayani All in 1 Organic Fungicide,https://encrypted-tbn2.gstatic.com/shopping?q=tbn:ANd9GcT2JQ-fAdtrzzmkSespqEpKwop3BnWntsLioVSgjy79mpxQVPSqoD4v9yfL0mtiFJvFnPqeE7EcefadhdEpc9uUTCZbROwOPsklL_XDMSLTpxOGvIcBMMFiBQ&usqp=CAE,https://agribegri.com/products/buy-organic-fungicide-all-in-1-online--organic-fungicide-.php
3,Apple___healthy,Tapti Booster Organic Fertilizer,https://rukminim1.flixcart.com/image/416/416/kc6jyq80/soil-manure/6/y/v/500-tapti-booster-500-ml-green-yantra-original-imaftd6rrgfhvshc.jpeg?q=70,https://agribegri.com/products/tapti-booster-500-ml--organic-fertilizer-online-in-india.php
4,Background_without_leaves,,,
5,Blueberry___healthy,GreenStix Fertilizer,https://encrypted-tbn3.gstatic.com/shopping?q=tbn:ANd9GcSW_S8Mrnq0lLnXWCSPPlONkrPbkB8C3Gy9613OGD0ZaejmP5UNRf8LFnXUYJTM64BC1VYLYcYSbSSv-qVTV15RzDJZipvzsikme8oHSEtVX_ZKDiUQpnbHPQ&usqp=CAE,https://lazygardener.in/products/greenstix?variant=30920527020087¤cy=INR&utm_medium=product_sync&utm_source=google&utm_content=sag_organic&utm_campaign=sag_organic&utm_campaign=gs-2019-10-29&utm_source=google&utm_medium=smart_campaign
6,Cherry___Powdery_mildew,ROM Mildew Clean,https://encrypted-tbn0.gstatic.com/shopping?q=tbn:ANd9GcSeHlqcksdF25o8mv-fYxNOrfJkp4Ov2hgVf01w2aCed1WbyL604ubLtPAlB7rfNoHRtxbTljQvA7P3VRh8LM0XndFHWDqvC4kC4w-DLQiknnS3vRzAxTpP&usqp=CAE,https://agribegri.com/products/rom-mildew-clean-1-kg--price-of-organic-fungicide-online-.php
7,Cherry___healthy,Plantic Organic BloomDrop Liquid Plant Food ,https://encrypted-tbn3.gstatic.com/shopping?q=tbn:ANd9GcSpHb-xEa2rTSIEf5QtLMbax4zvRsTzD4kAwQ9Rcwr3AbDDQxUhmMmPJBVGLCAvczXrXAqwWKN-rReHwSR-XSGlsJRLvZOKRXHV-54uLhU_6EIuBq5BHXaAwg&usqp=CAE,https://plantic.in/products/organic-bloomdrop
8,Corn___Cercospora_leaf_spot Gray_leaf_spot,ANTRACOL FUNGICIDE,https://encrypted-tbn2.gstatic.com/shopping?q=tbn:ANd9GcTm0wIanaB9OdUkuH9IJ-bHG_qyungwi2lWnmkFmze9VFU1yeSuRO3wImAhPfEJwuBZXPSEf5QwZhieERwrlE5H7lg_8bvf&usqp=CAE,https://www.bighaat.com/products/antracol?variant=14521365063¤cy=INR&utm_medium=product_sync&utm_source=google&utm_content=sag_organic&utm_campaign=sag_organic
9,Corn___Common_rust,3 STAR M45 Mancozeb 75% WP Contact Fungicide,https://encrypted-tbn2.gstatic.com/shopping?q=tbn:ANd9GcT86avIdiTsKNdgo0Uss9r2tkn9pcx6VCGHeaubXDiR0u_fqqyXomgc1BBviREao7BM_eQiR6tbLCzUxG5VzS4du5DgwBVbtwSLuTEexpI&usqp=CAE,https://agribegri.com/products/buy-online-3-star-m45-mancozeb-75-wp.php
10,Corn___Northern_Leaf_Blight,QUIT (Carbendazim 12% + Mancozeb 63% WP) Protective And Curative Fungicide,https://encrypted-tbn0.gstatic.com/shopping?q=tbn:ANd9GcRO2FK6IsSuUuQQ0ehzVKIsEdgjCGbMq2nBmOsUp38ajgm8dPwR9MvTBL9_PFRZVRkbtiAzdwP8lwGlrR1c7axKHE6VALk6l3X4Snu9HWFCKpVCFYly65Bs&usqp=CAE,https://agribegri.com/products/buy-carbendazim-12--mancozeb-63-online--buy-fungicide-online.php
11,Corn___healthy,Biomass Lab Sampoorn Fasal Ahaar (Multipurpose Organic Fertilizer & Plant Food),https://encrypted-tbn3.gstatic.com/shopping?q=tbn:ANd9GcRC_8hhC12Kbw0e0w-afXO9kzWJHG1LchaIa66xnIpU6OmZLnY3OzCrRd2ilBS9bSjI9jQI0hJ6Z20SUk7nf7uCukqv77aTun147K5g2Ec&usqp=CAE,https://www.flipkart.com/biomass-lab-sampoorn-fasal-ahaar-multipurpose-organic-fertilizer-plant-food-1-kg-fertilizer-manure/p/itm69c56f2e19c6a?pid=SMNFM3999GGTXFJZ&lid=LSTSMNFM3999GGTXFJZPRQ8CT&marketplace=FLIPKART&cmpid=content_soil-manure_8965229628_gmc
12,Grape___Black_rot,Southern Ag Captan 50% WP Fungicide,https://images-na.ssl-images-amazon.com/images/I/51s1IbUD-qL.jpg,https://www.cart2india.com/beneficial-insects/southern-ag-captan-50-wp-fungicide-8-oz/00000000004336428163
13,Grape___Esca_(Black_Measles),ALIETTE FUNGICIDE,https://farmagritech.com/wp-content/uploads/2020/03/ALIETTE.png,https://farmagritech.com/product/aliette-fungicide/?attribute_pa_size=100gm&utm_source=Google%20Shopping&utm_campaign=Google%20shopping%20feed%201&utm_medium=cpc&utm_term=2578
14,Grape___Leaf_blight_(Isariopsis_Leaf_Spot),"Tebulur Tebuconazole 10% + Sulphur 65% WG , Advance Broad Spectrum Premix Fungicides",https://encrypted-tbn1.gstatic.com/shopping?q=tbn:ANd9GcQPzI0SnMtb60x2D1gGkRHsvD1j7NRl8Y7pjuIyuyrTxdpvUOpci7NxHWxt4Gfn3ETrCrgWKvGPH-jmbboE2vi4b4MiTq3kZKMdHFUSctUmXcH9ZRed0j4-&usqp=CAE,https://agribegri.com/products/buy-tebuconazole-10--sulphur-65-wg-online--online-agro-store.php
15,Grape___healthy,Sansar Green Grapes Fertilizer Fertilizer,https://rukminim1.flixcart.com/image/416/416/k51cpe80/soil-manure/4/m/h/400-grapes-fertilizer-sansar-green-original-imafntdujntbdner.jpeg?q=70,"https://www.flipkart.com/sansar-green-grapes-fertilizer/p/itm90f06136b50c7?pid=SMNFNT8F7FCQJ4MH&lid=LSTSMNFNT8F7FCQJ4MHMXEELG&marketplace=FLIPKART&cmpid=content_soil-manure_730597647_g_8965229628_gmc_pla&tgi=sem,1,G,11214002,g,search,,476044024748,,,,c,,,,,,,&ef_id=Cj0KCQjwsLWDBhCmARIsAPSL3_0d3lBg14nXBbhJeTP7z5mqzpyHXmv4c7cL9mW4MqCBlnskpoMB8C0aArWREALw_wcB:G:s&s_kwcid=AL!739!3!476044024748!!!g!293946777986!&gclsrc=aw.ds"
16,Orange___Haunglongbing_(Citrus_greening),Green Dews CITRUS PLANT FOOD Fertilizer ,https://rukminim1.flixcart.com/image/416/416/ju79hu80/soil-manure/x/m/b/400-citrus-plant-food-green-dews-original-imaffbxhn3rz8k5p.jpeg?q=70,https://www.flipkart.com/green-dews-citrus-plant-food-fertilizer/p/itmffde2heg7hkq2?pid=SMNFFBY9Z8DVTXMB&lid=LSTSMNFFBY9Z8DVTXMBEL4PDT&marketplace=FLIPKART&cmpid=content_soil-manure_8965229628_gmc
17,Peach___Bacterial_spot,SCORE FUNGICIDE,https://encrypted-tbn1.gstatic.com/shopping?q=tbn:ANd9GcQ5shxq773t5Lmux-hhShKezjR64Af41W6NdhsDMXI-dNSAVvfY45rb5iHxMaqZXBdtFnfuiIcN8PdQ06YcYZi3gq6Uow-j&usqp=CAE,https://www.bighaat.com/products/score-fungicide?variant=27949138149399¤cy=INR&utm_medium=product_sync&utm_source=google&utm_content=sag_organic&utm_campaign=sag_organic
18,Peach___healthy,Jeevamrut (Plant Growth Tonic),https://cdn.shopify.com/s/files/1/0047/9730/0847/products/nurserylive-fertilizer-jeevamrut-plant-growth-tonic-500-ml-for-garden_jpg_600x600.jpg?v=1607402323,https://nurserylive.com/products/jeevamrut-plant-growth-tonic-250-ml-for-garden?variant=34163328811148
19,"Pepper,_bell___Bacterial_spot",Systemic Fungicide (Domark) Tetraconazole 3.8% w/w (4% w/v) EW,https://encrypted-tbn0.gstatic.com/shopping?q=tbn:ANd9GcQNEP3gEC77FdOUBy_xUgIbq7UU_N2TX1zRwCFvtl02Kz5-a6X2ZhXPAhf9y0kLieGR2VTVarUnZP_JMs0kFtEw-LqJwVSMHsjGP4Bz9scPPIB6NCLtcD7JNA&usqp=CAE,https://agribegri.com/products/buy-systemic-fungicide-online--tetraconazole-38--domark-.php
20,"Pepper,_bell___healthy",Casa De Amor Organic Potash Fertilizer,https://cdn.shopify.com/s/files/1/1489/8850/products/Organic_Potash-1_869x869.jpg?v=1583399466,https://www.casagardenshop.com/products/organic-potash-fertilizer-for-gardening-improves-size-of-flowers-fruits-and-vegetables-by-casa-de-amor-1-kg-1?variant=40073291088¤cy=INR&utm_medium=product_sync&utm_source=google&utm_content=sag_organic&utm_campaign=sag_organic&utm_campaign=gs-2020-02-08&utm_source=google&utm_medium=smart_campaign
21,Potato___Early_blight,Parin Herbal Fungicides (With Turmeric Extract),https://encrypted-tbn3.gstatic.com/shopping?q=tbn:ANd9GcQzAaBb9Tc2B0iXiYc08qD2WM4vjAz4TZHI6qwj-D7nck2bbtYQUnnODSqPSK_Vz5NR1Am8aRbc2Rd0anzqgVKWq-0OlZ6wkjE-3x0jXihQ9F0kO8nJu7FT&usqp=CAE,https://agribegri.com/products/buy-herbal-fungicide-online-india--buy-pesticides-online.php
22,Potato___Late_blight,Syngenta Ridomil gold Fungicide ,https://krushikendra.com/image/cache/catalog/syngenta/RIDOMIL-GOLD-800x800.jpg,https://krushikendra.com/Buy-Syngenta-Ridomil-gold-Fungicide-250%20gram
23,Potato___healthy,Saosis Fertilizer for potato Fertilizer,https://rukminim1.flixcart.com/image/416/416/kfvfwy80/soil-manure/6/p/g/30-fertilizer-for-potato-saosis-original-imafw8b3sgcyrhh4.jpeg?q=70,"https://www.flipkart.com/saosis-fertilizer-potato/p/itmc40dfbfcd49f7?pid=SMNFW8B3DTY2V6PG&lid=LSTSMNFW8B3DTY2V6PGHC2BXS&marketplace=FLIPKART&cmpid=content_soil-manure_730597647_g_8965229628_gmc_pla&tgi=sem,1,G,11214002,g,search,,476044024748,,,,c,,,,,,,&ef_id=Cj0KCQjwsLWDBhCmARIsAPSL3_3TcmjyWFqJEZtCD0SQiDb9UFyESkiYtgU35W5Qs_KnTCkDS_Px2Y4aArmBEALw_wcB:G:s&s_kwcid=AL!739!3!476044024748!!!g!293946777986!&gclsrc=aw.ds"
24,Raspberry___healthy,"Karen's Naturals, Organic Just Raspberries",https://s3.images-iherb.com/jte/jte29001/v/6.jpg,https://in.iherb.com/pr/Karen-s-Naturals-Organic-Just-Raspberries-1-5-oz-42-g/37730?gclsrc=ds
25,Soybean___healthy,Max Crop Liquid Fertilizer,https://encrypted-tbn0.gstatic.com/shopping?q=tbn:ANd9GcRyFZFHGj1Wi0fabSOYVadCnsg8UdvhpKOHI6gxmItDLmz7RdC67HFFNyU7PYyD6SnlgXOs31yW_8-YWJKOeal7K4UQ3lAIxef-4x350ac&usqp=CAE,https://agribegri.com/products/max-crop-1-litre.php
26,Squash___Powdery_mildew,No powdery mildew 1 quart,https://cdn.shopify.com/s/files/1/1667/9587/products/415B_2BfINScL.jpg?v=1536320654,https://kiron.co.in/products/B0068WMLE2
27,Strawberry___Leaf_scorch,Greatindos Premium Quality All in 1 Organic Fungicide,https://encrypted-tbn3.gstatic.com/shopping?q=tbn:ANd9GcSV3dLQAuhGWWsZSX3Ray15J_uSeFgSo7oLE0G2BxPFSwVNnOUY7VsBbLzDbw_mzUw3ZFLaF4kPWPyzatefP2bnSZwEbwrYnGGYgEl8rS6XWmwRnloOWnwy&usqp=CAE,https://agribegri.com/products/buy-organic-fungicide-online--organic-fungicide-with-best-rate-.php
28,Strawberry___healthy,SWISS GREEN ORGANIC PLANT GROWTH PROMOTER STRAWBERRY Fertilizer,https://rukminim1.flixcart.com/image/416/416/k2urhjk0/soil-manure/q/y/d/500-organic-plant-growth-promoter-strawberry-swiss-green-original-imafm3vx8mzyhxzg.jpeg?q=70,https://www.flipkart.com/swiss-green-organic-plant-growth-promoter-strawberry-fertilizer-manure/p/itmcaf7955b802fa?pid=SMNFM3TT2RNZEQYD&lid=LSTSMNFM3TT2RNZEQYDIGMSRD&marketplace=FLIPKART&cmpid=content_soil-manure_8965229628_gmc
29,Tomato___Bacterial_spot,CUREAL Best Fungicide & Bactericide,https://encrypted-tbn1.gstatic.com/shopping?q=tbn:ANd9GcRKHQh4EwbE0ksZ_RTOhsGtvTO68zllR9djrYvUrZ-DO6FYo2kYpmyFL8UgaK6aiHJuUWbkax_uhcxMpGfwSHa2CKWqaIZnFp1vIRbGkrZhtGv-Zq-72y61&usqp=CAE,https://agribegri.com/products/cureal---best-fungicide--bactericide-zinc-based-250-ml.php
30,Tomato___Early_blight,NATIVO FUNGICIDE,https://farmagritech.com/wp-content/uploads/2019/11/F-Nativo-3.jpg,https://farmagritech.com/product/nativo-fungicide/?attribute_pa_size=50gm&utm_source=Google%20Shopping&utm_campaign=Google%20shopping%20feed%201&utm_medium=cpc&utm_term=1326
31,Tomato___Late_blight,ACROBAT FUNGICIDE,https://encrypted-tbn3.gstatic.com/shopping?q=tbn:ANd9GcRpQmIM9QZkFI43PPlHVFaSlGdrdMP8LFHXAo9b_OGOQCi3R6G-SsqnCXFR4CU9bVAcyuBGTrQRAkRrU9fm-1TGeXg9PrsB&usqp=CAE,https://www.bighaat.com/products/acrobat-fungicide?variant=31177935519767¤cy=INR&utm_medium=product_sync&utm_source=google&utm_content=sag_organic&utm_campaign=sag_organic
32,Tomato___Leaf_Mold,Virus Special (Set of Immuno 1 ltr + Enviro 1 ltr),https://encrypted-tbn1.gstatic.com/shopping?q=tbn:ANd9GcQfgH6lswqhV2hUhqZwEfgQBU1eUP1GCvETxg_a3JFOERS2tc80k8gNMbHM_XxReblck1T7tR95X8Qojdj1k0yAyvhmCZHvkFWaT_L-a8ofElEXerVJqvsF&usqp=CAE,https://agribegri.com/products/virus-special-enviroimmuno-1-litre.php
33,Tomato___Septoria_leaf_spot,Roko Fungicide,https://farmagritech.com/wp-content/uploads/2020/05/roko-insecticide.jpg,https://farmagritech.com/product/roko-fungicide/?attribute_pa_size=500gm&utm_source=Google%20Shopping&utm_campaign=Google%20shopping%20feed%201&utm_medium=cpc&utm_term=3239
34,Tomato___Spider_mites Two-spotted_spider_mite,OMITE INSECTICIDE,https://encrypted-tbn1.gstatic.com/shopping?q=tbn:ANd9GcQxe-M4vyRx94TlpTOw6tlzvagjvaTRCWRLoKd58JML7T3rSV8GJK67YjxIiR-PHL02DL2CHsHPLzExBf6uq7BqxcLPxgmh9w&usqp=CAE,https://www.bighaat.com/products/omite-insecticide?variant=31276117196823¤cy=INR&utm_medium=product_sync&utm_source=google&utm_content=sag_organic&utm_campaign=sag_organic
35,Tomato___Target_Spot,Propi Propineb 70% WP Fungicide for Plants Diesese Control Pesticide,https://rukminim1.flixcart.com/image/416/416/k3xcdjk0/soil-manure/y/f/j/100-propineb-70-wp-fungicide-for-plants-diesese-control-propi-original-imafmxg3jghhdyt6.jpeg?q=70,"https://www.flipkart.com/propi-propineb-70-wp-fungicide-plants-diesese-control-pesticide/p/itm9db96656402f8?pid=SMNFMX8FJJHZAYFJ&lid=LSTSMNFMX8FJJHZAYFJDGFGXW&marketplace=FLIPKART&cmpid=content_soil-manure_730597647_g_8965229628_gmc_pla&tgi=sem,1,G,11214002,g,search,,476044024748,,,,c,,,,,,,&ef_id=Cj0KCQjwsLWDBhCmARIsAPSL3_2bIC4skU03mHTgG2GvlhsFQstQaLrFyAaL10NTTCDsuI9BoffpPFUaAjn1EALw_wcB:G:s&s_kwcid=AL!739!3!476044024748!!!g!293946777986!&gclsrc=aw.ds"
36,Tomato___Tomato_Yellow_Leaf_Curl_Virus,Syngenta Amistor Top Fungicide,https://krushikendra.com/image/cache/catalog/Sygenta/syngenta-amistar-top-fungicides-500x500-800x800.jpg,https://krushikendra.com/Buy-Syngenta-Amistor-Top-Fungicide-100-ml-Online
37,Tomato___Tomato_mosaic_virus,V Bind Viral Disease Special,https://encrypted-tbn1.gstatic.com/shopping?q=tbn:ANd9GcRmHRAqOUGXt76NPfOMXrUVRvDt8gRYd3-HTexGYI0d4PNmDuLXbfTchIRipVD-hx1wob7hHyVTbmyS85fTcADpBUMezetO&usqp=CAE,https://agribegri.com/products/viricide-online-.php
38,Tomato___healthy,"Tomato Fertilizer Organic, for Home, Balcony, Terrace & Outdoor Gardening",https://cdn.shopify.com/s/files/1/1489/8850/products/Tomato_feretilizer-new_869x868.jpg?v=1582699319,https://www.casagardenshop.com/products/tomato-fertilizer-for-home-terrace-outdoor-gardening?variant=32106353131619¤cy=INR&utm_medium=product_sync&utm_source=google&utm_content=sag_organic&utm_campaign=sag_organic&utm_campaign=gs-2020-02-08&utm_source=google&utm_medium=smart_campaign
================================================
FILE: Flask Deployed App/templates/base.html
================================================
<!doctype html>
<html lang="en">
<head>
<!-- Required meta tags -->
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- Bootstrap CSS -->
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.0-beta3/dist/css/bootstrap.min.css" rel="stylesheet"
integrity="sha384-eOJMYsd53ii+scO/bJGFsiCZc+5NDVN2yr8+0RDqr0Ql0h+rP48ckxlpbzKgwra6" crossorigin="anonymous">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/ionicons/2.0.1/css/ionicons.min.css">
<link rel = "stylesheet" href = "https://cdnjs.cloudflare.com/ajax/libs/bttn.css/0.2.4/bttn.css">
<title> {% block pagetitle %}
{% endblock pagetitle %}</title>
<style>
.bg {
background-image: url("images/background.jpeg");
height: 100%;
/* Center and scale the image nicely */
background-position: center;
background-repeat: no-repeat;
background-size: cover;
}
.file-upload input[type='file'] {
display: none;
}
body {
background-color: #4ECC5A;
/* background: -webkit-linear-gradient(to right, #66a776, #043610);
background: linear-gradient(to right, #5d9c6a, #059b0d); */
height: 100vh;
}
.rounded-lg {
border-radius: 1rem;
}
.custom-file-label.rounded-pill {
border-radius: 50rem;
}
.custom-file-label.rounded-pill::after {
border-radius: 0 50rem 50rem 0;
}
label {
background-color: rgb(2, 46, 15);
color: white;
padding: 0.5rem;
font-family: sans-serif;
border-radius: 0.3rem;
cursor: pointer;
margin-top: 1rem;
}
#file-chosen {
margin-left: 0.3rem;
font-family: sans-serif;
}
.footer-basic {
padding: 40px 0;
background-color: #042908;
color: #f1f3f5;
}
.footer-basic ul {
padding: 0;
list-style: none;
text-align: center;
font-size: 18px;
line-height: 1.6;
margin-bottom: 0;
}
.footer-basic li {
padding: 0 10px;
}
.footer-basic ul a {
color: inherit;
text-decoration: none;
opacity: 0.8;
}
.footer-basic ul a:hover {
opacity: 1;
}
.footer-basic .social {
text-align: center;
padding-bottom: 25px;
}
.footer-basic .social>a {
font-size: 24px;
width: 40px;
height: 40px;
line-height: 40px;
display: inline-block;
text-align: center;
border-radius: 50%;
border: 1px solid #ccc;
margin: 0 8px;
color: inherit;
opacity: 0.75;
}
.footer-basic .social>a:hover {
opacity: 0.9;
}
.footer-basic .copyright {
margin-top: 15px;
text-align: center;
font-size: 13px;
color: #aaa;
margin-bottom: 0;
}
</style>
</head>
<body>
<nav class="navbar navbar-expand-lg navbar-dark " style="background-color:#05380b;">
<!-- <a class="navbar-brand" href="#">Navbar</a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarNavDropdown" aria-controls="navbarNavDropdown" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button> -->
<div class="collapse navbar-collapse" id="navbarNavDropdown">
<ul class="navbar-nav">
<li class="navbar-brand active">
<a class="nav-link" href="/" style="color: white;">Home</a>
</li>
<li class="navbar-brand active">
<a class="nav-link" href="/index" style="color: white;">AI Engine</a>
</li>
<li class="navbar-brand">
<a class="nav-link" href="/market" style="color: white;">Supplements</a>
</li>
<li class="navbar-brand">
<a class="nav-link" href="/contact" style="color: white;">Contact-Us</a>
</li>
</ul>
</div>
</nav>
{% block body %}
{% endblock body %}
<div class="footer-basic">
<footer>
<center>
<div style="padding: 5;">
<a target="_blank" href='mailto:krsikx@gmail.com'><img src="https://image.flaticon.com/icons/png/512/281/281769.png" height="40" width="40"></a> 
<a target="_blank" href="https://www.instagram.com/krsikx_india/"><img src="https://image.flaticon.com/icons/png/512/174/174855.png" height="40" width="40"></a> 
<a target="_blank"href="https://www.linkedin.com/company/krsikx-india-llp/"><img src="https://image.flaticon.com/icons/png/512/174/174857.png" height="40" width="40"></a> 
</div>
</center>
<br>
<ul class="list-inline">
<li class="list-inline-item"><a href="/">Home</a></li>
<li class="list-inline-item"><a target="_blank" href="https://www.krsikx.com/">Services</a></li>
<li class="list-inline-item"><a target="_blank" href="https://www.krsikx.com/copy-of-solutions">About</a></li>
<li class="list-inline-item laptop"><a href="/index">AI Engine</a></li>
</ul>
<p class="copyright">Created by Manthan Bhikadiya & Krishna Baldaniya</p>
</footer>
</div>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.1.3/js/bootstrap.bundle.min.js"></script>
</body>
<!-- <script>
if (window.matchMedia("(max-width: 767px)").matches)
{
// The viewport is less than 768 pixels wide
document.write("This is a mobile device.");
window.location.replace('/mobile-device');
} else {
// The viewport is at least 768 pixels wide
document.write("This is a tablet or desktop.");
}
</script> -->
<!-- <script>
if(screen.width <= 700){
document.location = 'manthan2.html';
}
</script> -->
</html>
================================================
FILE: Flask Deployed App/templates/contact-us.html
================================================
{% extends 'base.html' %}
{% block pagetitle %}
Contact Us
{% endblock pagetitle %}
{% block body %}
<div class="row mb-5 text-center text-white laptop">
<div class="col-lg-10 mx-auto">
<h1 class="display-4" style="padding-top: 2%;font-weight: 400;color: rgb(4, 54, 4);"><b>📞Contact-Us📞</b></h1>
<p class="lead" style="font-weight: 500;color: black;">For Any Queries & Suggestions Contact Us. We Are Happy To
Help.</p>
</div>
</div>
<div class="row p-3">
<div class="col">
<div class=" p-5 bg-white shadow rounded-lg" style="height: 95%;">
<center>
<h3>Manthan Bhikadiya</h3>
<p class="lead" style="font-weight: 350;">Hi, I am Manthan Bhikadiya. Currently Pursuing Bachelors in
Information
Technology.My Main Focus is on Machine Learning, Deep Learning and Artificial Intelligence.I am Also
Interested in Blockchain and Flutter App Development.</p>
</center>
<div>
<h5>Social Media Handles :</h5><br>
<a target="_blank" href='mailto:bhikadiyamanthan@gmail.com'><img
src="https://image.flaticon.com/icons/png/512/281/281769.png" height="40" width="40"></a> :
bhikadiyamanthan@gmail.com<br><br>
<a target="_blank" href='manthan-bhikadiya.medium.com'><img
src="https://cdn4.iconfinder.com/data/icons/social-media-2210/24/Medium-512.png" height="44"
width="44"></a> : manthan-bhikadiya<br><br>
<a target="_blank" href='https://github.com/manthan89-py'><img
src="https://image.flaticon.com/icons/png/512/25/25231.png" height="40" width="40"></a> :
manthan89-py<br><br>
<a target="_blank" href='https://www.linkedin.com/in/manthanbhikadiya'><img
src="https://image.flaticon.com/icons/png/512/174/174857.png" height="40" width="40"></a> :
manthanbhikadiya<br>
</div>
</div>
</div>
<div class="col">
<div class=" p-5 bg-white shadow rounded-lg" style="height: 95%;">
<center>
<h3>Krishna Baldaniya</h3>
<p class="lead" style="font-weight: 350;">Hi, I am Krishna Baldaniya. I am an entrepreneur, currently
co-founder at KrsikX India LLP which is an Agri-Tech Startup. Pursuing bachelors in Information
Technology. My main focuses on the technical side are Cloud computing and mobile App development.
</p>
</center>
<div>
<h5>Social Media Handles :</h5><br>
<a target="_blank" href='mailto:krishna.baldaniya93@gmail.com'><img
src="https://image.flaticon.com/icons/png/512/281/281769.png" height="40" width="40"></a> :
krishna.baldaniya93@gmail.com<br><br>
<a target="_blank" href='https://www.instagram.com/krishna.baldaniya/'><img
src="https://image.flaticon.com/icons/png/512/174/174855.png" height="44" width="44"></a> :
krishna.baldaniya<br><br>
<a target="_blank" href='https://www.linkedin.com/in/krishna-baldaniya-5547381a1/'><img
src="https://image.flaticon.com/icons/png/512/174/174857.png" height="40" width="40"></a> :
krishna-baldaniya<br>
</div>
</div>
</div>
</div>
{% endblock body %}
================================================
FILE: Flask Deployed App/templates/home.html
================================================
{% extends 'base.html' %}
{% block pagetitle %}
Plant Disease Detection
{% endblock pagetitle %}
{% block body %}
<style>
body{
overflow-x: hidden;
}
@media only screen and (max-width: 830px) {
.laptop{
display: none;
}
}
@media (min-width:830px) and (max-width: 1536px){
.mobile{
display: none;
}
}
</style>
<div class='mobile p-5'>
<div class="row mb-5 text-center text-white">
<div class="col-lg-10 mx-auto">
<h1 class="display-4" style="padding-top: 2%;font-weight: 400;color:red;"><b>Note✍🏻</b></h1>
<p class="lead" style="font-weight: 500;color: black;">Please🙏 Open This Site On Laptop/PC 💻 Screen Only</p>
<p class="lead" style="font-weight: 500;color: black;">Thank You 🤝</p>
</div>
</div>
</div>
<div class="row mb-5 text-center text-white laptop">
<div class="col-lg-10 mx-auto">
<h1 class="display-4" style="padding-top: 2%;font-weight: 400;color: rgb(4, 54, 4);"><b>🍁Plant Disease
Detection🍁 </b></h1>
<p class="lead" style="font-weight: 500;color: black;">This AI Engine Will Help To Detect Disease From Following Fruites And Veggies</p>
</div>
</div>
<center class="laptop">
<a href="/index">
<button class = "bttn-pill bttn-lg btn-success"><b style="color: black;">AI Engine</b></button>
</a>
</center>
<div class="row p-5 laptop">
<div class=" col">
<div class="p-3 bg-white shadow rounded-lg" style="width: 90%;height: 92%;">
<img src="https://post.healthline.com/wp-content/uploads/2020/09/Do_Apples_Affect_Diabetes_and_Blood_Sugar_Levels-732x549-thumbnail-1-732x549.jpg" width="250" height="250">
<center><p class="lead" style="font-weight: 500;color: black;">Apple</p></center>
</div>
</div>
<div class="col">
<div class="p-3 bg-white shadow rounded-lg" style="width: 90%;height: 92%;">
<img src="https://www.supermarketperimeter.com/ext/resources/0430-blueberries.png?t=1588260305&width=1080" width="250" height="250">
<center><p class="lead" style="font-weight: 500;color: black;">Blueberry</p></center>
</div>
</div>
<div class=" col">
<div class="p-3 bg-white shadow rounded-lg" style="width: 90%;height: 92%;">
<img src="https://img.webmd.com/dtmcms/live/webmd/consumer_assets/site_images/article_thumbnails/slideshows/health_benefits_of_cherries_slideshow/1800x1200_health_benefits_of_cherries_slideshow.jpg" width="250" height="250">
<center><p class="lead" style="font-weight: 500;color: black;">Cherry</p></center>
</div>
</div>
<div class=" col">
<div class="p-3 bg-white shadow rounded-lg" style="width: 90%;height: 92%;">
<img src="https://www.mayoclinichealthsystem.org/-/media/national-files/images/hometown-health/2018/corn.jpg" width="250" height="250">
<center><p class="lead" style="font-weight: 500;color: black;">Corn</p></center>
</div>
</div>
</div>
<div class="row p-5 laptop">
<div class=" col">
<div class="p-3 bg-white shadow rounded-lg" style="width: 90%;height: 92%;">
<img src="https://i.ndtvimg.com/i/2015-09/grapes_625x350_61443376353.jpg" width="250" height="250">
<center><p class="lead" style="font-weight: 500;color: black;">Grape</p></center>
</div>
</div>
<div class="col">
<div class="p-3 bg-white shadow rounded-lg" style="width: 90%;height: 92%;">
<img src="https://www.irishtimes.com/polopoly_fs/1.3923226.1560339148!/image/image.jpg_gen/derivatives/ratio_1x1_w1200/image.jpg" width="250" height="250">
<center><p class="lead" style="font-weight: 500;color: black;">Orange</p></center>
</div>
</div>
<div class=" col">
<div class="p-3 bg-white shadow rounded-lg" style="width: 90%;height: 92%;">
<img src="https://img.webmd.com/dtmcms/live/webmd/consumer_assets/site_images/articles/health_tools/the_health_benefits_of_peaches_slideshow/thinkstock_rf_peaches.jpg?resize=650px:*" width="250" height="250">
<center><p class="lead" style="font-weight: 500;color: black;">Peach</p></center>
</div>
</div>
<div class=" col">
<div class="p-3 bg-white shadow rounded-lg" style="width: 90%;height: 92%;">
<img src="https://snaped.fns.usda.gov/sites/default/files/styles/crop_ratio_7_5/public/seasonal-produce/2018-05/bell%20peppers.jpg?h=9f30bee3&itok=PKmzyeNv" width="250" height="250">
<center><p class="lead" style="font-weight: 500;color: black;">Pepper Bell</p></center>
</div>
</div>
</div>
<div class="row p-5 laptop">
<div class=" col">
<div class="p-3 bg-white shadow rounded-lg" style="width: 90%;height: 92%;">
<img src="https://m.economictimes.com/thumb/height-450,width-600,imgsize-111140,msid-72862126/potato-getty.jpg" width="250" height="250">
<center><p class="lead" style="font-weight: 500;color: black;">Potato</p></center>
</div>
</div>
<div class="col">
<div class="p-3 bg-white shadow rounded-lg" style="width: 90%;height: 92%;">
<img src="https://i0.wp.com/cdn-prod.medicalnewstoday.com/content/images/articles/326/326272/raspberries-with-ketones-in-a-bowl.jpg?w=1155&h=1541" width="250" height="250">
<center><p class="lead" style="font-weight: 500;color: black;">Raspberry</p></center>
</div>
</div>
<div class=" col">
<div class="p-3 bg-white shadow rounded-lg" style="width: 90%;height: 92%;">
<img src="https://m.economictimes.com/thumb/msid-66988154,width-1200,height-900,resizemode-4,imgsize-211276/soyabean-agencies.jpg" width="250" height="250">
<center><p class="lead" style="font-weight: 500;color: black;">Soybean</p></center>
</div>
</div>
<div class=" col">
<div class="p-3 bg-white shadow rounded-lg" style="width: 90%;height: 92%;">
<img src="https://post.healthline.com/wp-content/uploads/2020/08/squash-fruit-or-vegetable-732x549-thumbnail-732x549.jpg" width="250" height="250">
<center><p class="lead" style="font-weight: 500;color: black;">Squash</p></center>
</div>
</div>
</div>
<center class="laptop">
<div class="row p-5">
<div class=" col">
<div class="p-3 bg-white shadow rounded-lg" style="width: 45%;height: 92%;">
<img src="https://images.indianexpress.com/2020/02/strawberry-1200.jpg" width="250" height="250">
<center><p class="lead" style="font-weight: 500;color: black;">Strawberry</p></center>
</div>
</div>
<div class="col">
<div class="p-3 bg-white shadow rounded-lg" style="width: 45%;height: 92%;">
<img src="https://images-prod.healthline.com/hlcmsresource/images/AN_images/tomatoes-1296x728-feature.jpg" width="250" height="250">
<center><p class="lead" style="font-weight: 500;color: black;">Tomato</p></center>
</div>
</div>
</div>
</center>
{% endblock body %}
================================================
FILE: Flask Deployed App/templates/index.html
================================================
<html>
{% extends 'base.html' %}
{% block pagetitle %}
AI Engine
{% endblock pagetitle %}
{% block body %}
<div>
<div class="container">
<!-- For demo purpose -->
<div class="row mb-5 text-center text-white">
<div class="col-lg-10 mx-auto">
<h1 class="display-4" style="padding-top: 2%;font-weight: 400;color: rgb(4, 54, 4);"><b>🍀AI
Engine🍀</b></h1>
<p class="lead" style="font-weight: 500;color: black;">Let AI Engine Will Help You To Detect Disease</p>
</div>
</div>
<!-- End -->
<div class="row ">
<div class="col mx-auto">
<div class="p-5 bg-white shadow rounded-lg" style="height: 95%;">
<h5><b>Why is it necessary to detect disease in plant ?</b></h5>
<p>Plant diseases affect the growth of their respective species. In addition, some research gaps are
identified from which to obtain greater transparency for detecting diseases in plants, even
before their symptoms appear clearly.
diagnosis is one of the most important aspects of a plant pathologist's training. Without proper
identification of the disease and the disease-causing agent, disease control measures can be a
waste of time and money and can lead to further plant losses. Proper disease diagnosis is
necessary.
</p>
</div>
</div>
<div class="col mx-auto">
<div class="p-5 bg-white shadow rounded-lg" style="height: 95%;"><img
src="https://www.pngjoy.com/pngl/250/4840262_plants-png-indoors-tropical-plant-png-hd-png.png "
height="300" alt="" width="200" class="d-block mx-auto mb-4 rounded-pill">
<!-- Default bootstrap file upload-->
<form action="/submit" method="POST" enctype="multipart/form-data">
<div class="custom-file overflow-hidden mb-4">
<input type="file" id="actual-btn" hidden name="image" />
<label for="actual-btn">Choose File</label>
<label id="camera-btn">Open Camera</label>
</br>
<span id="file-chosen">No file chosen</span>
</div>
<!-- Camera feed container (hidden initially) -->
<div id="camera-container" style="display: none;">
<video id="camera-feed" width="320" height="240" autoplay></video>
<button type="button" id="capture-btn">Capture Photo</button>
</div>
<!-- Preview Image (will show the captured photo) -->
<img id="preview" src="#" alt="Camera Photo Preview" style="display: none; max-width: 100%;" />
<!-- End -->
<h6 class="text-center mb-4 text-muted">
Simply upload your plant's leaf image and then see the magic of AI.
</h6>
<!-- Custom bootstrap upload file-->
<center>
<a class="mx-2"><button type="submit" class="btn btn-outline-success">Submit</button></a>
</center>
</form>
<!-- End -->
</div>
</div>
<div class="col mx-auto">
<div class="p-5 bg-white shadow rounded-lg" style="height: 95%;">
<h5><b>Prevent Plant Disease follow below steps:</b></h5>
<ol>
<li>Follow Good Sanitation Practices.</li>
<li>Fertilize to Keep Your Plants Healthy.</li>
<li>Inspect Plants for Diseases Before You Bring Them Home.</li>
<li>Allow the Soil to Warm Before Planting.</li>
<li>Ensure a Healthy Vegetable Garden By Rotating Crops.</li>
<li>Provide Good Air Circulation</li>
<li>Remove Diseased Stems and Foliage</li>
</ol>
<a target="_blank" href="https://www.thespruce.com/prevent-plant-diseases-in-your-garden-2539511"
class="mx-2"><button type="button" class="btn btn-outline-success">More info</button></a>
</div>
</div>
</div>
</div>
</div>
<script>
const actualBtn = document.getElementById('actual-btn');
const captureBtn = document.getElementById('capture-btn');
const fileChosen = document.getElementById('file-chosen');
actualBtn.addEventListener('change', function () {
fileChosen.textContent = this.files[0].name
})
let capturedFile = null; // Variable to hold the captured file
document.getElementById('camera-btn').addEventListener('click', function () {
// Show the camera container
document.getElementById('camera-container').style.display = 'block';
// Start the camera feed
startCamera();
});
// Start the camera feed using the getUserMedia API
function startCamera() {
const cameraFeed = document.getElementById('camera-feed');
// Request access to the user's camera
navigator.mediaDevices.getUserMedia({ video: true })
.then(function (stream) {
// Set the camera feed source to the stream
cameraFeed.srcObject = stream;
})
.catch(function (error) {
console.log('Error accessing the camera: ', error);
});
}
// Capture photo from the camera feed
document.getElementById('capture-btn').addEventListener('click', function () {
const cameraFeed = document.getElementById('camera-feed');
const canvas = document.createElement('canvas');
const ctx = canvas.getContext('2d');
// Set canvas dimensions to match the video feed dimensions
canvas.width = cameraFeed.videoWidth;
canvas.height = cameraFeed.videoHeight;
// Draw the current frame from the video feed onto the canvas
ctx.drawImage(cameraFeed, 0, 0, canvas.width, canvas.height);
// Convert the canvas image to a data URL
const dataUrl = canvas.toDataURL('image/jpeg');
// Create a new file from the data URL
const imageBlob = dataURItoBlob(dataUrl);
capturedFile = new File([imageBlob], "camera_image.jpg", { type: 'image/jpeg' });
// Now you have a file object that you can use locally
document.getElementById('file-chosen').textContent = capturedFile.name;
// Show the captured image preview
const preview = document.getElementById('preview');
preview.src = dataUrl;
preview.style.display = 'block'; // Show the preview
});
// Helper function to convert data URL to Blob
function dataURItoBlob(dataURI) {
const byteString = atob(dataURI.split(',')[1]);
const arrayBuffer = new ArrayBuffer(byteString.length);
const uintArray = new Uint8Array(arrayBuffer);
for (let i = 0; i < byteString.length; i++) {
uintArray[i] = byteString.charCodeAt(i);
}
return new Blob([uintArray], { type: 'image/jpeg' });
}
// Set up the "Choose File" input to trigger when the image is captured
document.getElementById('actual-btn').addEventListener('click', function () {
// Use the captured image file as the input file for form submission
if (capturedFile) {
const dataTransfer = new DataTransfer(); // Create a DataTransfer object
dataTransfer.items.add(capturedFile); // Add the captured file to the DataTransfer object
document.getElementById('actual-btn').files = dataTransfer.files; // Assign the file to the input
}
});
// Start the camera feed
async function startCamera() {
const videoElement = document.getElementById('camera-feed');
try {
const stream = await navigator.mediaDevices.getUserMedia({ video: true });
videoElement.srcObject = stream;
} catch (err) {
console.error('Error accessing the camera: ', err);
}
}
// Capture the image from the video feed
document.getElementById('capture-btn').addEventListener('click', function () {
const video = document.getElementById('camera-feed');
const canvas = document.getElementById('canvas');
const context = canvas.getContext('2d');
// Set canvas size equal to video size
canvas.width = video.videoWidth;
canvas.height = video.videoHeight;
// Draw the video frame onto the canvas
context.drawImage(video, 0, 0, canvas.width, canvas.height);
// Convert the image to a data URL and create a file input
const dataUrl = canvas.toDataURL('image/png');
const fileInput = document.getElementById('captured-image');
const file = dataUrlToFile(dataUrl, 'captured-image.png');
// Create a File object from the base64 image data
const dataTransfer = new DataTransfer();
dataTransfer.items.add(file);
fileInput.files = dataTransfer.files;
// Hide the camera feed and display the chosen file text
document.getElementById('camera-container').style.display = 'none';
document.getElementById('file-chosen').innerText = 'Image Captured';
});
// Convert base64 image data to a file object
function dataUrlToFile(dataUrl, filename) {
const arr = dataUrl.split(',');
const mime = arr[0].match(/:(.*?);/)[1];
const bstr = atob(arr[1]);
const n = bstr.length;
const u8arr = new Uint8Array(n);
while (n--) {
u8arr[n] = bstr.charCodeAt(n);
}
return new File([u8arr], filename, { type: mime });
}
</script>
{% endblock body %}
================================================
FILE: Flask Deployed App/templates/market.html
================================================
{% extends 'base.html' %}
{% block pagetitle %}
Supplement Market
{% endblock pagetitle %}
{% block body %}
<br>
<div class="row mb-5 text-center text-white">
<div class="col-lg-10 mx-auto">
<h1 class="display-4" style="padding-top: 2%;font-weight: 400;color: rgb(4, 54, 4);"><b>🛒Supplements🛒</b></h1>
<p class="lead" style="font-weight: 500;color: black;">Buy Supplements & Fertilizer at one place</p>
</div>
</div>
<div class="row p-3">
{% for index in range(0,supplement_name | length) %}
{% if index != 4 %}
<div class="col">
<div class=" p-5 bg-white shadow rounded-lg" style="height: 95%;">
<center>
{% if index==3 or index==5 or index==7 or index==11 or index==15 or index==18 or index==20 or
index==23 or
index==24 or index==25 or index==28 or index==38 %}
<h5>Fertilizer<b style="color: green;"> (Healthy):</b></h5>
{% else %}
<h5>Supplements<b style="color: red;"> (Diseased):</b></h5>
{% endif %}
<br>
<img src={{supplement_image[index]}} width="200" height="250">
<br>
<br>
<h6>For {{disease[index]}}</h6>
<p>{{supplement_name[index]}}</p>
<a target="_blank" href={{buy[index]}}><button type="button" class="btn btn-success"
style="background-color: #05380b;">Buy Product</button></a>
</center>
</div>
</div>
{% endif %}
{% endfor %}
</div>
{% endblock body %}
================================================
FILE: Flask Deployed App/templates/submit.html
================================================
{% extends 'base.html' %}
{% block pagetitle %}
{{title}}
{% endblock pagetitle %}
{% block body %}
<div>
<div class="container">
<!-- For demo purpose -->
<div class="row mb-5 text-center text-white">
<div class="col-lg-10 mx-auto">
<h1 class="display-4" style="padding-top: 2%;font-weight: 400;color: rgb(4, 54, 4);""><b>{{title}}🍂</b></h1>
</div>
</div>
<center>
<div class=" col">
<div class="p-3 bg-white shadow rounded-lg" style="width: 30%;">
<img src={{image_url}} width="350" height="350">
</div>
</div>
</center>
<br>
<div class=" row ">
<div class="col mx-auto">
<div class="p-5 bg-white shadow rounded-lg" style="height: 95%;">
<h5><b>
{% if pred==3 or pred==5 or pred==7 or pred==11 or pred==15 or pred==18 or pred==20 or pred==23 or
pred==24 or pred==25 or pred==28 or pred==38 %}
Tips to Grow Healthy Plants :
{% else %}
Brief Descritpion :
{% endif %}
</b></h5>
<p>{{desc}}
</p>
</div>
</div>
</div>
<div class="row">
<div class="col mx-auto">
<div class="p-5 bg-white shadow rounded-lg" style="height:95%">
<h5><b>
{% if pred==3 or pred==5 or pred==7 or pred==11 or pred==15 or pred==18 or pred==20 or pred==23 or
pred==24 or pred==25 or pred==28 or pred==38 %}
Benefits :
{% else %}
Prevent This Plant Disease By follow below steps :
{% endif %}
</b></h5>
<p>
{{prevent}}
</p>
</div>
</div>
{% if pred!=4 %}
<div class="col mx-auto"">
<div class=" p-5 bg-white shadow rounded-lg" style="height: 95%;">
<center>
<h5><b>
{% if pred==3 or pred==5 or pred==7 or pred==11 or pred==15 or pred==18 or pred==20 or pred==23 or
pred==24 or pred==25 or pred==28 or pred==38 %}
Fertilizer :
{% else %}
Supplements :
{% endif %}
</b></h5>
<br>
<img src={{simage}} width="300" height="350">
<br>
<br>
<h6>{{sname}}</h6>
<a target="_blank" href={{buy_link}}><button type="button" class="btn btn-success"
style="background-color: #05380b;">Buy Product</button></a>
</center>
</div>
</div>
{% endif %}
</div>
</div>
</div>
{% endblock body %}
================================================
FILE: Model/Plant Disease Detection Code.ipynb
================================================
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Import Dependencies"
]
},
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [],
"source": [
"import numpy as np\n",
"import pandas as pd\n",
"import matplotlib.pyplot as plt"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {},
"outputs": [],
"source": [
"import torch\n",
"from torchvision import datasets, transforms, models # datsets , transforms\n",
"from torch.utils.data.sampler import SubsetRandomSampler\n",
"import torch.nn as nn\n",
"import torch.nn.functional as F\n",
"from datetime import datetime"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {},
"outputs": [
{
"data": {
"application/javascript": "\n setTimeout(function() {\n var nbb_cell_id = 3;\n var nbb_unformatted_code = \"%load_ext nb_black\";\n var nbb_formatted_code = \"%load_ext nb_black\";\n var nbb_cells = Jupyter.notebook.get_cells();\n for (var i = 0; i < nbb_cells.length; ++i) {\n if (nbb_cells[i].input_prompt_number == nbb_cell_id) {\n if (nbb_cells[i].get_text() == nbb_unformatted_code) {\n nbb_cells[i].set_text(nbb_formatted_code);\n }\n break;\n }\n }\n }, 500);\n ",
"text/plain": [
"<IPython.core.display.Javascript object>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"%load_ext nb_black"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Import Dataset"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"<b> Dataset Link (Plant Vliiage Dataset ):</b><br> <a href='https://data.mendeley.com/datasets/tywbtsjrjv/1'> https://data.mendeley.com/datasets/tywbtsjrjv/1 </a> "
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {},
"outputs": [
{
"data": {
"application/javascript": "\n setTimeout(function() {\n var nbb_cell_id = 4;\n var nbb_unformatted_code = \"transform = transforms.Compose(\\n [transforms.Resize(255), transforms.CenterCrop(224), transforms.ToTensor()]\\n)\";\n var nbb_formatted_code = \"transform = transforms.Compose(\\n [transforms.Resize(255), transforms.CenterCrop(224), transforms.ToTensor()]\\n)\";\n var nbb_cells = Jupyter.notebook.get_cells();\n for (var i = 0; i < nbb_cells.length; ++i) {\n if (nbb_cells[i].input_prompt_number == nbb_cell_id) {\n if (nbb_cells[i].get_text() == nbb_unformatted_code) {\n nbb_cells[i].set_text(nbb_formatted_code);\n }\n break;\n }\n }\n }, 500);\n ",
"text/plain": [
"<IPython.core.display.Javascript object>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"transform = transforms.Compose(\n",
" [transforms.Resize(255), transforms.CenterCrop(224), transforms.ToTensor()]\n",
")"
]
},
{
"cell_type": "code",
"execution_count": 5,
"metadata": {},
"outputs": [
{
"data": {
"application/javascript": "\n setTimeout(function() {\n var nbb_cell_id = 5;\n var nbb_unformatted_code = \"dataset = datasets.ImageFolder(\\\"Dataset\\\", transform=transform)\";\n var nbb_formatted_code = \"dataset = datasets.ImageFolder(\\\"Dataset\\\", transform=transform)\";\n var nbb_cells = Jupyter.notebook.get_cells();\n for (var i = 0; i < nbb_cells.length; ++i) {\n if (nbb_cells[i].input_prompt_number == nbb_cell_id) {\n if (nbb_cells[i].get_text() == nbb_unformatted_code) {\n nbb_cells[i].set_text(nbb_formatted_code);\n }\n break;\n }\n }\n }, 500);\n ",
"text/plain": [
"<IPython.core.display.Javascript object>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"dataset = datasets.ImageFolder(\"Dataset\", transform=transform)"
]
},
{
"cell_type": "code",
"execution_count": 6,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"Dataset ImageFolder\n",
" Number of datapoints: 61486\n",
" Root Location: Dataset\n",
" Transforms (if any): Compose(\n",
" Resize(size=255, interpolation=PIL.Image.BILINEAR)\n",
" CenterCrop(size=(224, 224))\n",
" ToTensor()\n",
" )\n",
" Target Transforms (if any): None"
]
},
"execution_count": 6,
"metadata": {},
"output_type": "execute_result"
},
{
"data": {
"application/javascript": "\n setTimeout(function() {\n var nbb_cell_id = 6;\n var nbb_unformatted_code = \"dataset\";\n var nbb_formatted_code = \"dataset\";\n var nbb_cells = Jupyter.notebook.get_cells();\n for (var i = 0; i < nbb_cells.length; ++i) {\n if (nbb_cells[i].input_prompt_number == nbb_cell_id) {\n if (nbb_cells[i].get_text() == nbb_unformatted_code) {\n nbb_cells[i].set_text(nbb_formatted_code);\n }\n break;\n }\n }\n }, 500);\n ",
"text/plain": [
"<IPython.core.display.Javascript object>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"dataset"
]
},
{
"cell_type": "code",
"execution_count": 7,
"metadata": {},
"outputs": [
{
"data": {
"application/javascript": "\n setTimeout(function() {\n var nbb_cell_id = 7;\n var nbb_unformatted_code = \"indices = list(range(len(dataset)))\";\n var nbb_formatted_code = \"indices = list(range(len(dataset)))\";\n var nbb_cells = Jupyter.notebook.get_cells();\n for (var i = 0; i < nbb_cells.length; ++i) {\n if (nbb_cells[i].input_prompt_number == nbb_cell_id) {\n if (nbb_cells[i].get_text() == nbb_unformatted_code) {\n nbb_cells[i].set_text(nbb_formatted_code);\n }\n break;\n }\n }\n }, 500);\n ",
"text/plain": [
"<IPython.core.display.Javascript object>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"indices = list(range(len(dataset)))"
]
},
{
"cell_type": "code",
"execution_count": 8,
"metadata": {},
"outputs": [
{
"data": {
"application/javascript": "\n setTimeout(function() {\n var nbb_cell_id = 8;\n var nbb_unformatted_code = \"split = int(np.floor(0.85 * len(dataset))) # train_size\";\n var nbb_formatted_code = \"split = int(np.floor(0.85 * len(dataset))) # train_size\";\n var nbb_cells = Jupyter.notebook.get_cells();\n for (var i = 0; i < nbb_cells.length; ++i) {\n if (nbb_cells[i].input_prompt_number == nbb_cell_id) {\n if (nbb_cells[i].get_text() == nbb_unformatted_code) {\n nbb_cells[i].set_text(nbb_formatted_code);\n }\n break;\n }\n }\n }, 500);\n ",
"text/plain": [
"<IPython.core.display.Javascript object>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"split = int(np.floor(0.85 * len(dataset))) # train_size"
]
},
{
"cell_type": "code",
"execution_count": 9,
"metadata": {},
"outputs": [
{
"data": {
"application/javascript": "\n setTimeout(function() {\n var nbb_cell_id = 9;\n var nbb_unformatted_code = \"validation = int(np.floor(0.70 * split)) # validation\";\n var nbb_formatted_code = \"validation = int(np.floor(0.70 * split)) # validation\";\n var nbb_cells = Jupyter.notebook.get_cells();\n for (var i = 0; i < nbb_cells.length; ++i) {\n if (nbb_cells[i].input_prompt_number == nbb_cell_id) {\n if (nbb_cells[i].get_text() == nbb_unformatted_code) {\n nbb_cells[i].set_text(nbb_formatted_code);\n }\n break;\n }\n }\n }, 500);\n ",
"text/plain": [
"<IPython.core.display.Javascript object>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"validation = int(np.floor(0.70 * split)) # validation"
]
},
{
"cell_type": "code",
"execution_count": 10,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"0 36584 52263 61486\n"
]
},
{
"data": {
"application/javascript": "\n setTimeout(function() {\n var nbb_cell_id = 10;\n var nbb_unformatted_code = \"print(0, validation, split, len(dataset))\";\n var nbb_formatted_code = \"print(0, validation, split, len(dataset))\";\n var nbb_cells = Jupyter.notebook.get_cells();\n for (var i = 0; i < nbb_cells.length; ++i) {\n if (nbb_cells[i].input_prompt_number == nbb_cell_id) {\n if (nbb_cells[i].get_text() == nbb_unformatted_code) {\n nbb_cells[i].set_text(nbb_formatted_code);\n }\n break;\n }\n }\n }, 500);\n ",
"text/plain": [
"<IPython.core.display.Javascript object>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"print(0, validation, split, len(dataset))"
]
},
{
"cell_type": "code",
"execution_count": 11,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"length of train size :36584\n",
"length of validation size :15679\n",
"length of test size :24902\n"
]
},
{
"data": {
"application/javascript": "\n setTimeout(function() {\n var nbb_cell_id = 11;\n var nbb_unformatted_code = \"print(f\\\"length of train size :{validation}\\\")\\nprint(f\\\"length of validation size :{split - validation}\\\")\\nprint(f\\\"length of test size :{len(dataset)-validation}\\\")\";\n var nbb_formatted_code = \"print(f\\\"length of train size :{validation}\\\")\\nprint(f\\\"length of validation size :{split - validation}\\\")\\nprint(f\\\"length of test size :{len(dataset)-validation}\\\")\";\n var nbb_cells = Jupyter.notebook.get_cells();\n for (var i = 0; i < nbb_cells.length; ++i) {\n if (nbb_cells[i].input_prompt_number == nbb_cell_id) {\n if (nbb_cells[i].get_text() == nbb_unformatted_code) {\n nbb_cells[i].set_text(nbb_formatted_code);\n }\n break;\n }\n }\n }, 500);\n ",
"text/plain": [
"<IPython.core.display.Javascript object>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"print(f\"length of train size :{validation}\")\n",
"print(f\"length of validation size :{split - validation}\")\n",
"print(f\"length of test size :{len(dataset)-validation}\")"
]
},
{
"cell_type": "code",
"execution_count": 12,
"metadata": {},
"outputs": [
{
"data": {
"application/javascript": "\n setTimeout(function() {\n var nbb_cell_id = 12;\n var nbb_unformatted_code = \"np.random.shuffle(indices)\";\n var nbb_formatted_code = \"np.random.shuffle(indices)\";\n var nbb_cells = Jupyter.notebook.get_cells();\n for (var i = 0; i < nbb_cells.length; ++i) {\n if (nbb_cells[i].input_prompt_number == nbb_cell_id) {\n if (nbb_cells[i].get_text() == nbb_unformatted_code) {\n nbb_cells[i].set_text(nbb_formatted_code);\n }\n break;\n }\n }\n }, 500);\n ",
"text/plain": [
"<IPython.core.display.Javascript object>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"np.random.shuffle(indices)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Split into Train and Test"
]
},
{
"cell_type": "code",
"execution_count": 13,
"metadata": {},
"outputs": [
{
"data": {
"application/javascript": "\n setTimeout(function() {\n var nbb_cell_id = 13;\n var nbb_unformatted_code = \"train_indices, validation_indices, test_indices = (\\n indices[:validation],\\n indices[validation:split],\\n indices[split:],\\n)\";\n var nbb_formatted_code = \"train_indices, validation_indices, test_indices = (\\n indices[:validation],\\n indices[validation:split],\\n indices[split:],\\n)\";\n var nbb_cells = Jupyter.notebook.get_cells();\n for (var i = 0; i < nbb_cells.length; ++i) {\n if (nbb_cells[i].input_prompt_number == nbb_cell_id) {\n if (nbb_cells[i].get_text() == nbb_unformatted_code) {\n nbb_cells[i].set_text(nbb_formatted_code);\n }\n break;\n }\n }\n }, 500);\n ",
"text/plain": [
"<IPython.core.display.Javascript object>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"train_indices, validation_indices, test_indices = (\n",
" indices[:validation],\n",
" indices[validation:split],\n",
" indices[split:],\n",
")"
]
},
{
"cell_type": "code",
"execution_count": 14,
"metadata": {},
"outputs": [
{
"data": {
"application/javascript": "\n setTimeout(function() {\n var nbb_cell_id = 14;\n var nbb_unformatted_code = \"train_sampler = SubsetRandomSampler(train_indices)\\nvalidation_sampler = SubsetRandomSampler(validation_indices)\\ntest_sampler = SubsetRandomSampler(test_indices)\";\n var nbb_formatted_code = \"train_sampler = SubsetRandomSampler(train_indices)\\nvalidation_sampler = SubsetRandomSampler(validation_indices)\\ntest_sampler = SubsetRandomSampler(test_indices)\";\n var nbb_cells = Jupyter.notebook.get_cells();\n for (var i = 0; i < nbb_cells.length; ++i) {\n if (nbb_cells[i].input_prompt_number == nbb_cell_id) {\n if (nbb_cells[i].get_text() == nbb_unformatted_code) {\n nbb_cells[i].set_text(nbb_formatted_code);\n }\n break;\n }\n }\n }, 500);\n ",
"text/plain": [
"<IPython.core.display.Javascript object>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"train_sampler = SubsetRandomSampler(train_indices)\n",
"validation_sampler = SubsetRandomSampler(validation_indices)\n",
"test_sampler = SubsetRandomSampler(test_indices)"
]
},
{
"cell_type": "code",
"execution_count": 15,
"metadata": {},
"outputs": [
{
"data": {
"application/javascript": "\n setTimeout(function() {\n var nbb_cell_id = 15;\n var nbb_unformatted_code = \"targets_size = len(dataset.class_to_idx)\";\n var nbb_formatted_code = \"targets_size = len(dataset.class_to_idx)\";\n var nbb_cells = Jupyter.notebook.get_cells();\n for (var i = 0; i < nbb_cells.length; ++i) {\n if (nbb_cells[i].input_prompt_number == nbb_cell_id) {\n if (nbb_cells[i].get_text() == nbb_unformatted_code) {\n nbb_cells[i].set_text(nbb_formatted_code);\n }\n break;\n }\n }\n }, 500);\n ",
"text/plain": [
"<IPython.core.display.Javascript object>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"targets_size = len(dataset.class_to_idx)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Model"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"<b>Convolution Aithmetic Equation : </b>(W - F + 2P) / S + 1 <br>\n",
"W = Input Size<br>\n",
"F = Filter Size<br>\n",
"P = Padding Size<br>\n",
"S = Stride <br>"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Transfer Learning"
]
},
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [],
"source": [
"# model = models.vgg16(pretrained=True)"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {},
"outputs": [],
"source": [
"# for params in model.parameters():\n",
"# params.requires_grad = False"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {},
"outputs": [],
"source": [
"# model"
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {},
"outputs": [],
"source": [
"# n_features = model.classifier[0].in_features\n",
"# n_features"
]
},
{
"cell_type": "code",
"execution_count": 5,
"metadata": {},
"outputs": [],
"source": [
"# model.classifier = nn.Sequential(\n",
"# nn.Linear(n_features, 1024),\n",
"# nn.ReLU(),\n",
"# nn.Dropout(0.4),\n",
"# nn.Linear(1024, targets_size),\n",
"# )"
]
},
{
"cell_type": "code",
"execution_count": 7,
"metadata": {},
"outputs": [],
"source": [
"# model"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Original Modeling"
]
},
{
"cell_type": "code",
"execution_count": 16,
"metadata": {},
"outputs": [
{
"data": {
"application/javascript": "\n setTimeout(function() {\n var nbb_cell_id = 16;\n var nbb_unformatted_code = \"class CNN(nn.Module):\\n def __init__(self, K):\\n super(CNN, self).__init__()\\n self.conv_layers = nn.Sequential(\\n # conv1\\n nn.Conv2d(in_channels=3, out_channels=32, kernel_size=3, padding=1),\\n nn.ReLU(),\\n nn.BatchNorm2d(32),\\n nn.Conv2d(in_channels=32, out_channels=32, kernel_size=3, padding=1),\\n nn.ReLU(),\\n nn.BatchNorm2d(32),\\n nn.MaxPool2d(2),\\n # conv2\\n nn.Conv2d(in_channels=32, out_channels=64, kernel_size=3, padding=1),\\n nn.ReLU(),\\n nn.BatchNorm2d(64),\\n nn.Conv2d(in_channels=64, out_channels=64, kernel_size=3, padding=1),\\n nn.ReLU(),\\n nn.BatchNorm2d(64),\\n nn.MaxPool2d(2),\\n # conv3\\n nn.Conv2d(in_channels=64, out_channels=128, kernel_size=3, padding=1),\\n nn.ReLU(),\\n nn.BatchNorm2d(128),\\n nn.Conv2d(in_channels=128, out_channels=128, kernel_size=3, padding=1),\\n nn.ReLU(),\\n nn.BatchNorm2d(128),\\n nn.MaxPool2d(2),\\n # conv4\\n nn.Conv2d(in_channels=128, out_channels=256, kernel_size=3, padding=1),\\n nn.ReLU(),\\n nn.BatchNorm2d(256),\\n nn.Conv2d(in_channels=256, out_channels=256, kernel_size=3, padding=1),\\n nn.ReLU(),\\n nn.BatchNorm2d(256),\\n nn.MaxPool2d(2),\\n )\\n\\n self.dense_layers = nn.Sequential(\\n nn.Dropout(0.4),\\n nn.Linear(50176, 1024),\\n nn.ReLU(),\\n nn.Dropout(0.4),\\n nn.Linear(1024, K),\\n )\\n\\n def forward(self, X):\\n out = self.conv_layers(X)\\n\\n # Flatten\\n out = out.view(-1, 50176)\\n\\n # Fully connected\\n out = self.dense_layers(out)\\n\\n return out\";\n var nbb_formatted_code = \"class CNN(nn.Module):\\n def __init__(self, K):\\n super(CNN, self).__init__()\\n self.conv_layers = nn.Sequential(\\n # conv1\\n nn.Conv2d(in_channels=3, out_channels=32, kernel_size=3, padding=1),\\n nn.ReLU(),\\n nn.BatchNorm2d(32),\\n nn.Conv2d(in_channels=32, out_channels=32, kernel_size=3, padding=1),\\n nn.ReLU(),\\n nn.BatchNorm2d(32),\\n nn.MaxPool2d(2),\\n # conv2\\n nn.Conv2d(in_channels=32, out_channels=64, kernel_size=3, padding=1),\\n nn.ReLU(),\\n nn.BatchNorm2d(64),\\n nn.Conv2d(in_channels=64, out_channels=64, kernel_size=3, padding=1),\\n nn.ReLU(),\\n nn.BatchNorm2d(64),\\n nn.MaxPool2d(2),\\n # conv3\\n nn.Conv2d(in_channels=64, out_channels=128, kernel_size=3, padding=1),\\n nn.ReLU(),\\n nn.BatchNorm2d(128),\\n nn.Conv2d(in_channels=128, out_channels=128, kernel_size=3, padding=1),\\n nn.ReLU(),\\n nn.BatchNorm2d(128),\\n nn.MaxPool2d(2),\\n # conv4\\n nn.Conv2d(in_channels=128, out_channels=256, kernel_size=3, padding=1),\\n nn.ReLU(),\\n nn.BatchNorm2d(256),\\n nn.Conv2d(in_channels=256, out_channels=256, kernel_size=3, padding=1),\\n nn.ReLU(),\\n nn.BatchNorm2d(256),\\n nn.MaxPool2d(2),\\n )\\n\\n self.dense_layers = nn.Sequential(\\n nn.Dropout(0.4),\\n nn.Linear(50176, 1024),\\n nn.ReLU(),\\n nn.Dropout(0.4),\\n nn.Linear(1024, K),\\n )\\n\\n def forward(self, X):\\n out = self.conv_layers(X)\\n\\n # Flatten\\n out = out.view(-1, 50176)\\n\\n # Fully connected\\n out = self.dense_layers(out)\\n\\n return out\";\n var nbb_cells = Jupyter.notebook.get_cells();\n for (var i = 0; i < nbb_cells.length; ++i) {\n if (nbb_cells[i].input_prompt_number == nbb_cell_id) {\n if (nbb_cells[i].get_text() == nbb_unformatted_code) {\n nbb_cells[i].set_text(nbb_formatted_code);\n }\n break;\n }\n }\n }, 500);\n ",
"text/plain": [
"<IPython.core.display.Javascript object>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"class CNN(nn.Module):\n",
" def __init__(self, K):\n",
" super(CNN, self).__init__()\n",
" self.conv_layers = nn.Sequential(\n",
" # conv1\n",
" nn.Conv2d(in_channels=3, out_channels=32, kernel_size=3, padding=1),\n",
" nn.ReLU(),\n",
" nn.BatchNorm2d(32),\n",
" nn.Conv2d(in_channels=32, out_channels=32, kernel_size=3, padding=1),\n",
" nn.ReLU(),\n",
" nn.BatchNorm2d(32),\n",
" nn.MaxPool2d(2),\n",
" # conv2\n",
" nn.Conv2d(in_channels=32, out_channels=64, kernel_size=3, padding=1),\n",
" nn.ReLU(),\n",
" nn.BatchNorm2d(64),\n",
" nn.Conv2d(in_channels=64, out_channels=64, kernel_size=3, padding=1),\n",
" nn.ReLU(),\n",
" nn.BatchNorm2d(64),\n",
" nn.MaxPool2d(2),\n",
" # conv3\n",
" nn.Conv2d(in_channels=64, out_channels=128, kernel_size=3, padding=1),\n",
" nn.ReLU(),\n",
" nn.BatchNorm2d(128),\n",
" nn.Conv2d(in_channels=128, out_channels=128, kernel_size=3, padding=1),\n",
" nn.ReLU(),\n",
" nn.BatchNorm2d(128),\n",
" nn.MaxPool2d(2),\n",
" # conv4\n",
" nn.Conv2d(in_channels=128, out_channels=256, kernel_size=3, padding=1),\n",
" nn.ReLU(),\n",
" nn.BatchNorm2d(256),\n",
" nn.Conv2d(in_channels=256, out_channels=256, kernel_size=3, padding=1),\n",
" nn.ReLU(),\n",
" nn.BatchNorm2d(256),\n",
" nn.MaxPool2d(2),\n",
" )\n",
"\n",
" self.dense_layers = nn.Sequential(\n",
" nn.Dropout(0.4),\n",
" nn.Linear(50176, 1024),\n",
" nn.ReLU(),\n",
" nn.Dropout(0.4),\n",
" nn.Linear(1024, K),\n",
" )\n",
"\n",
" def forward(self, X):\n",
" out = self.conv_layers(X)\n",
"\n",
" # Flatten\n",
" out = out.view(-1, 50176)\n",
"\n",
" # Fully connected\n",
" out = self.dense_layers(out)\n",
"\n",
" return out"
]
},
{
"cell_type": "code",
"execution_count": 18,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"cpu\n"
]
},
{
"data": {
"application/javascript": "\n setTimeout(function() {\n var nbb_cell_id = 18;\n var nbb_unformatted_code = \"device = torch.device(\\\"cuda\\\" if torch.cuda.is_available() else \\\"cpu\\\")\\nprint(device)\";\n var nbb_formatted_code = \"device = torch.device(\\\"cuda\\\" if torch.cuda.is_available() else \\\"cpu\\\")\\nprint(device)\";\n var nbb_cells = Jupyter.notebook.get_cells();\n for (var i = 0; i < nbb_cells.length; ++i) {\n if (nbb_cells[i].input_prompt_number == nbb_cell_id) {\n if (nbb_cells[i].get_text() == nbb_unformatted_code) {\n nbb_cells[i].set_text(nbb_formatted_code);\n }\n break;\n }\n }\n }, 500);\n ",
"text/plain": [
"<IPython.core.display.Javascript object>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"device = torch.device(\"cuda\" if torch.cuda.is_available() else \"cpu\")\n",
"print(device)"
]
},
{
"cell_type": "code",
"execution_count": 19,
"metadata": {},
"outputs": [
{
"data": {
"application/javascript": "\n setTimeout(function() {\n var nbb_cell_id = 19;\n var nbb_unformatted_code = \"device = \\\"cpu\\\"\";\n var nbb_formatted_code = \"device = \\\"cpu\\\"\";\n var nbb_cells = Jupyter.notebook.get_cells();\n for (var i = 0; i < nbb_cells.length; ++i) {\n if (nbb_cells[i].input_prompt_number == nbb_cell_id) {\n if (nbb_cells[i].get_text() == nbb_unformatted_code) {\n nbb_cells[i].set_text(nbb_formatted_code);\n }\n break;\n }\n }\n }, 500);\n ",
"text/plain": [
"<IPython.core.display.Javascript object>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"device = \"cpu\""
]
},
{
"cell_type": "code",
"execution_count": 20,
"metadata": {},
"outputs": [
{
"data": {
"application/javascript": "\n setTimeout(function() {\n var nbb_cell_id = 20;\n var nbb_unformatted_code = \"model = CNN(targets_size)\";\n var nbb_formatted_code = \"model = CNN(targets_size)\";\n var nbb_cells = Jupyter.notebook.get_cells();\n for (var i = 0; i < nbb_cells.length; ++i) {\n if (nbb_cells[i].input_prompt_number == nbb_cell_id) {\n if (nbb_cells[i].get_text() == nbb_unformatted_code) {\n nbb_cells[i].set_text(nbb_formatted_code);\n }\n break;\n }\n }\n }, 500);\n ",
"text/plain": [
"<IPython.core.display.Javascript object>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"model = CNN(targets_size)"
]
},
{
"cell_type": "code",
"execution_count": 21,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"CNN(\n",
" (conv_layers): Sequential(\n",
" (0): Conv2d(3, 32, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1))\n",
" (1): ReLU()\n",
" (2): BatchNorm2d(32, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)\n",
" (3): Conv2d(32, 32, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1))\n",
" (4): ReLU()\n",
" (5): BatchNorm2d(32, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)\n",
" (6): MaxPool2d(kernel_size=2, stride=2, padding=0, dilation=1, ceil_mode=False)\n",
" (7): Conv2d(32, 64, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1))\n",
" (8): ReLU()\n",
" (9): BatchNorm2d(64, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)\n",
" (10): Conv2d(64, 64, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1))\n",
" (11): ReLU()\n",
" (12): BatchNorm2d(64, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)\n",
" (13): MaxPool2d(kernel_size=2, stride=2, padding=0, dilation=1, ceil_mode=False)\n",
" (14): Conv2d(64, 128, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1))\n",
" (15): ReLU()\n",
" (16): BatchNorm2d(128, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)\n",
" (17): Conv2d(128, 128, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1))\n",
" (18): ReLU()\n",
" (19): BatchNorm2d(128, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)\n",
" (20): MaxPool2d(kernel_size=2, stride=2, padding=0, dilation=1, ceil_mode=False)\n",
" (21): Conv2d(128, 256, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1))\n",
" (22): ReLU()\n",
" (23): BatchNorm2d(256, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)\n",
" (24): Conv2d(256, 256, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1))\n",
" (25): ReLU()\n",
" (26): BatchNorm2d(256, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)\n",
" (27): MaxPool2d(kernel_size=2, stride=2, padding=0, dilation=1, ceil_mode=False)\n",
" )\n",
" (dense_layers): Sequential(\n",
" (0): Dropout(p=0.4, inplace=False)\n",
" (1): Linear(in_features=50176, out_features=1024, bias=True)\n",
" (2): ReLU()\n",
" (3): Dropout(p=0.4, inplace=False)\n",
" (4): Linear(in_features=1024, out_features=39, bias=True)\n",
" )\n",
")"
]
},
"execution_count": 21,
"metadata": {},
"output_type": "execute_result"
},
{
"data": {
"application/javascript": "\n setTimeout(function() {\n var nbb_cell_id = 21;\n var nbb_unformatted_code = \"model.to(device)\";\n var nbb_formatted_code = \"model.to(device)\";\n var nbb_cells = Jupyter.notebook.get_cells();\n for (var i = 0; i < nbb_cells.length; ++i) {\n if (nbb_cells[i].input_prompt_number == nbb_cell_id) {\n if (nbb_cells[i].get_text() == nbb_unformatted_code) {\n nbb_cells[i].set_text(nbb_formatted_code);\n }\n break;\n }\n }\n }, 500);\n ",
"text/plain": [
"<IPython.core.display.Javascript object>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"model.to(device)"
]
},
{
"cell_type": "code",
"execution_count": 22,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"----------------------------------------------------------------\n",
" Layer (type) Output Shape Param #\n",
"================================================================\n",
" Conv2d-1 [-1, 32, 224, 224] 896\n",
" ReLU-2 [-1, 32, 224, 224] 0\n",
" BatchNorm2d-3 [-1, 32, 224, 224] 64\n",
" Conv2d-4 [-1, 32, 224, 224] 9,248\n",
" ReLU-5 [-1, 32, 224, 224] 0\n",
" BatchNorm2d-6 [-1, 32, 224, 224] 64\n",
" MaxPool2d-7 [-1, 32, 112, 112] 0\n",
" Conv2d-8 [-1, 64, 112, 112] 18,496\n",
" ReLU-9 [-1, 64, 112, 112] 0\n",
" BatchNorm2d-10 [-1, 64, 112, 112] 128\n",
" Conv2d-11 [-1, 64, 112, 112] 36,928\n",
" ReLU-12 [-1, 64, 112, 112] 0\n",
" BatchNorm2d-13 [-1, 64, 112, 112] 128\n",
" MaxPool2d-14 [-1, 64, 56, 56] 0\n",
" Conv2d-15 [-1, 128, 56, 56] 73,856\n",
" ReLU-16 [-1, 128, 56, 56] 0\n",
" BatchNorm2d-17 [-1, 128, 56, 56] 256\n",
" Conv2d-18 [-1, 128, 56, 56] 147,584\n",
" ReLU-19 [-1, 128, 56, 56] 0\n",
" BatchNorm2d-20 [-1, 128, 56, 56] 256\n",
" MaxPool2d-21 [-1, 128, 28, 28] 0\n",
" Conv2d-22 [-1, 256, 28, 28] 295,168\n",
" ReLU-23 [-1, 256, 28, 28] 0\n",
" BatchNorm2d-24 [-1, 256, 28, 28] 512\n",
" Conv2d-25 [-1, 256, 28, 28] 590,080\n",
" ReLU-26 [-1, 256, 28, 28] 0\n",
" BatchNorm2d-27 [-1, 256, 28, 28] 512\n",
" MaxPool2d-28 [-1, 256, 14, 14] 0\n",
" Dropout-29 [-1, 50176] 0\n",
" Linear-30 [-1, 1024] 51,381,248\n",
" ReLU-31 [-1, 1024] 0\n",
" Dropout-32 [-1, 1024] 0\n",
" Linear-33 [-1, 39] 39,975\n",
"================================================================\n",
"Total params: 52,595,399\n",
"Trainable params: 52,595,399\n",
"Non-trainable params: 0\n",
"----------------------------------------------------------------\n",
"Input size (MB): 0.57\n",
"Forward/backward pass size (MB): 143.96\n",
"Params size (MB): 200.64\n",
"Estimated Total Size (MB): 345.17\n",
"----------------------------------------------------------------\n"
]
},
{
"data": {
"application/javascript": "\n setTimeout(function() {\n var nbb_cell_id = 22;\n var nbb_unformatted_code = \"from torchsummary import summary\\n\\nsummary(model, (3, 224, 224))\";\n var nbb_formatted_code = \"from torchsummary import summary\\n\\nsummary(model, (3, 224, 224))\";\n var nbb_cells = Jupyter.notebook.get_cells();\n for (var i = 0; i < nbb_cells.length; ++i) {\n if (nbb_cells[i].input_prompt_number == nbb_cell_id) {\n if (nbb_cells[i].get_text() == nbb_unformatted_code) {\n nbb_cells[i].set_text(nbb_formatted_code);\n }\n break;\n }\n }\n }, 500);\n ",
"text/plain": [
"<IPython.core.display.Javascript object>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"from torchsummary import summary\n",
"\n",
"summary(model, (3, 224, 224))"
]
},
{
"cell_type": "code",
"execution_count": 30,
"metadata": {},
"outputs": [
{
"data": {
"application/javascript": "\n setTimeout(function() {\n var nbb_cell_id = 30;\n var nbb_unformatted_code = \"criterion = nn.CrossEntropyLoss() # this include softmax + cross entropy loss\\noptimizer = torch.optim.Adam(model.parameters())\";\n var nbb_formatted_code = \"criterion = nn.CrossEntropyLoss() # this include softmax + cross entropy loss\\noptimizer = torch.optim.Adam(model.parameters())\";\n var nbb_cells = Jupyter.notebook.get_cells();\n for (var i = 0; i < nbb_cells.length; ++i) {\n if (nbb_cells[i].input_prompt_number == nbb_cell_id) {\n if (nbb_cells[i].get_text() == nbb_unformatted_code) {\n nbb_cells[i].set_text(nbb_formatted_code);\n }\n break;\n }\n }\n }, 500);\n ",
"text/plain": [
"<IPython.core.display.Javascript object>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"criterion = nn.CrossEntropyLoss() # this include softmax + cross entropy loss\n",
"optimizer = torch.optim.Adam(model.parameters())"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Batch Gradient Descent"
]
},
{
"cell_type": "code",
"execution_count": 31,
"metadata": {},
"outputs": [
{
"data": {
"application/javascript": "\n setTimeout(function() {\n var nbb_cell_id = 31;\n var nbb_unformatted_code = \"def batch_gd(model, criterion, train_loader, test_laoder, epochs):\\n train_losses = np.zeros(epochs)\\n test_losses = np.zeros(epochs)\\n\\n for e in range(epochs):\\n t0 = datetime.now()\\n train_loss = []\\n for inputs, targets in train_loader:\\n inputs, targets = inputs.to(device), targets.to(device)\\n\\n optimizer.zero_grad()\\n\\n output = model(inputs)\\n\\n loss = criterion(output, targets)\\n\\n train_loss.append(loss.item()) # torch to numpy world\\n\\n loss.backward()\\n optimizer.step()\\n\\n train_loss = np.mean(train_loss)\\n\\n validation_loss = []\\n\\n for inputs, targets in validation_loader:\\n\\n inputs, targets = inputs.to(device), targets.to(device)\\n\\n output = model(inputs)\\n\\n loss = criterion(output, targets)\\n\\n validation_loss.append(loss.item()) # torch to numpy world\\n\\n validation_loss = np.mean(validation_loss)\\n\\n train_losses[e] = train_loss\\n validation_losses[e] = validation_loss\\n\\n dt = datetime.now() - t0\\n\\n print(\\n f\\\"Epoch : {e+1}/{epochs} Train_loss:{train_loss:.3f} Test_loss:{validation_loss:.3f} Duration:{dt}\\\"\\n )\\n\\n return train_losses, validation_losses\";\n var nbb_formatted_code = \"def batch_gd(model, criterion, train_loader, test_laoder, epochs):\\n train_losses = np.zeros(epochs)\\n test_losses = np.zeros(epochs)\\n\\n for e in range(epochs):\\n t0 = datetime.now()\\n train_loss = []\\n for inputs, targets in train_loader:\\n inputs, targets = inputs.to(device), targets.to(device)\\n\\n optimizer.zero_grad()\\n\\n output = model(inputs)\\n\\n loss = criterion(output, targets)\\n\\n train_loss.append(loss.item()) # torch to numpy world\\n\\n loss.backward()\\n optimizer.step()\\n\\n train_loss = np.mean(train_loss)\\n\\n validation_loss = []\\n\\n for inputs, targets in validation_loader:\\n\\n inputs, targets = inputs.to(device), targets.to(device)\\n\\n output = model(inputs)\\n\\n loss = criterion(output, targets)\\n\\n validation_loss.append(loss.item()) # torch to numpy world\\n\\n validation_loss = np.mean(validation_loss)\\n\\n train_losses[e] = train_loss\\n validation_losses[e] = validation_loss\\n\\n dt = datetime.now() - t0\\n\\n print(\\n f\\\"Epoch : {e+1}/{epochs} Train_loss:{train_loss:.3f} Test_loss:{validation_loss:.3f} Duration:{dt}\\\"\\n )\\n\\n return train_losses, validation_losses\";\n var nbb_cells = Jupyter.notebook.get_cells();\n for (var i = 0; i < nbb_cells.length; ++i) {\n if (nbb_cells[i].input_prompt_number == nbb_cell_id) {\n if (nbb_cells[i].get_text() == nbb_unformatted_code) {\n nbb_cells[i].set_text(nbb_formatted_code);\n }\n break;\n }\n }\n }, 500);\n ",
"text/plain": [
"<IPython.core.display.Javascript object>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"def batch_gd(model, criterion, train_loader, test_laoder, epochs):\n",
" train_losses = np.zeros(epochs)\n",
" validation_losses = np.zeros(epochs)\n",
"\n",
" for e in range(epochs):\n",
" t0 = datetime.now()\n",
" train_loss = []\n",
" for inputs, targets in train_loader:\n",
" inputs, targets = inputs.to(device), targets.to(device)\n",
"\n",
" optimizer.zero_grad()\n",
"\n",
" output = model(inputs)\n",
"\n",
" loss = criterion(output, targets)\n",
"\n",
" train_loss.append(loss.item()) # torch to numpy world\n",
"\n",
" loss.backward()\n",
" optimizer.step()\n",
"\n",
" train_loss = np.mean(train_loss)\n",
"\n",
" validation_loss = []\n",
"\n",
" for inputs, targets in validation_loader:\n",
"\n",
" inputs, targets = inputs.to(device), targets.to(device)\n",
"\n",
" output = model(inputs)\n",
"\n",
" loss = criterion(output, targets)\n",
"\n",
" validation_loss.append(loss.item()) # torch to numpy world\n",
"\n",
" validation_loss = np.mean(validation_loss)\n",
"\n",
" train_losses[e] = train_loss\n",
" validation_losses[e] = validation_loss\n",
"\n",
" dt = datetime.now() - t0\n",
"\n",
" print(\n",
" f\"Epoch : {e+1}/{epochs} Train_loss:{train_loss:.3f} Test_loss:{validation_loss:.3f} Duration:{dt}\"\n",
" )\n",
"\n",
" return train_losses, validation_losses"
]
},
{
"cell_type": "code",
"execution_count": 32,
"metadata": {},
"outputs": [
{
"data": {
"application/javascript": "\n setTimeout(function() {\n var nbb_cell_id = 32;\n var nbb_unformatted_code = \"device = \\\"cpu\\\"\";\n var nbb_formatted_code = \"device = \\\"cpu\\\"\";\n var nbb_cells = Jupyter.notebook.get_cells();\n for (var i = 0; i < nbb_cells.length; ++i) {\n if (nbb_cells[i].input_prompt_number == nbb_cell_id) {\n if (nbb_cells[i].get_text() == nbb_unformatted_code) {\n nbb_cells[i].set_text(nbb_formatted_code);\n }\n break;\n }\n }\n }, 500);\n ",
"text/plain": [
"<IPython.core.display.Javascript object>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"device = \"cpu\""
]
},
{
"cell_type": "code",
"execution_count": 33,
"metadata": {},
"outputs": [
{
"data": {
"application/javascript": "\n setTimeout(function() {\n var nbb_cell_id = 33;\n var nbb_unformatted_code = \"batch_size = 64\\ntrain_loader = torch.utils.data.DataLoader(\\n dataset, batch_size=batch_size, sampler=train_sampler\\n)\\ntest_loader = torch.utils.data.DataLoader(\\n dataset, batch_size=batch_size, sampler=test_sampler\\n)\\nvalidation_loader = torch.utils.data.DataLoader(\\n dataset, batch_size=batch_size, sampler=validation_sampler\\n)\";\n var nbb_formatted_code = \"batch_size = 64\\ntrain_loader = torch.utils.data.DataLoader(\\n dataset, batch_size=batch_size, sampler=train_sampler\\n)\\ntest_loader = torch.utils.data.DataLoader(\\n dataset, batch_size=batch_size, sampler=test_sampler\\n)\\nvalidation_loader = torch.utils.data.DataLoader(\\n dataset, batch_size=batch_size, sampler=validation_sampler\\n)\";\n var nbb_cells = Jupyter.notebook.get_cells();\n for (var i = 0; i < nbb_cells.length; ++i) {\n if (nbb_cells[i].input_prompt_number == nbb_cell_id) {\n if (nbb_cells[i].get_text() == nbb_unformatted_code) {\n nbb_cells[i].set_text(nbb_formatted_code);\n }\n break;\n }\n }\n }, 500);\n ",
"text/plain": [
"<IPython.core.display.Javascript object>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"batch_size = 64\n",
"train_loader = torch.utils.data.DataLoader(\n",
" dataset, batch_size=batch_size, sampler=train_sampler\n",
")\n",
"test_loader = torch.utils.data.DataLoader(\n",
" dataset, batch_size=batch_size, sampler=test_sampler\n",
")\n",
"validation_loader = torch.utils.data.DataLoader(\n",
" dataset, batch_size=batch_size, sampler=validation_sampler\n",
")"
]
},
{
"cell_type": "code",
"execution_count": 32,
"metadata": {},
"outputs": [
{
"data": {
"application/javascript": "\n setTimeout(function() {\n var nbb_cell_id = 32;\n var nbb_unformatted_code = \"# train_losses, validation_losses = batch_gd(\\n# model, criterion, train_loader, validation_loader, 5\\n# )\";\n var nbb_formatted_code = \"# train_losses, validation_losses = batch_gd(\\n# model, criterion, train_loader, validation_loader, 5\\n# )\";\n var nbb_cells = Jupyter.notebook.get_cells();\n for (var i = 0; i < nbb_cells.length; ++i) {\n if (nbb_cells[i].input_prompt_number == nbb_cell_id) {\n if (nbb_cells[i].get_text() == nbb_unformatted_code) {\n nbb_cells[i].set_text(nbb_formatted_code);\n }\n break;\n }\n }\n }, 500);\n ",
"text/plain": [
"<IPython.core.display.Javascript object>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"train_losses, validation_losses = batch_gd(\n",
" model, criterion, train_loader, validation_loader, 5\n",
")"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Save the Model"
]
},
{
"cell_type": "code",
"execution_count": 34,
"metadata": {},
"outputs": [
{
"data": {
"application/javascript": "\n setTimeout(function() {\n var nbb_cell_id = 34;\n var nbb_unformatted_code = \"# torch.save(model.state_dict() , 'plant_disease_model_1.pt')\";\n var nbb_formatted_code = \"# torch.save(model.state_dict() , 'plant_disease_model_1.pt')\";\n var nbb_cells = Jupyter.notebook.get_cells();\n for (var i = 0; i < nbb_cells.length; ++i) {\n if (nbb_cells[i].input_prompt_number == nbb_cell_id) {\n if (nbb_cells[i].get_text() == nbb_unformatted_code) {\n nbb_cells[i].set_text(nbb_formatted_code);\n }\n break;\n }\n }\n }, 500);\n ",
"text/plain": [
"<IPython.core.display.Javascript object>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"# torch.save(model.state_dict() , 'plant_disease_model_1.pt')"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Load Model"
]
},
{
"cell_type": "code",
"execution_count": 5,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"CNN(\n",
" (conv_layers): Sequential(\n",
" (0): Conv2d(3, 32, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1))\n",
" (1): ReLU()\n",
" (2): BatchNorm2d(32, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)\n",
" (3): Conv2d(32, 32, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1))\n",
" (4): ReLU()\n",
" (5): BatchNorm2d(32, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)\n",
" (6): MaxPool2d(kernel_size=2, stride=2, padding=0, dilation=1, ceil_mode=False)\n",
" (7): Conv2d(32, 64, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1))\n",
" (8): ReLU()\n",
" (9): BatchNorm2d(64, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)\n",
" (10): Conv2d(64, 64, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1))\n",
" (11): ReLU()\n",
" (12): BatchNorm2d(64, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)\n",
" (13): MaxPool2d(kernel_size=2, stride=2, padding=0, dilation=1, ceil_mode=False)\n",
" (14): Conv2d(64, 128, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1))\n",
" (15): ReLU()\n",
" (16): BatchNorm2d(128, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)\n",
" (17): Conv2d(128, 128, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1))\n",
" (18): ReLU()\n",
" (19): BatchNorm2d(128, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)\n",
" (20): MaxPool2d(kernel_size=2, stride=2, padding=0, dilation=1, ceil_mode=False)\n",
" (21): Conv2d(128, 256, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1))\n",
" (22): ReLU()\n",
" (23): BatchNorm2d(256, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)\n",
" (24): Conv2d(256, 256, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1))\n",
" (25): ReLU()\n",
" (26): BatchNorm2d(256, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)\n",
" (27): MaxPool2d(kernel_size=2, stride=2, padding=0, dilation=1, ceil_mode=False)\n",
" )\n",
" (dense_layers): Sequential(\n",
" (0): Dropout(p=0.4, inplace=False)\n",
" (1): Linear(in_features=50176, out_features=1024, bias=True)\n",
" (2): ReLU()\n",
" (3): Dropout(p=0.4, inplace=False)\n",
" (4): Linear(in_features=1024, out_features=39, bias=True)\n",
" )\n",
")"
]
},
"execution_count": 5,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"targets_size = 39\n",
"model = CNN(targets_size)\n",
"model.load_state_dict(torch.load(\"plant_disease_model_1_latest.pt\"))\n",
"model.eval()"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"# %matplotlib notebook"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Plot the loss"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"plt.plot(train_losses , label = 'train_loss')\n",
"plt.plot(validation_losses , label = 'validation_loss')\n",
"plt.xlabel('No of Epochs')\n",
"plt.ylabel('Loss')\n",
"plt.legend()\n",
"plt.show()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Accuracy"
]
},
{
"cell_type": "code",
"execution_count": 35,
"metadata": {},
"outputs": [
{
"data": {
"application/javascript": "\n setTimeout(function() {\n var nbb_cell_id = 35;\n var nbb_unformatted_code = \"def accuracy(loader):\\n n_correct = 0\\n n_total = 0\\n\\n for inputs , targets in loader:\\n inputs , targets = inputs.to(device) , targets.to(device)\\n\\n outputs = model(inputs)\\n\\n _ , predictions = torch.max(outputs,1)\\n\\n n_correct += (predictions == targets).sum().item()\\n n_total += targets.shape[0]\\n\\n\\n acc = n_correct / n_total\\n return acc\";\n var nbb_formatted_code = \"def accuracy(loader):\\n n_correct = 0\\n n_total = 0\\n\\n for inputs, targets in loader:\\n inputs, targets = inputs.to(device), targets.to(device)\\n\\n outputs = model(inputs)\\n\\n _, predictions = torch.max(outputs, 1)\\n\\n n_correct += (predictions == targets).sum().item()\\n n_total += targets.shape[0]\\n\\n acc = n_correct / n_total\\n return acc\";\n var nbb_cells = Jupyter.notebook.get_cells();\n for (var i = 0; i < nbb_cells.length; ++i) {\n if (nbb_cells[i].input_prompt_number == nbb_cell_id) {\n if (nbb_cells[i].get_text() == nbb_unformatted_code) {\n nbb_cells[i].set_text(nbb_formatted_code);\n }\n break;\n }\n }\n }, 500);\n ",
"text/plain": [
"<IPython.core.display.Javascript object>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"def accuracy(loader):\n",
" n_correct = 0\n",
" n_total = 0\n",
"\n",
" for inputs, targets in loader:\n",
" inputs, targets = inputs.to(device), targets.to(device)\n",
"\n",
" outputs = model(inputs)\n",
"\n",
" _, predictions = torch.max(outputs, 1)\n",
"\n",
" n_correct += (predictions == targets).sum().item()\n",
" n_total += targets.shape[0]\n",
"\n",
" acc = n_correct / n_total\n",
" return acc"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"train_acc = accuracy(train_loader)\n",
"test_acc = accuracy(test_loader)\n",
"validation_acc = accuracy(validation_loader)"
]
},
{
"cell_type": "code",
"execution_count": 38,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Train Accuracy : 96.7\n",
"Test Accuracy : 98.9\n",
"Validation Accuracy : 98.7\n"
]
},
{
"data": {
"application/javascript": "\n setTimeout(function() {\n var nbb_cell_id = 38;\n var nbb_unformatted_code = \"print(f\\\"Train Accuracy : {train_acc}\\\\nTest Accuracy : {test_acc}\\\\nValidation Accuracy : {validation_acc}\\\")\";\n var nbb_formatted_code = \"print(\\n f\\\"Train Accuracy : {train_acc}\\\\nTest Accuracy : {test_acc}\\\\nValidation Accuracy : {validation_acc}\\\"\\n)\";\n var nbb_cells = Jupyter.notebook.get_cells();\n for (var i = 0; i < nbb_cells.length; ++i) {\n if (nbb_cells[i].input_prompt_number == nbb_cell_id) {\n if (nbb_cells[i].get_text() == nbb_unformatted_code) {\n nbb_cells[i].set_text(nbb_formatted_code);\n }\n break;\n }\n }\n }, 500);\n ",
"text/plain": [
"<IPython.core.display.Javascript object>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"print(\n",
" f\"Train Accuracy : {train_acc}\\nTest Accuracy : {test_acc}\\nValidation Accuracy : {validation_acc}\"\n",
")"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Single Image Prediction"
]
},
{
"cell_type": "code",
"execution_count": 9,
"metadata": {},
"outputs": [
{
"ename": "NameError",
"evalue": "name 'dataset' is not defined",
"output_type": "error",
"traceback": [
"\u001b[1;31m---------------------------------------------------------------------------\u001b[0m",
"\u001b[1;31mNameError\u001b[0m Traceback (most recent call last)",
"\u001b[1;32m<ipython-input-9-0e3bd74576a2>\u001b[0m in \u001b[0;36m<module>\u001b[1;34m\u001b[0m\n\u001b[1;32m----> 1\u001b[1;33m \u001b[0mtransform_index_to_disease\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mdataset\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mclass_to_idx\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m",
"\u001b[1;31mNameError\u001b[0m: name 'dataset' is not defined"
]
},
{
"data": {
"application/javascript": "\n setTimeout(function() {\n var nbb_cell_id = 9;\n var nbb_unformatted_code = \"transform_index_to_disease = dataset.class_to_idx\";\n var nbb_formatted_code = \"transform_index_to_disease = dataset.class_to_idx\";\n var nbb_cells = Jupyter.notebook.get_cells();\n for (var i = 0; i < nbb_cells.length; ++i) {\n if (nbb_cells[i].input_prompt_number == nbb_cell_id) {\n if (nbb_cells[i].get_text() == nbb_unformatted_code) {\n nbb_cells[i].set_text(nbb_formatted_code);\n }\n break;\n }\n }\n }, 500);\n ",
"text/plain": [
"<IPython.core.display.Javascript object>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"transform_index_to_disease = dataset.class_to_idx"
]
},
{
"cell_type": "code",
"execution_count": 10,
"metadata": {},
"outputs": [
{
"ename": "NameError",
"evalue": "name 'transform_index_to_disease' is not defined",
"output_type": "error",
"traceback": [
"\u001b[1;31m---------------------------------------------------------------------------\u001b[0m",
"\u001b[1;31mNameError\u001b[0m Traceback (most recent call last)",
"\u001b[1;32m<ipython-input-10-1fe109ff4fe8>\u001b[0m in \u001b[0;36m<module>\u001b[1;34m\u001b[0m\n\u001b[0;32m 1\u001b[0m transform_index_to_disease = dict(\n\u001b[1;32m----> 2\u001b[1;33m \u001b[1;33m[\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mvalue\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mkey\u001b[0m\u001b[1;33m)\u001b[0m \u001b[1;32mfor\u001b[0m \u001b[0mkey\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mvalue\u001b[0m \u001b[1;32min\u001b[0m \u001b[0mtransform_index_to_disease\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mitems\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m]\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m 3\u001b[0m ) # reverse the index\n",
"\u001b[1;31mNameError\u001b[0m: name 'transform_index_to_disease' is not defined"
]
},
{
"data": {
"application/javascript": "\n setTimeout(function() {\n var nbb_cell_id = 10;\n var nbb_unformatted_code = \"transform_index_to_disease = dict(\\n [(value, key) for key, value in transform_index_to_disease.items()]\\n) # reverse the index\";\n var nbb_formatted_code = \"transform_index_to_disease = dict(\\n [(value, key) for key, value in transform_index_to_disease.items()]\\n) # reverse the index\";\n var nbb_cells = Jupyter.notebook.get_cells();\n for (var i = 0; i < nbb_cells.length; ++i) {\n if (nbb_cells[i].input_prompt_number == nbb_cell_id) {\n if (nbb_cells[i].get_text() == nbb_unformatted_code) {\n nbb_cells[i].set_text(nbb_formatted_code);\n }\n break;\n }\n }\n }, 500);\n ",
"text/plain": [
"<IPython.core.display.Javascript object>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"transform_index_to_disease = dict(\n",
" [(value, key) for key, value in transform_index_to_disease.items()]\n",
") # reverse the index"
]
},
{
"cell_type": "code",
"execution_count": 6,
"metadata": {},
"outputs": [],
"source": [
"data = pd.read_csv(\"disease_info.csv\", encoding=\"cp1252\")"
]
},
{
"cell_type": "code",
"execution_count": 7,
"metadata": {},
"outputs": [],
"source": [
"from PIL import Image\n",
"import torchvision.transforms.functional as TF"
]
},
{
"cell_type": "code",
"execution_count": 8,
"metadata": {},
"outputs": [],
"source": [
"def single_prediction(image_path):\n",
" image = Image.open(image_path)\n",
" image = image.resize((224, 224))\n",
" input_data = TF.to_tensor(image)\n",
" input_data = input_data.view((-1, 3, 224, 224))\n",
" output = model(input_data)\n",
" output = output.detach().numpy()\n",
" index = np.argmax(output)\n",
" print(\"Original : \", image_path[12:-4])\n",
" pred_csv = data[\"disease_name\"][index]\n",
" print(pred_csv)"
]
},
{
"cell_type": "code",
"execution_count": 53,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Original : Apple_ceder_apple_rust\n",
"Apple : Cedar rust\n"
]
}
],
"source": [
"single_prediction(\"test_images/Apple_ceder_apple_rust.JPG\")"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Wrong Prediction"
]
},
{
"cell_type": "code",
"execution_count": 10,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Original : Apple_scab\n",
"Tomato : Septoria Leaf Spot\n"
]
}
],
"source": [
"single_prediction(\"test_images/Apple_scab.JPG\")"
]
},
{
"cell_type": "code",
"execution_count": 11,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Original : Grape_esca\n",
"Grape : Esca | Black Measles\n"
]
}
],
"source": [
"single_prediction(\"test_images/Grape_esca.JPG\")"
]
},
{
"cell_type": "code",
"execution_count": 12,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Original : apple_black_rot\n",
"Pepper bell : Healthy\n"
]
}
],
"source": [
"single_prediction(\"test_images/apple_black_rot.JPG\")"
]
},
{
"cell_type": "code",
"execution_count": 13,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Original : apple_healthy\n",
"Apple : Healthy\n"
]
}
],
"source": [
"single_prediction(\"test_images/apple_healthy.JPG\")"
]
},
{
"cell_type": "code",
"execution_count": 14,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Original : background_without_leaves\n",
"Background Without Leaves\n"
]
}
],
"source": [
"single_prediction(\"test_images/background_without_leaves.jpg\")"
]
},
{
"cell_type": "code",
"execution_count": 15,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Original : blueberry_healthy\n",
"Blueberry : Healthy\n"
]
}
],
"source": [
"single_prediction(\"test_images/blueberry_healthy.JPG\")"
]
},
{
"cell_type": "code",
"execution_count": 16,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Original : cherry_healthy\n",
"Cherry : Healthy\n"
]
}
],
"source": [
"single_prediction(\"test_images/cherry_healthy.JPG\")"
]
},
{
"cell_type": "code",
"execution_count": 17,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Original : cherry_powdery_mildew\n",
"Cherry : Powdery Mildew\n"
]
}
],
"source": [
"single_prediction(\"test_images/cherry_powdery_mildew.JPG\")"
]
},
{
"cell_type": "code",
"execution_count": 18,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Original : corn_cercospora_leaf\n",
"Corn : Cercospora Leaf Spot | Gray Leaf Spot\n"
]
}
],
"source": [
"single_prediction(\"test_images/corn_cercospora_leaf.JPG\")"
]
},
{
"cell_type": "code",
"execution_count": 19,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Original : corn_common_rust\n",
"Corn : Common Rust\n"
]
}
],
"source": [
"single_prediction(\"test_images/corn_common_rust.JPG\")"
]
},
{
"cell_type": "code",
"execution_count": 20,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Original : corn_healthy\n",
"Corn : Healthy\n"
]
}
],
"source": [
"single_prediction(\"test_images/corn_healthy.jpg\")"
]
},
{
"cell_type": "code",
"execution_count": 21,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Original : corn_northen_leaf_blight\n",
"Corn : Northern Leaf Blight\n"
]
}
],
"source": [
"single_prediction(\"test_images/corn_northen_leaf_blight.JPG\")"
]
},
{
"cell_type": "code",
"execution_count": 22,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Original : grape_black_rot\n",
"Grape : Black Rot\n"
]
}
],
"source": [
"single_prediction(\"test_images/grape_black_rot.JPG\")"
]
},
{
"cell_type": "code",
"execution_count": 23,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Original : grape_healthy\n",
"Grape : Healthy\n"
]
}
],
"source": [
"single_prediction(\"test_images/grape_healthy.JPG\")"
]
},
{
"cell_type": "code",
"execution_count": 24,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Original : grape_leaf_blight\n",
"Grape : Leaf Blight | Isariopsis Leaf Spot\n"
]
}
],
"source": [
"single_prediction(\"test_images/grape_leaf_blight.JPG\")"
]
},
{
"cell_type": "code",
"execution_count": 25,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Original : orange_haunglongbing\n",
"Orange : Haunglongbing | Citrus Greening\n"
]
}
],
"source": [
"single_prediction(\"test_images/orange_haunglongbing.JPG\")"
]
},
{
"cell_type": "code",
"execution_count": 26,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Original : peach_bacterial_spot\n",
"Peach : Bacterial Spot\n"
]
}
],
"source": [
"single_prediction(\"test_images/peach_bacterial_spot.JPG\")"
]
},
{
"cell_type": "code",
"execution_count": 27,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Original : peach_healthy\n",
"Peach : Healthy\n"
]
}
],
"source": [
"single_prediction(\"test_images/peach_healthy.JPG\")"
]
},
{
"cell_type": "code",
"execution_count": 28,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Original : pepper_bacterial_spot\n",
"Pepper bell : Healthy\n"
]
}
],
"source": [
"single_prediction(\"test_images/pepper_bacterial_spot.JPG\")"
]
},
{
"cell_type": "code",
"execution_count": 29,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Original : pepper_bell_healthy\n",
"Pepper bell : Healthy\n"
]
}
],
"source": [
"single_prediction(\"test_images/pepper_bell_healthy.JPG\")"
]
},
{
"cell_type": "code",
"execution_count": 30,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Original : potato_early_blight\n",
"Potato : Early Blight\n"
]
}
],
"source": [
"single_prediction(\"test_images/potato_early_blight.JPG\")"
]
},
{
"cell_type": "code",
"execution_count": 31,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Original : potato_healthy\n",
"Potato : Healthy\n"
]
}
],
"source": [
"single_prediction(\"test_images/potato_healthy.JPG\")"
]
},
{
"cell_type": "code",
"execution_count": 32,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Original : potato_late_blight\n",
"Potato : Late Blight\n"
]
}
],
"source": [
"single_prediction(\"test_images/potato_late_blight.JPG\")"
]
},
{
"cell_type": "code",
"execution_count": 33,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Original : raspberry_healthy\n",
"Raspberry : Healthy\n"
]
}
],
"source": [
"single_prediction(\"test_images/raspberry_healthy.JPG\")"
]
},
{
"cell_type": "code",
"execution_count": 34,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Original : soyaben healthy\n",
"Soybean : Healthy\n"
]
}
],
"source": [
"single_prediction(\"test_images/soyaben healthy.JPG\")"
]
},
{
"cell_type": "code",
"execution_count": 35,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Original : potato_late_blight\n",
"Potato : Late Blight\n"
]
}
],
"source": [
"single_prediction(\"test_images/potato_late_blight.JPG\")"
]
},
{
"cell_type": "code",
"execution_count": 36,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Original : squash_powdery_mildew\n",
"Squash : Powdery Mildew\n"
]
}
],
"source": [
"single_prediction(\"test_images/squash_powdery_mildew.JPG\")"
]
},
{
"cell_type": "code",
"execution_count": 37,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Original : starwberry_healthy\n",
"Strawberry : Healthy\n"
]
}
],
"source": [
"single_prediction(\"test_images/starwberry_healthy.JPG\")"
]
},
{
"cell_type": "code",
"execution_count": 38,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Original : starwberry_leaf_scorch\n",
"Strawberry : Leaf Scorch\n"
]
}
],
"source": [
"single_prediction(\"test_images/starwberry_leaf_scorch.JPG\")"
]
},
{
"cell_type": "code",
"execution_count": 39,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Original : tomato_bacterial_spot\n",
"Tomato : Early Blight\n"
]
}
],
"source": [
"single_prediction(\"test_images/tomato_bacterial_spot.JPG\")"
]
},
{
"cell_type": "code",
"execution_count": 40,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Original : tomato_early_blight\n",
"Tomato : Early Blight\n"
]
}
],
"source": [
"single_prediction(\"test_images/tomato_early_blight.JPG\")"
]
},
{
"cell_type": "code",
"execution_count": 41,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Original : tomato_healthy\n",
"Tomato : Healthy\n"
]
}
],
"source": [
"single_prediction(\"test_images/tomato_healthy.JPG\")"
]
},
{
"cell_type": "code",
"execution_count": 42,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Original : tomato_late_blight\n",
"Tomato : Late Blight\n"
]
}
],
"source": [
"single_prediction(\"test_images/tomato_late_blight.JPG\")"
]
},
{
"cell_type": "code",
"execution_count": 43,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Original : tomato_leaf_mold\n",
"Tomato : Leaf Mold\n"
]
}
],
"source": [
"single_prediction(\"test_images/tomato_leaf_mold.JPG\")"
]
},
{
"cell_type": "code",
"execution_count": 44,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Original : tomato_mosaic_virus\n",
"Tomato : Mosaic Virus\n"
]
}
],
"source": [
"single_prediction(\"test_images/tomato_mosaic_virus.JPG\")"
]
},
{
"cell_type": "code",
"execution_count": 45,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Original : tomato_septoria_leaf_spot\n",
"Tomato : Septoria Leaf Spot\n"
]
}
],
"source": [
"single_prediction(\"test_images/tomato_septoria_leaf_spot.JPG\")"
]
},
{
"cell_type": "code",
"execution_count": 46,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Original : tomato_spider_mites_two_spotted_spider_mites\n",
"Tomato : Spider Mites | Two-Spotted Spider Mite\n"
]
}
],
"source": [
"single_prediction(\"test_images/tomato_spider_mites_two_spotted_spider_mites.JPG\")"
]
},
{
"cell_type": "code",
"execution_count": 47,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Original : tomato_target_spot\n",
"Tomato : Target Spot\n"
]
}
],
"source": [
"single_prediction(\"test_images/tomato_target_spot.JPG\")"
]
},
{
"cell_type": "code",
"execution_count": 48,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Original : tomato_yellow_leaf_curl_virus\n",
"Tomato : Yellow Leaf Curl Virus\n"
]
}
],
"source": [
"single_prediction(\"test_images/tomato_yellow_leaf_curl_virus.JPG\")"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.8.5"
},
"varInspector": {
"cols": {
"lenName": 16,
"lenType": 16,
"lenVar": 40
},
"kernels_config": {
"python": {
"delete_cmd_postfix": "",
"delete_cmd_prefix": "del ",
"library": "var_list.py",
"varRefreshCmd": "print(var_dic_list())"
},
"r": {
"delete_cmd_postfix": ") ",
"delete_cmd_prefix": "rm(",
"library": "var_list.r",
"varRefreshCmd": "cat(var_dic_list()) "
}
},
"types_to_exclude": [
"module",
"function",
"builtin_function_or_method",
"instance",
"_Feature"
],
"window_display": false
}
},
"nbformat": 4,
"nbformat_minor": 4
}
================================================
FILE: Model/Plant Disease Detection Code.md
================================================
### Import Dependencies
```python
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
```
```python
import torch
from torchvision import datasets, transforms, models # datsets , transforms
from torch.utils.data.sampler import SubsetRandomSampler
import torch.nn as nn
import torch.nn.functional as F
from datetime import datetime
```
```python
%load_ext nb_black
```
<IPython.core.display.Javascript object>
### Import Dataset
<b> Dataset Link (Plant Vliiage Dataset ):</b><br> <a href='https://data.mendeley.com/datasets/tywbtsjrjv/1'> https://data.mendeley.com/datasets/tywbtsjrjv/1 </a>
```python
transform = transforms.Compose(
[transforms.Resize(255), transforms.CenterCrop(224), transforms.ToTensor()]
)
```
<IPython.core.display.Javascript object>
```python
dataset = datasets.ImageFolder("Dataset", transform=transform)
```
<IPython.core.display.Javascript object>
```python
dataset
```
Dataset ImageFolder
Number of datapoints: 61486
Root Location: Dataset
Transforms (if any): Compose(
Resize(size=255, interpolation=PIL.Image.BILINEAR)
CenterCrop(size=(224, 224))
ToTensor()
)
Target Transforms (if any): None
<IPython.core.display.Javascript object>
```python
indices = list(range(len(dataset)))
```
<IPython.core.display.Javascript object>
```python
split = int(np.floor(0.85 * len(dataset))) # train_size
```
<IPython.core.display.Javascript object>
```python
validation = int(np.floor(0.70 * split)) # validation
```
<IPython.core.display.Javascript object>
```python
print(0, validation, split, len(dataset))
```
0 36584 52263 61486
<IPython.core.display.Javascript object>
```python
print(f"length of train size :{validation}")
print(f"length of validation size :{split - validation}")
print(f"length of test size :{len(dataset)-validation}")
```
length of train size :36584
length of validation size :15679
length of test size :24902
<IPython.core.display.Javascript object>
```python
np.random.shuffle(indices)
```
<IPython.core.display.Javascript object>
### Split into Train and Test
```python
train_indices, validation_indices, test_indices = (
indices[:validation],
indices[validation:split],
indices[split:],
)
```
<IPython.core.display.Javascript object>
```python
train_sampler = SubsetRandomSampler(train_indices)
validation_sampler = SubsetRandomSampler(validation_indices)
test_sampler = SubsetRandomSampler(test_indices)
```
<IPython.core.display.Javascript object>
```python
targets_size = len(dataset.class_to_idx)
```
<IPython.core.display.Javascript object>
### Model
<b>Convolution Aithmetic Equation : </b>(W - F + 2P) / S + 1 <br>
W = Input Size<br>
F = Filter Size<br>
P = Padding Size<br>
S = Stride <br>
### Transfer Learning
```python
# model = models.vgg16(pretrained=True)
```
```python
# for params in model.parameters():
# params.requires_grad = False
```
```python
# model
```
```python
# n_features = model.classifier[0].in_features
# n_features
```
```python
# model.classifier = nn.Sequential(
# nn.Linear(n_features, 1024),
# nn.ReLU(),
# nn.Dropout(0.4),
# nn.Linear(1024, targets_size),
# )
```
```python
# model
```
### Original Modeling
```python
class CNN(nn.Module):
def __init__(self, K):
super(CNN, self).__init__()
self.conv_layers = nn.Sequential(
# conv1
nn.Conv2d(in_channels=3, out_channels=32, kernel_size=3, padding=1),
nn.ReLU(),
nn.BatchNorm2d(32),
nn.Conv2d(in_channels=32, out_channels=32, kernel_size=3, padding=1),
nn.ReLU(),
nn.BatchNorm2d(32),
nn.MaxPool2d(2),
# conv2
nn.Conv2d(in_channels=32, out_channels=64, kernel_size=3, padding=1),
nn.ReLU(),
nn.BatchNorm2d(64),
nn.Conv2d(in_channels=64, out_channels=64, kernel_size=3, padding=1),
nn.ReLU(),
nn.BatchNorm2d(64),
nn.MaxPool2d(2),
# conv3
nn.Conv2d(in_channels=64, out_channels=128, kernel_size=3, padding=1),
nn.ReLU(),
nn.BatchNorm2d(128),
nn.Conv2d(in_channels=128, out_channels=128, kernel_size=3, padding=1),
nn.ReLU(),
nn.BatchNorm2d(128),
nn.MaxPool2d(2),
# conv4
nn.Conv2d(in_channels=128, out_channels=256, kernel_size=3, padding=1),
nn.ReLU(),
nn.BatchNorm2d(256),
nn.Conv2d(in_channels=256, out_channels=256, kernel_size=3, padding=1),
nn.ReLU(),
nn.BatchNorm2d(256),
nn.MaxPool2d(2),
)
self.dense_layers = nn.Sequential(
nn.Dropout(0.4),
nn.Linear(50176, 1024),
nn.ReLU(),
nn.Dropout(0.4),
nn.Linear(1024, K),
)
def forward(self, X):
out = self.conv_layers(X)
# Flatten
out = out.view(-1, 50176)
# Fully connected
out = self.dense_layers(out)
return out
```
<IPython.core.display.Javascript object>
```python
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
print(device)
```
cpu
<IPython.core.display.Javascript object>
```python
device = "cpu"
```
<IPython.core.display.Javascript object>
```python
model = CNN(targets_size)
```
<IPython.core.display.Javascript object>
```python
model.to(device)
```
CNN(
(conv_layers): Sequential(
(0): Conv2d(3, 32, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1))
(1): ReLU()
(2): BatchNorm2d(32, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
(3): Conv2d(32, 32, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1))
(4): ReLU()
(5): BatchNorm2d(32, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
(6): MaxPool2d(kernel_size=2, stride=2, padding=0, dilation=1, ceil_mode=False)
(7): Conv2d(32, 64, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1))
(8): ReLU()
(9): BatchNorm2d(64, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
(10): Conv2d(64, 64, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1))
(11): ReLU()
(12): BatchNorm2d(64, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
(13): MaxPool2d(kernel_size=2, stride=2, padding=0, dilation=1, ceil_mode=False)
(14): Conv2d(64, 128, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1))
(15): ReLU()
(16): BatchNorm2d(128, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
(17): Conv2d(128, 128, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1))
(18): ReLU()
(19): BatchNorm2d(128, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
(20): MaxPool2d(kernel_size=2, stride=2, padding=0, dilation=1, ceil_mode=False)
(21): Conv2d(128, 256, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1))
(22): ReLU()
(23): BatchNorm2d(256, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
(24): Conv2d(256, 256, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1))
(25): ReLU()
(26): BatchNorm2d(256, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
(27): MaxPool2d(kernel_size=2, stride=2, padding=0, dilation=1, ceil_mode=False)
)
(dense_layers): Sequential(
(0): Dropout(p=0.4, inplace=False)
(1): Linear(in_features=50176, out_features=1024, bias=True)
(2): ReLU()
(3): Dropout(p=0.4, inplace=False)
(4): Linear(in_features=1024, out_features=39, bias=True)
)
)
<IPython.core.display.Javascript object>
```python
from torchsummary import summary
summary(model, (3, 224, 224))
```
----------------------------------------------------------------
Layer (type) Output Shape Param #
================================================================
Conv2d-1 [-1, 32, 224, 224] 896
ReLU-2 [-1, 32, 224, 224] 0
BatchNorm2d-3 [-1, 32, 224, 224] 64
Conv2d-4 [-1, 32, 224, 224] 9,248
ReLU-5 [-1, 32, 224, 224] 0
BatchNorm2d-6 [-1, 32, 224, 224] 64
MaxPool2d-7 [-1, 32, 112, 112] 0
Conv2d-8 [-1, 64, 112, 112] 18,496
ReLU-9 [-1, 64, 112, 112] 0
BatchNorm2d-10 [-1, 64, 112, 112] 128
Conv2d-11 [-1, 64, 112, 112] 36,928
ReLU-12 [-1, 64, 112, 112] 0
BatchNorm2d-13 [-1, 64, 112, 112] 128
MaxPool2d-14 [-1, 64, 56, 56] 0
Conv2d-15 [-1, 128, 56, 56] 73,856
ReLU-16 [-1, 128, 56, 56] 0
BatchNorm2d-17 [-1, 128, 56, 56] 256
Conv2d-18 [-1, 128, 56, 56] 147,584
ReLU-19 [-1, 128, 56, 56] 0
BatchNorm2d-20 [-1, 128, 56, 56] 256
MaxPool2d-21 [-1, 128, 28, 28] 0
Conv2d-22 [-1, 256, 28, 28] 295,168
ReLU-23 [-1, 256, 28, 28] 0
BatchNorm2d-24 [-1, 256, 28, 28] 512
Conv2d-25 [-1, 256, 28, 28] 590,080
ReLU-26 [-1, 256, 28, 28] 0
BatchNorm2d-27 [-1, 256, 28, 28] 512
MaxPool2d-28 [-1, 256, 14, 14] 0
Dropout-29 [-1, 50176] 0
Linear-30 [-1, 1024] 51,381,248
ReLU-31 [-1, 1024] 0
Dropout-32 [-1, 1024] 0
Linear-33 [-1, 39] 39,975
================================================================
Total params: 52,595,399
Trainable params: 52,595,399
Non-trainable params: 0
----------------------------------------------------------------
Input size (MB): 0.57
Forward/backward pass size (MB): 143.96
Params size (MB): 200.64
Estimated Total Size (MB): 345.17
----------------------------------------------------------------
<IPython.core.display.Javascript object>
```python
criterion = nn.CrossEntropyLoss() # this include softmax + cross entropy loss
optimizer = torch.optim.Adam(model.parameters())
```
<IPython.core.display.Javascript object>
### Batch Gradient Descent
```python
def batch_gd(model, criterion, train_loader, test_laoder, epochs):
train_losses = np.zeros(epochs)
test_losses = np.zeros(epochs)
for e in range(epochs):
t0 = datetime.now()
train_loss = []
for inputs, targets in train_loader:
inputs, targets = inputs.to(device), targets.to(device)
optimizer.zero_grad()
output = model(inputs)
loss = criterion(output, targets)
train_loss.append(loss.item()) # torch to numpy world
loss.backward()
optimizer.step()
train_loss = np.mean(train_loss)
validation_loss = []
for inputs, targets in validation_loader:
inputs, targets = inputs.to(device), targets.to(device)
output = model(inputs)
loss = criterion(output, targets)
validation_loss.append(loss.item()) # torch to numpy world
validation_loss = np.mean(validation_loss)
train_losses[e] = train_loss
validation_losses[e] = validation_loss
dt = datetime.now() - t0
print(
f"Epoch : {e+1}/{epochs} Train_loss:{train_loss:.3f} Test_loss:{validation_loss:.3f} Duration:{dt}"
)
return train_losses, validation_losses
```
<IPython.core.display.Javascript object>
```python
device = "cpu"
```
<IPython.core.display.Javascript object>
```python
batch_size = 64
train_loader = torch.utils.data.DataLoader(
dataset, batch_size=batch_size, sampler=train_sampler
)
test_loader = torch.utils.data.DataLoader(
dataset, batch_size=batch_size, sampler=test_sampler
)
validation_loader = torch.utils.data.DataLoader(
dataset, batch_size=batch_size, sampler=validation_sampler
)
```
<IPython.core.display.Javascript object>
```python
train_losses, validation_losses = batch_gd(
model, criterion, train_loader, validation_loader, 5
)
```
<IPython.core.display.Javascript object>
### Save the Model
```python
# torch.save(model.state_dict() , 'plant_disease_model_1.pt')
```
<IPython.core.display.Javascript object>
### Load Model
```python
targets_size = 39
model = CNN(targets_size)
model.load_state_dict(torch.load("plant_disease_model_1_latest.pt"))
model.eval()
```
CNN(
(conv_layers): Sequential(
(0): Conv2d(3, 32, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1))
(1): ReLU()
(2): BatchNorm2d(32, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
(3): Conv2d(32, 32, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1))
(4): ReLU()
(5): BatchNorm2d(32, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
(6): MaxPool2d(kernel_size=2, stride=2, padding=0, dilation=1, ceil_mode=False)
(7): Conv2d(32, 64, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1))
(8): ReLU()
(9): BatchNorm2d(64, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
(10): Conv2d(64, 64, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1))
(11): ReLU()
(12): BatchNorm2d(64, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
(13): MaxPool2d(kernel_size=2, stride=2, padding=0, dilation=1, ceil_mode=False)
(14): Conv2d(64, 128, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1))
(15): ReLU()
(16): BatchNorm2d(128, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
(17): Conv2d(128, 128, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1))
(18): ReLU()
(19): BatchNorm2d(128, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
(20): MaxPool2d(kernel_size=2, stride=2, padding=0, dilation=1, ceil_mode=False)
(21): Conv2d(128, 256, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1))
(22): ReLU()
(23): BatchNorm2d(256, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
(24): Conv2d(256, 256, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1))
(25): ReLU()
(26): BatchNorm2d(256, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
(27): MaxPool2d(kernel_size=2, stride=2, padding=0, dilation=1, ceil_mode=False)
)
(dense_layers): Sequential(
(0): Dropout(p=0.4, inplace=False)
(1): Linear(in_features=50176, out_features=1024, bias=True)
(2): ReLU()
(3): Dropout(p=0.4, inplace=False)
(4): Linear(in_features=1024, out_features=39, bias=True)
)
)
```python
# %matplotlib notebook
```
### Plot the loss
```python
plt.plot(train_losses , label = 'train_loss')
plt.plot(validation_losses , label = 'validation_loss')
plt.xlabel('No of Epochs')
plt.ylabel('Loss')
plt.legend()
plt.show()
```
### Accuracy
```python
def accuracy(loader):
n_correct = 0
n_total = 0
for inputs, targets in loader:
inputs, targets = inputs.to(device), targets.to(device)
outputs = model(inputs)
_, predictions = torch.max(outputs, 1)
n_correct += (predictions == targets).sum().item()
n_total += targets.shape[0]
acc = n_correct / n_total
return acc
```
<IPython.core.display.Javascript object>
```python
train_acc = accuracy(train_loader)
test_acc = accuracy(test_loader)
validation_acc = accuracy(validation_loader)
```
```python
print(
f"Train Accuracy : {train_acc}\nTest Accuracy : {test_acc}\nValidation Accuracy : {validation_acc}"
)
```
Train Accurac
gitextract_w46t93c5/
├── Flask Deployed App/
│ ├── CNN.py
│ ├── Procfile
│ ├── Readme.md
│ ├── app.py
│ ├── disease_info.csv
│ ├── requirements.txt
│ ├── static/
│ │ └── uploads/
│ │ └── Readme.md
│ ├── supplement_info.csv
│ └── templates/
│ ├── base.html
│ ├── contact-us.html
│ ├── home.html
│ ├── index.html
│ ├── market.html
│ └── submit.html
├── Model/
│ ├── Plant Disease Detection Code.ipynb
│ ├── Plant Disease Detection Code.md
│ └── Readme.md
├── README.md
├── demo_images/
│ └── Readme.md
└── test_images/
└── Readme.md
SYMBOL INDEX (10 symbols across 2 files)
FILE: Flask Deployed App/CNN.py
class CNN (line 4) | class CNN(nn.Module):
method __init__ (line 5) | def __init__(self, K):
method forward (line 58) | def forward(self, X):
FILE: Flask Deployed App/app.py
function prediction (line 18) | def prediction(image_path):
function home_page (line 32) | def home_page():
function contact (line 36) | def contact():
function ai_engine_page (line 40) | def ai_engine_page():
function mobile_device_detected_page (line 44) | def mobile_device_detected_page():
function submit (line 48) | def submit():
function market (line 67) | def market():
Condensed preview — 20 files, each showing path, character count, and a content snippet. Download the .json file or copy for the full structured content (222K chars).
[
{
"path": "Flask Deployed App/CNN.py",
"chars": 4077,
"preview": "import pandas as pd\r\nimport torch.nn as nn\r\n\r\nclass CNN(nn.Module):\r\n def __init__(self, K):\r\n super(CNN, self"
},
{
"path": "Flask Deployed App/Procfile",
"chars": 21,
"preview": "web: gunicorn app:app"
},
{
"path": "Flask Deployed App/Readme.md",
"chars": 794,
"preview": "# 🌟Make Sure You Read all Instructions :\n\n##### This code is fully funcional web app which is already deployed in heroku"
},
{
"path": "Flask Deployed App/app.py",
"chars": 2601,
"preview": "import os\r\nfrom flask import Flask, redirect, render_template, request\r\nfrom PIL import Image\r\nimport torchvision.transf"
},
{
"path": "Flask Deployed App/disease_info.csv",
"chars": 46662,
"preview": "index,disease_name,description,Possible Steps,image_url\r\n0,Apple : Scab,\"Apple scab is the most common disease of apple "
},
{
"path": "Flask Deployed App/static/uploads/Readme.md",
"chars": 154,
"preview": "\n#### Why this folder ?\nAt the Runtime what ever local image will test that are saved in this folder and use this folder"
},
{
"path": "Flask Deployed App/supplement_info.csv",
"chars": 14132,
"preview": "index,disease_name,supplement name,supplement image,buy link\r\n0,Apple___Apple_scab,Katyayani Prozol Propiconazole 25% EC"
},
{
"path": "Flask Deployed App/templates/base.html",
"chars": 6784,
"preview": "<!doctype html>\r\n<html lang=\"en\">\r\n\r\n<head>\r\n <!-- Required meta tags -->\r\n <meta charset=\"utf-8\">\r\n <meta name"
},
{
"path": "Flask Deployed App/templates/contact-us.html",
"chars": 3654,
"preview": "{% extends 'base.html' %}\r\n{% block pagetitle %}\r\nContact Us\r\n{% endblock pagetitle %}\r\n\r\n{% block body %}\r\n\r\n<div class"
},
{
"path": "Flask Deployed App/templates/home.html",
"chars": 7191,
"preview": "{% extends 'base.html' %}\r\n{% block pagetitle %}\r\nPlant Disease Detection\r\n{% endblock pagetitle %}\r\n{% block body %}\r\n<"
},
{
"path": "Flask Deployed App/templates/index.html",
"chars": 10524,
"preview": "<html>\r\n{% extends 'base.html' %}\r\n{% block pagetitle %}\r\nAI Engine\r\n{% endblock pagetitle %}\r\n\r\n{% block body %}\r\n<div>"
},
{
"path": "Flask Deployed App/templates/market.html",
"chars": 1569,
"preview": "{% extends 'base.html' %}\r\n{% block pagetitle %}\r\nSupplement Market\r\n{% endblock pagetitle %}\r\n\r\n{% block body %}\r\n\r\n<br"
},
{
"path": "Flask Deployed App/templates/submit.html",
"chars": 2804,
"preview": "{% extends 'base.html' %}\r\n{% block pagetitle %}\r\n{{title}}\r\n{% endblock pagetitle %}\r\n{% block body %}\r\n\r\n<div>\r\n <div"
},
{
"path": "Model/Plant Disease Detection Code.ipynb",
"chars": 80058,
"preview": "{\n \"cells\": [\n {\n \"cell_type\": \"markdown\",\n \"metadata\": {},\n \"source\": [\n \"### Import Dependencies\"\n ]\n },\n"
},
{
"path": "Model/Plant Disease Detection Code.md",
"chars": 24336,
"preview": "### Import Dependencies\n\n\n```python\nimport numpy as np\nimport pandas as pd\nimport matplotlib.pyplot as plt\n```\n\n\n```pyth"
},
{
"path": "Model/Readme.md",
"chars": 596,
"preview": "# 🌟Model Architecture :\n<center><img src =\"model.JPG\"></center>\n\n## 🌟NOTE :-\n* If pdf or ipython notebook will not load "
},
{
"path": "README.md",
"chars": 2663,
"preview": "# ⭐Plant-Disease-Detection\n* Plant Disease is necessary for every farmer so we are created Plant disease detection using"
},
{
"path": "demo_images/Readme.md",
"chars": 1,
"preview": "\n"
},
{
"path": "test_images/Readme.md",
"chars": 1,
"preview": "\n"
}
]
// ... and 1 more files (download for full content)
About this extraction
This page contains the full source code of the manthan89-py/Plant-Disease-Detection GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 20 files (203.7 KB), approximately 56.5k tokens, and a symbol index with 10 extracted functions, classes, methods, constants, and types. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.
Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.