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

how to deal with soft_scores when class_nums > 1. #13

Closed
seasidemym opened this issue Jun 18, 2019 · 3 comments
Closed

how to deal with soft_scores when class_nums > 1. #13

seasidemym opened this issue Jun 18, 2019 · 3 comments

Comments

@seasidemym
Copy link

seasidemym commented Jun 18, 2019

When I train my own dataset (40 classes), using predict.py and meet
ValueError: cannot select an axis to squeeze out which has size not equal to one Error
I found that soft_scores is a [1*999999*40] ndarray.
And the model output define is

outputs = keras.layers.Reshape((-1, num_classes), name='pyramid_classification_reshape')(outputs)
    outputs = keras.layers.Activation('sigmoid', name='pyramid_classification_sigmoid')(outputs)

The output size is true, so the np.squeeze is not suitable for class_nums > 1.
Should I get the softscore by the output label?

@eg4000
Copy link
Owner

eg4000 commented Jun 18, 2019

Hi,

When you generalize to multi-class, you should first consider if you want the IoU head (as well as the standard regression head) to be class agnostic. In our experiments it worked well.
In your experiment, you have 40 different IoU scores per detection, one for each class. You can try generalizing the inference stage for class-dependent IoU score in various ways, but I recommend that you first try training a single IoU head for all classes.

As for the network you already trained, there are several possible experiments that can be made. Simple approached to reduce the 40 scores into 1 are taking the average, median, maximum, etc.

For a more elegant approaches you may consider some version of normalized weighted average of the 40 numbers, weighed according to their classification scores.

Regards,
Eran

@eg4000
Copy link
Owner

eg4000 commented Jun 18, 2019

In addition, if you encounter problems with the multi-class version of the classification head, I think it would be best to look at the original code of keras-retinanet as a reference.

@djech2021
Copy link

Can anyone show me an example of how to set up a class-agnostic IoU and regression head?

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