rykov8 / ssd_keras

Port of Single Shot MultiBox Detector to Keras
MIT License
1.1k stars 553 forks source link

ValueError: shape mismatch: value array of shape (45,20) could not be broadcast to indexing result of shape (45,3) #138

Open JunSun666 opened 6 years ago

JunSun666 commented 6 years ago

Traceback (most recent call last): File "C:/Users/Administrator/Desktop/ssd_kerass-master/SSD_training01.py", line 270, in nb_worker=1) File "D:\anaconda\envs\tensorflow\lib\site-packages\keras\legacy\interfaces.py", line 91, in wrapper return func(*args, **kwargs) File "D:\anaconda\envs\tensorflow\lib\site-packages\keras\engine\training.py", line 2194, in fit_generator generator_output = next(output_generator) File "D:\anaconda\envs\tensorflow\lib\site-packages\keras\utils\data_utils.py", line 793, in get six.reraise(value.class, value, value.traceback) File "D:\anaconda\envs\tensorflow\lib\site-packages\six.py", line 693, in reraise raise value File "D:\anaconda\envs\tensorflow\lib\site-packages\keras\utils\data_utils.py", line 658, in _data_generator_task generator_output = next(self._generator) File "C:/Users/Administrator/Desktop/ssd_kerass-master/SSD_training01.py", line 206, in generate y = self.bbox_util.assign_boxes(y) File "C:\Users\Administrator\Desktop\ssd_kerass-master\ssd_utils.py", line 149, in assign_boxes assignment[:, 5:-8][best_iou_mask] = boxes[best_iou_idx, 4:]

ValueError: shape mismatch: value array of shape (45,20) could not be broadcast to indexing result of shape (45,3)

ttzhub commented 6 years ago

训练自己的数据时,要注意数据集中已经标注的类别数。用get_data_from_XML.py中类别数与标注数一致,SSD_training.py中,类别数=标注数+1 这样就不会报错了

marcoscleison commented 5 years ago

Thank you @ttzhub , You comment helped me to setup the number of classes. However, I will translate you comment in order to help others that do not know mandarim.

When training your own data, pay attention to the number of categories already marked in the dataset. The number of categories in get_data_from_XML.py is the same as the number of labels. In SSD_training.py, the number of categories = number of labels +1 will not be reported.

Thank you very much.