darkflow icon indicating copy to clipboard operation
darkflow copied to clipboard

Yolov2 error

Open Anubhavv opened this issue 7 years ago • 3 comments

I had trained my datasets for the code and it showed the following error : Code: import cv2 from darkflow.net.build import TFNet import matplotlib.pyplot as plt

options={ 'model':'cfg/tiny-yolo-voc-1c.cfg', 'load' : 1500, 'threshold':0.3 }

tfnet=TFNet(options)

img=cv2.imread('048.jpg',cv2.IMREAD_COLOR) img=cv2.cvtColor(img,cv2.COLOR_BGR2RGB) result=tfnet.return_predict(img) img.shape

tl=(result[0]['topleft']['x'], result[0]['topleft']['y']) br=(result[0]['bottomright']['x'], result[0]['bottomright']['y']) label=result['label'] confidence=result['confidence'] text = '{}: {:.0f}%'.format(label, confidence * 100)

img=cv2.rectangle(img,tl,br,(0,255,0),7) img=cv2.putText(img,label,tl,cv2.FONT_HERSHEY_COMPLEX,1,(0,0,0),2) plt.imshow(img) plt.show()

Result and Error: Parsing cfg/tiny-yolo-voc-1c.cfg Loading None ... Finished in 0.0s

Building net ... Source | Train? | Layer description | Output size -------+--------+----------------------------------+--------------- | | input | (?, 416, 416, 3) Init | Yep! | conv 3x3p1_1 +bnorm leaky | (?, 416, 416, 16) Load | Yep! | maxp 2x2p0_2 | (?, 208, 208, 16) Init | Yep! | conv 3x3p1_1 +bnorm leaky | (?, 208, 208, 32) Load | Yep! | maxp 2x2p0_2 | (?, 104, 104, 32) Init | Yep! | conv 3x3p1_1 +bnorm leaky | (?, 104, 104, 64) Load | Yep! | maxp 2x2p0_2 | (?, 52, 52, 64) Init | Yep! | conv 3x3p1_1 +bnorm leaky | (?, 52, 52, 128) Load | Yep! | maxp 2x2p0_2 | (?, 26, 26, 128) Init | Yep! | conv 3x3p1_1 +bnorm leaky | (?, 26, 26, 256) Load | Yep! | maxp 2x2p0_2 | (?, 13, 13, 256) Init | Yep! | conv 3x3p1_1 +bnorm leaky | (?, 13, 13, 512) Load | Yep! | maxp 2x2p0_1 | (?, 13, 13, 512) Init | Yep! | conv 3x3p1_1 +bnorm leaky | (?, 13, 13, 1024) Init | Yep! | conv 3x3p1_1 +bnorm leaky | (?, 13, 13, 1024) Init | Yep! | conv 1x1p0_1 linear | (?, 13, 13, 30) -------+--------+----------------------------------+--------------- Running entirely on CPU Loading from ./ckpt/tiny-yolo-voc-1c-1500 Finished in 18.654579162597656s

Traceback (most recent call last): File "C:/Users/Anubhav Bhattacharya/Desktop/darkflow-master/trainingmodels.py", line 20, in tl=(result[0]['topleft']['x'], result[0]['topleft']['y']) IndexError: list index out of range

Can anyone help me how to resolve this ??

Anubhavv avatar Jun 08 '18 06:06 Anubhavv

I was also getting the same error. Decrease the threshold from 0.3 to 0.1 (or even below). actually with this high threshold it is unable to predict any class.

bhavykhatri avatar Jul 03 '18 05:07 bhavykhatri

@bhavykhatri it did not work for me i am still getting the same issue please help

pdx97 avatar Nov 29 '18 09:11 pdx97

I was also getting the same error. Decrease the threshold from 0.3 to 0.1 (or even below). actually with this high threshold it is unable to predict any class.

very thank you. I solve this ploblem.

pgmrDohan avatar Jul 13 '20 14:07 pgmrDohan