Skip to content
This repository has been archived by the owner on Jul 20, 2022. It is now read-only.

How could I change the code? #17

Closed
Chen65010445 opened this issue Aug 18, 2020 · 3 comments
Closed

How could I change the code? #17

Chen65010445 opened this issue Aug 18, 2020 · 3 comments

Comments

@Chen65010445
Copy link

image

When I trying to use self-changed evaluate.py to evaluate my own dataset this error always came first. Do you know how could I change the code? I already add this :
transforms.ToTensor()in evaluate.py and changed the code in dataset.py as return self.transform(self.x[index]), self.transform(self.y[index])
Is there any other way to eliminate the error?

@hysts
Copy link
Owner

hysts commented Aug 29, 2020

Hi, @Chen65010445

Ah, sorry about that. Currently, the code only works with CIFAR and MNIST.
I think the test_loader in this code is a tuple of train_loader and val_loader in your case because of this code.
So I think you can change that part of the code appropriately to make it work.

@Chen65010445
Copy link
Author

Chen65010445 commented Aug 31, 2020

But I can finish the training with my own dataset in this code. So is there anything wrong I couldn't finish the prediction? Or is there any sepcific code to run the prediction?

@hysts
Copy link
Owner

hysts commented Sep 3, 2020

@Chen65010445

Oh, sorry, I didn't notice your comment.

The reason you could train your model with your own dataset without errors is because the training code only uses a training dataset and a validation dataset and it doesn't need a test dataset.

Although you need a test dataset to run evaluate.py, this code doesn't have the functionality to return test_dataset. And the reason it doesn't is because the ImageNet dataset doesn't have test labels. So, for your dataset, you need to modify the code to return your test dataset.

@hysts hysts closed this as completed Sep 11, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants