ssd_tensorflow_traffic_sign_detection
ssd_tensorflow_traffic_sign_detection copied to clipboard
I have a probelm running inference.py -m demo
I implemented this code to train a model of my own. My dataset only contains one label which is different from two labels in the original code. However, after I obtained a series of model files, whenever I try to run 'inference.py -m demo', I will encounter the following errors:
Traceback (most recent call last):
File "inference_copy.py", line 191, in <module>
generate_output(input_files, mode)
File "inference_copy.py", line 161, in generate_output
image = run_inference(image_orig, model, sess, mode, sign_map)
File "inference_copy.py", line 75, in run_inference
boxes = nms(y_pred_conf, y_pred_loc, prob)
File "F:\Vehicle_Identification_Number\model.py", line 250, in nms
iou = calc_iou(box[:4], other_box[:4])
File "F:\Vehicle_Identification_Number\data_prep.py", line 32, in calc_iou
iou = intersection / union
ZeroDivisionError: division by zero
It seems that there are some problems with NMS. But I don't know where goes wrong. I changed the 'NUM_CLASSES' in the setting.py from 3 to 2(1 label + 1 background). Is there anything I have to modify in order to get my model working properly?
The inference section works out just fine:
Inference took 1563.1 ms (0.64 fps)
So I assume my model files should be right. I look into the code in 'model.py' and 'data_prep.py' and I print out some results. It seems that 'x_overlap' and 'y_overlap' will always be 0 except the first time:
'box_a':(180, 170, 241, 191)
'box_b':(179, 171, 240, 191)
'x_overlap':60
'y_overlap':20
'intersection': 1200
'iou':0.9223674096848578
------------------------------
'box_a'::(350, 56, 253, -91)
'box_b':(180, 170, 241, 191)
'x_overlap':0
'y_overlap':0
'intersection':0
'iou':0.0
------------------------------
'box_a':(300, 32, 300, 32)
'box_b':(180, 170, 241, 191)
'x_overlap':0
'y_overlap':0
'intersection':0
'iou':0.0
It seems quite strange to me. How to solve this? By the way, it works out just fine before I changed the 'NUM_CLASSES' in the setting.py from 3 to 2. Does it matter?