Editing
AI in Agriculture
(section)
Jump to navigation
Jump to search
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
== <span style="color: #FFFFFF;">Applying</span> == '''Crop disease detection from leaf images:''' <syntaxhighlight lang="python"> import torch from torchvision import models, transforms from torchvision.datasets import ImageFolder from torch.utils.data import DataLoader import torch.nn as nn # Plant Village dataset: 38 classes (crop Γ disease combinations) transform = transforms.Compose([ transforms.Resize(256), transforms.CenterCrop(224), transforms.ToTensor(), transforms.Normalize([0.485, 0.456, 0.406], [0.229, 0.224, 0.225]) ]) dataset = ImageFolder("PlantVillage/", transform=transform) train_size = int(0.8 * len(dataset)) train_ds, val_ds = torch.utils.data.random_split(dataset, [train_size, len(dataset)-train_size]) train_dl = DataLoader(train_ds, batch_size=32, shuffle=True, num_workers=4) val_dl = DataLoader(val_ds, batch_size=32) # Fine-tune EfficientNet-B4 for disease classification model = models.efficientnet_b4(weights="IMAGENET1K_V1") model.classifier[1] = nn.Linear(model.classifier[1].in_features, len(dataset.classes)) model = model.cuda() optimizer = torch.optim.AdamW(model.parameters(), lr=1e-4) criterion = nn.CrossEntropyLoss() for epoch in range(10): model.train() for images, labels in train_dl: images, labels = images.cuda(), labels.cuda() loss = criterion(model(images), labels) optimizer.zero_grad(); loss.backward(); optimizer.step() </syntaxhighlight> ; AI agricultural applications : '''Disease detection''' β PlantVillage CNN, Plantix app (mobile) : '''Yield prediction''' β XGBoost on NDVI + weather; NASA Harvest platform : '''Irrigation''' β CropX, Hortau, Lindsay Zimmatic β soil sensor + AI : '''Drone scouting''' β DJI Agras, Sentera NDVI analysis, PrecisionHawk : '''Weed control''' β Carbon Robotics laser weeding robot (vision-guided) : '''Livestock''' β Cainthus (cattle face recognition), SCR (dairy cow sensors) </div> <div style="background-color: #8B4500; color: #FFFFFF; padding: 20px; border-radius: 8px; margin-bottom: 15px;">
Summary:
Please note that all contributions to BloomWiki may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see
BloomWiki:Copyrights
for details).
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Navigation menu
Personal tools
Not logged in
Talk
Contributions
Create account
Log in
Namespaces
Page
Discussion
English
Views
Read
Edit
View history
More
Search
Navigation
Main page
Recent changes
Random page
Help about MediaWiki
Tools
What links here
Related changes
Special pages
Page information