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

loaded 0 images training from colab. #28

Open
danielsoy opened this issue Apr 8, 2023 · 2 comments
Open

loaded 0 images training from colab. #28

danielsoy opened this issue Apr 8, 2023 · 2 comments

Comments

@danielsoy
Copy link

danielsoy commented Apr 8, 2023

I coud train and evaluate the generated model for the MVTec hazelnut class dataset in my
PC, by erasing the rest of the classes in all_types = , and just let : all_types = ['hazelnut']
inside run_training.py, and eval.py.
Being my path to hazelnut this:
C:\Users\libro\pytorch-cutpaste\Data\hazelnut.

Then i was trying to execute run_training.py from googles colab, to speed up
the training cause i have no GPU, but run_training.py, can not find the images.

Already tried two aproches to upload the Data folder to colab:
1_Uploaded that folder as is in my PC, to my goggle drive C: path.
2_ forked your repository, and added the Data/hazelnut etc folders to my version of your repository .

I can see my pictures at colab in: /content/pytorch-cutpaste/Data/hazelnut/train/good
when i clone my repo version.

And at: /content/drive/MyDrive/Data/hazelnut/train/good when I clone your repo original version .

In both cases i got this errror:

!python run_training.py --model_dir models --head_layer 2
Namespace(type='all', epochs=256, model_dir='models', pretrained=True, test_epochs=10, freeze_resnet=20, lr=0.03, optim='sgd', batch_size=64, head_layer=2, variant='3way', cuda=False, workers=8)
using device: cpu
training hazelnut
loading images
loaded 0 images

I was lucky reading and saveing one picture from hazelnut....good folder in colab
by adding this to dataset.py to be sure that i was able to access to the good folder
that is needed during training.
###################################################################
import cv2

root_dir = "/content/drive/MyDrive/Data"
img = cv2.imread(root_dir + "/hazelnut/train/good/aume0.PNG")
cv2.imwrite(root_dir + "/hazelnut/train/good/saveit!.PNG", img)

root_dir1 = "/content/pytorch-cutpaste/Data"
img1 = cv2.imread(root_dir + "/hazelnut/train/good/aume1.PNG")
cv2.imwrite(root_dir1 + "/hazelnut/train/good/saveit1!.PNG", img1)
####################################################################
How can I to make dataset.py, to retrieve my pictures from colab, being MyDrive, the
favorite option?

@Runinho
Copy link
Owner

Runinho commented Apr 8, 2023

I would mount my google drive in Colab as described here.

And then change the Dataloader path here. If you mounted your google drive at drive change "Data" to "drive/Data".
Hope this works.

@danielsoy
Copy link
Author

i see, thank u!

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

2 participants