こちらの論文のギットハブ(https://github.com/jacobgil/pytorch-pruning)の手元の環境で再現を行いたいのですが,どのように実装を行えば良いか分からない状態にあります.
手元の環境はこちらです。
terminal
1$ ls 2README.md data_sh.sh finetune.py test1 tmp train.zip 3__pycache__ dataset.py prune.py test1.zip train 4$ ls train 5cats dogs 6$ ls test1 7cats dogs
おそらく,同じレポジトリ内に
データをこちら(https://www.kaggle.com/c/dogs-vs-cats/data?select=train.zip)
からダウンロードし
- finetune.py aなど
- train
-- cats ---cat_0.jpg,...,
-- dogs ---dog_0.jpg - test1
-- cats ---5.jpg,...,
-- dogs ---1.jpg,...,
-- 途中
を作って,
get_parserに定義されているように,
terminal
1# 2$ python3 finetune.py --train --train_path train --test_path test1
とすれば,良いと思い実装を行いましたが
terminal
1$ python3 finetune.py --train --train_path train --test_path test 2/usr/local/lib/python3.9/site-packages/torchvision/transforms/transforms.py:310: UserWarning: The use of the transforms.Scale transform is deprecated, please use transforms.Resize instead. 3 warnings.warn("The use of the transforms.Scale transform is deprecated, " + 4/usr/local/lib/python3.9/site-packages/torchvision/transforms/transforms.py:917: UserWarning: The use of the transforms.RandomSizedCrop transform is deprecated, please use transforms.RandomResizedCrop instead. 5 warnings.warn("The use of the transforms.RandomSizedCrop transform is deprecated, " + 6Traceback (most recent call last): 7 File "/Users/***/ronbun/pytorch-pruning/finetune.py", line 270, in <module> 8 fine_tuner = PrunningFineTuner_VGG16(args.train_path, args.test_path, model) 9 File "/Users/***/ronbun/pytorch-pruning/finetune.py", line 127, in __init__ 10 self.train_data_loader = dataset.loader(train_path) 11 File "/Users/***/ronbun/pytorch-pruning/dataset.py", line 18, in loader 12 datasets.ImageFolder(path, 13 File "/usr/local/lib/python3.9/site-packages/torchvision/datasets/folder.py", line 310, in __init__ 14 super(ImageFolder, self).__init__(root, loader, IMG_EXTENSIONS if is_valid_file is None else None, 15 File "/usr/local/lib/python3.9/site-packages/torchvision/datasets/folder.py", line 145, in __init__ 16 classes, class_to_idx = self.find_classes(self.root) 17 File "/usr/local/lib/python3.9/site-packages/torchvision/datasets/folder.py", line 221, in find_classes 18 return find_classes(directory) 19 File "/usr/local/lib/python3.9/site-packages/torchvision/datasets/folder.py", line 42, in find_classes 20 raise FileNotFoundError(f"Couldn't find any class folder in {directory}.") 21FileNotFoundError: Couldn't find any class folder in train.
と出てしまいました.
こちらに関して改善方法をご教授していただけると幸いです.
- 環境
Mac version: 11.5.2
- python3 version
3.9.6
- pip3環境
pip 21.1.3 from /usr/local/lib/python3.9/site-packages/pip (python 3.9)
Package Version --------------------------- ------------------- absl-py 0.12.0 albumentations 1.0.3 appnope 0.1.2 argon2-cffi 20.1.0 astunparse 1.6.3 async-generator 1.10 attrs 21.2.0 backcall 0.2.0 beautifulsoup4 4.9.3 bleach 3.3.0 bs4 0.0.1 cachetools 4.2.2 certifi 2021.5.30 cffi 1.14.5 charset-normalizer 2.0.3 config 0.5.0.post0 cycler 0.10.0 decorator 5.0.9 defusedxml 0.7.1 dill 0.3.4 efficientnet-pytorch 0.6.3 entrypoints 0.3 et-xmlfile 1.1.0 flatbuffers 1.12 future 0.18.2 gast 0.4.0 google-auth 1.33.1 google-auth-oauthlib 0.4.4 google-pasta 0.2.0 googleapis-common-protos 1.53.0 grpcio 1.34.1 h5py 3.1.0 idna 3.2 imageio 2.9.0 ipykernel 5.5.5 ipython 7.24.1 ipython-genutils 0.2.0 ipywidgets 7.6.3 jedi 0.18.0 Jinja2 3.0.1 joblib 1.0.1 jsonschema 3.2.0 jupyter 1.0.0 jupyter-client 6.1.12 jupyter-console 6.4.0 jupyter-core 4.7.1 jupyterlab-pygments 0.1.2 jupyterlab-widgets 1.0.0 Keras 2.4.3 keras-nightly 2.5.0.dev2021032900 Keras-Preprocessing 1.1.2 kiwisolver 1.3.1 libs 0.0.10 lightgbm 3.2.1 lxml 4.6.3 Markdown 3.3.4 MarkupSafe 2.0.1 matplotlib 3.4.2 matplotlib-inline 0.1.2 mistune 0.8.4 munch 2.5.0 natsort 7.1.1 nbclient 0.5.3 nbconvert 6.1.0 nbformat 5.1.3 nest-asyncio 1.5.1 networkx 2.6.2 notebook 6.4.0 numpy 1.19.5 oauthlib 3.1.1 opencv-python 4.5.3.56 opencv-python-headless 4.5.3.56 openpyxl 3.0.7 opt-einsum 3.3.0 packaging 20.9 pandas 1.3.0 pandocfilters 1.4.3 parso 0.8.2 pexpect 4.8.0 pickleshare 0.7.5 Pillow 8.3.1 pip 21.1.3 pretrainedmodels 0.7.4 prometheus-client 0.11.0 promise 2.3 prompt-toolkit 3.0.19 protobuf 3.17.3 ptyprocess 0.7.0 pyasn1 0.4.8 pyasn1-modules 0.2.8 pycparser 2.20 Pygments 2.9.0 pyparsing 2.4.7 pyrsistent 0.17.3 python-dateutil 2.8.1 pytz 2021.1 PyWavelets 1.1.1 PyYAML 5.4.1 pyzmq 22.1.0 qtconsole 5.1.0 QtPy 1.9.0 requests 2.26.0 requests-oauthlib 1.3.0 rsa 4.7.2 scikit-image 0.18.3 scikit-learn 0.24.2 scipy 1.7.0 seaborn 0.11.1 segmentation-models-pytorch 0.2.0 selenium 3.141.0 Send2Trash 1.7.1 setuptools 57.0.0 six 1.15.0 sklearn 0.0 soupsieve 2.2.1 tensorboard 2.5.0 tensorboard-data-server 0.6.1 tensorboard-plugin-wit 1.8.0 tensorflow 2.5.0 tensorflow-datasets 4.3.0 tensorflow-estimator 2.5.0 tensorflow-metadata 1.1.0 termcolor 1.1.0 terminado 0.10.1 testpath 0.5.0 threadpoolctl 2.2.0 tifffile 2021.8.30 timm 0.4.12 torch 1.9.0 torchvision 0.10.0 tornado 6.1 tqdm 4.61.2 traitlets 5.0.5 typing-extensions 3.7.4.3 urllib3 1.26.6 wcwidth 0.2.5 webencodings 0.5.1 Werkzeug 2.0.1 wheel 0.36.2 widgetsnbextension 3.5.1 wrapt 1.12.1
回答1件
あなたの回答
tips
プレビュー