If you need to have a pure Python solution then the easiest way would be to clone the YOLOv5 repo and find a custom model that contains detection for cucumber seeds. Here's a walkthrough of YOLO and custom models
As to a custom model of cucumber seeds? You may have to create one yourself. Good luck.