(venv) C:\Users\Isinsu\Desktop\crop\yolov4-custom-functions>python detect.py --weights ./checkpoints/yolov4-416 --size 416 --model yolov4 --images ./data/images/bobin1.jpg --info
Object found: bobin, Confidence: 0.99, BBox Coords (xmin, ymin, xmax, ymax): 178.0, 0.0, 1796.0, 1348.0
(venv) C:\Users\Isinsu\Desktop\crop\yolov4-custom-functions>python detect.py --weights ./checkpoints/yolov4-416 --size 416 --model yolov4 --images ./data/images/bobin1.jpg --crop
Traceback (most recent call last):
File "C:\Users\Isinsu\Desktop\crop\yolov4-custom-functions\detect.py", line 146, in <module>
app.run(main)
File "C:\Users\Isinsu\Desktop\crop\venv\lib\site-packages\absl\app.py", line 308, in run
_run_main(main, args)
File "C:\Users\Isinsu\Desktop\crop\venv\lib\site-packages\absl\app.py", line 254, in _run_main
sys.exit(main(argv))
File "C:\Users\Isinsu\Desktop\crop\yolov4-custom-functions\detect.py", line 121, in main
crop_objects(cv2.cvtColor(original_image, cv2.COLOR_BGR2RGB), pred_bbox, crop_path, allowed_classes)
File "C:\Users\Isinsu\Desktop\crop\yolov4-custom-functions\core\functions.py", line 57, in crop_objects
cv2.imwrite(img_path, cropped_img)
cv2.error: OpenCV(4.6.0) D:\a\opencv-python\opencv-python\opencv\modules\imgcodecs\src\loadsave.cpp:801: error: (-215:Assertion failed) !_img.empty() in function 'cv::imwrite'
It just happens when ymin is 0.0. Otherwise it works for pictures. btw it's not about path, I controlled that for many times. It reads the other pictures in the same directory but not this one. I tried with other pictures with cutting them and making their ymin=0 and then it gives the same error.
If ymin is 0.0, than it says:
It just happens when ymin is 0.0. Otherwise it works for pictures. btw it's not about path, I controlled that for many times. It reads the other pictures in the same directory but not this one. I tried with other pictures with cutting them and making their ymin=0 and then it gives the same error.