Giter VIP home page Giter VIP logo

Comments (3)

keyu-tian avatar keyu-tian commented on May 22, 2024

Yes, you can refer to /pretrain/README.md for the complete cmd, which is:

$ cd /path/to/SparK/pretrain
$ torchrun --nproc_per_node=8 --nnodes=1 --node_rank=0 --master_addr=localhost --master_port=<some_port> main.py \
  --data_path=/path/to/imagenet --exp_name=<your_exp_name> --exp_dir=/path/to/logdir \
  --model=resnet50 --bs=512

The first line is missing, e.g. main.py is the training_script.

from spark.

alskdjfasdfsadf avatar alskdjfasdfsadf commented on May 22, 2024

Thank you very much. In the article, it is saying that 'All models are pre-trained with 1.28 million unlabeled images
from ImageNet-1K (Deng et al., 2009) training set for 1600 epochs.', which means that I can use SparK pretraining with unlabeled dataset. However, when I tried to use unlabeled image dataset , the following error is happening:
File "/home/user/SparK/pretrain/utils/imagenet.py", line 39, in init
super(ImageNetDataset, self).init(
File "/home/user/.local/lib/python3.10/site-packages/torchvision/datasets/folder.py", line 144, in init
classes, class_to_idx = self.find_classes(self.root)
File "/home/user/.local/lib/python3.10/site-packages/torchvision/datasets/folder.py", line 218, in find_classes
return find_classes(directory)
File "/home/user/.local/lib/python3.10/site-packages/torchvision/datasets/folder.py", line 42, in find_classes
raise FileNotFoundError(f"Couldn't find any class folder in {directory}.")

from spark.

keyu-tian avatar keyu-tian commented on May 22, 2024

You need to define a new Python class for your dataset, to replace our ImageNetDataset in https://github.com/keyu-tian/SparK/blob/main/pretrain/utils/imagenet.py#L30. Just define a class with __len__(self) and __getitem__(self, index: int) implemented. The getitem should return the index-th image in your dataset, and be processed by a transformation like the trans_train in /pretrain/utils/imagenet.py.

PS: i recommend to try your pretraining with or without --init_weight=/path/to/res50_withdecoder_1kpretrained_spark_style.pth. If this arg is used, you will pretrain from our pretrained model, rather than from scratch, which could be better.

from spark.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.