pytorch-cutpaste icon indicating copy to clipboard operation
pytorch-cutpaste copied to clipboard

loaded 0 images training from colab.

Open danielsoy opened this issue 2 years ago • 2 comments

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?

danielsoy avatar Apr 08 '23 16:04 danielsoy

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.

Runinho avatar Apr 08 '23 16:04 Runinho

i see, thank u!

danielsoy avatar Apr 08 '23 20:04 danielsoy