Using Open CV to detect greenhouse crop detection & infestation

Jeffin, If I thought that was necessary, I would have advised you to go that route. Deep learning / CNNs have a rather steep learning curve, and most apps require a lot of training data. On top of that, you’ve got to make sure that the CNN’s notion of features is the same as yours. Your images are not distinct, like elephant vs giraffe, and they are rather amorphous. So there won’t be as much for a CNN to work with feature-wise. And it’s a black box. If it fails, it’s often very difficult to tell why.

And finally: The process you’re referring to is called ‘segmentation’. There are two primary forms of segmentation in deep learning: Semantic segmentation, and Instance segmentation. The notable example of the latter is called “Mask RCNN”. Guess what it requires for training images? It needs a copy of your main images with all the background pixels blacked out. That’s the ‘mask’ part. So you’re back to the process that I suggested anyway.

Having said all of that, I don’t want to discourage you. If you’ve got time, then try it. The two books that I’d recommend are “Hands on Machine Learing” by Aurelien Geron, ISBN 1492032646. And " Deep Learning with Python" by Francois Chollet, the author of the Keras library for Tensorflow. (Check Manning.com for news on the 2nd edition). PyTorch is also cool. You’ll find info on Mask RCNN for either platform.

Once your model is trained and working under Keras/Tensorflow or PyTorch, you could save off a file with coefficients that can be loaded in OpenCV’s DNN module. But aside from that, you’ll probably need to follow up on a deep learning forum.

Good luck!