Using Open CV to detect greenhouse crop detection & infestation

Jeffin here, I’m new to Open CV. am building hardware system to detect greenhouse crop infestation using the help of Open CV. I tried some cascade and did some training the results are zero. What all the things i need do for better results ?
i trained with 24x24 ,40 Positive and 100 negative images. Any specific system configuration requirement needed to train? because i checked some samples some images taking so long to provide the results some images don’t come up with results the command prompt not responding to some images. Any tips that help me to improve my training. Thanks

unfortunately, this is somewhat expected.
training cascades on this is probably the wrong tool for your job, and you might need something more advanced

make it like 4000 positives …

but first, let’s find out what your constraints are:

that’ s far too vague ! do you have a single kind of crop, or many ? different kind of “pest” plants ? please show us some example images. and be more clear about it.

please also see this

these are some images

1 Like

a hardware device on top on greenhouse continuously monitoring crops , not single crops different crops and get alerts to the farmer

and what would be the exact output of your program ?

what should we see in those images ? are those the cropped positives ? (if so, what are the "negatives ?)

Hi @jeffingeorge

Based on this description, I think we can view this as a classification problem, and I believe deep learning is the way to the solution. See, training a cnn based classificator is not that hard, building the training dataset is.

You can start taking many hundred of photos with and without infestation, covering all the expected range (different places, different plagues, etc.). Keep in mind that with 100 photos you can fall short. @berak’s 4000 photos is a more realistic guess.

Once you got the photos you can train different networks, like resnet and many other, and see if the results fit you.

Also, you can see this as a detection problem, where not only want to tell if there is a plague, but to localize it on the image. You can use the same dataset, but need to annotate it, draw the boxes where they belong so the model can learn from they.

I believe that making the dataset is the hard part.

1 Like

This are negative images IMG-5345 — ImgBB
IMG-5889 — ImgBB

i do not see any difference betwen your positive and negative images, can you explain, what exactly you’re looking for ?

I’m new to Open CV and all, it would be great if you can suggestion a way to start, currently working on Open cv cascades, continue this or i need to find something better for my need


forget the cascades, as quick as you can. wrong tool
(those are for rigid things, not what you have)

check this image, top image is healthy plant and bottom one got infection so the leaf’s started to die ibb. co/42y6VGd`

so, it’s not about “other plants”, but about “healthy vs sick” ?

Yes. But also need to monitor different plant status like tomato etc

Hey, i got some ideas in Keras And Open CV, my queastion do i need to make prototext and caffe files or can i use already using ones ? or only i need to train the images

That’s the way. Pick a network and train it with your own images.
Look for samples on training with that particular network.
Learn how to make a dataset.

Hey, I’ve a question. Do i need remove the background things or i need to keep the background things for training like pipe(white color , blue sheet) like that. Please check above image for a reference

You must train on real images. If you always will have a blue background, then put it on training images. But if not, don’t do that on training images because you will confuse you machine.
The more scenarios you expect in the images you want to predict, the bigger and more varied your dataset must be.
That’s why it is common to train on hundred or thousand of images.

Just curious, jg: The colors of the dead leaves in your photos are distinct. So are the green leaves. What happens if you simply find ‘segments’ that contain primarily the brownish-gold chroma range that’s characteristic of the dead leaves. Then do the same for bright green leaves. Then compare area ratios.

If you can find the brown segments, etc, there are a lot of other tools at your disposal as well. OpenCV can easily get contours of those segments, so you can discard small ones as noise. Etc.

PS: A lot of the aerial mapping guys use texture mapping methods. You could search ‘GLCM’ (gray level co-occurrence matrix) or Haaralick to turn up some relevant work. If your cameras are more distant, this could be useful. You’d need to localize the areas that you want to texture-map.

I understand, so you saying no need deep learning and all ?