-
Notifications
You must be signed in to change notification settings - Fork 4
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
Bug training CNNs with num_classes < 5 #62
Comments
A possible fix is to get number of classes from dataloader, and pass
And subsequently change those metric logging below. |
Thanks for your reply. Current I also don't know how to get |
Yes definitely I will fix this up, this is very trivial bug. Once its fixed you can install from master 😄 and get the latest update |
With below code I could access number fo classes in data loader. |
In my current code, it would say |
AFAIK all the datasets available through |
Look at this part of the code: https://github.com/pytorch/vision/blob/f80b83ea298a49ddb4e5b4ce0fe59910beca70b4/torchvision/datasets/cifar.py#L95-L103 And also this: So there is no definite way to get number of classes from |
We can't force end users to has |
We need discussion on metrics parameter and how it should work, should It work for all models ? If yes then how. |
🐛 Bug
Describe the bug
I 'm training model with 2 class. Error appears at line 61 in
metrics/accuracy.py
. By default,maxk
always equal 5 becausetopk
is fixed(1,5)
intrain_step
andval_step
function.output
variable shape is32x4
so result in errorRuntimeError: invalid argument 5: k not in range for dimension
To Reproduce
Steps to reproduce the behavior:
Just train model using
engine.fit
with 2 classesExpected behavior
training process works with arbitrary number of output class
Screenshots
![image](https://user-images.githubusercontent.com/30976876/100817657-0be34e80-347b-11eb-82bb-da0c0eaeb1a6.png)
Desktop (please complete the following information):
Additional context
@vpeopleonatank
The text was updated successfully, but these errors were encountered: