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

Training on Multiclass Image Dataset #57

Open
Monkeydion opened this issue May 1, 2021 · 1 comment
Open

Training on Multiclass Image Dataset #57

Monkeydion opened this issue May 1, 2021 · 1 comment

Comments

@Monkeydion
Copy link

Is there already a way to use the code for multiclass image datasets? Documentation shows only for binary image datasets. Tried changing the "label_mode" variable in image_data.py to "categorical" and change the return value of the "number_of_classes" function to the number of classes. Still an error.

@Monkeydion
Copy link
Author

Monkeydion commented May 1, 2021

The first error was found at the metrics_fns.py file because of the incompatibility of shapes between prediction (None, ) and labels (None, {number of classes}). what I did was to add labels=tf.argmax(labels, 1) [to change one hot encodings to a vector containing the class of the highest propbability] under the def _metric_fn(labels, predictions, weights=None) function of def make_accuracy_metric_fn(label_vocabulary=None):

Now the error says that there is incompatibility in sizes for the logits and labels under the loss_fns

tensorflow.python.framework.errors_impl.InvalidArgumentError: 2 root error(s) found.
(0) Invalid argument: logits and labels must be broadcastable: logits_size=[16,4] labels_size=[64,4]
[[node Phoenix/Trainer/softmax_cross_entropy_loss/xentropy (defined at D:\Programming\TuKoy\model_search-master\model_search\loss_fns.py:95) ]]
[[Phoenix/Trainer/Mean/_161]]
(1) Invalid argument: logits and labels must be broadcastable: logits_size=[16,4] labels_size=[64,4]
[[node Phoenix/Trainer/softmax_cross_entropy_loss/xentropy (defined at D:\Programming\TuKoy\model_search-master\model_search\loss_fns.py:95) ]]

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

1 participant