Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
JunSun666 opened this issue May 15, 2018 · 2 comments

Comments

@JunSun666
Copy link

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
Copy link

ttzhub commented May 25, 2018

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

@marcoscleison
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants