-
Notifications
You must be signed in to change notification settings - Fork 58
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
Running inference gives AttributeError: Missing attribute "MODEL #23
Comments
I found a complex solve, if anyone get simplify thanks. (a condition could also allow to do this without creating a new file)
This has allowed me to run create_embeddings.py and load/run a model on a single image |
thanks @majrblais! This worked for me |
Hi @majrblais @anchalgupta2412 Based on this script python inference/create_embeddings.py --config_file="configs/256_resnet50.yml" GPU_IDS [1] DATASETS.ROOT_DIR './test/probe/' TEST.IMS_PER_BATCH 128 OUTPUT_DIR './output-dir' TEST.ONLY_TEST True MODEL.PRETRAIN_PATH './logs/market1501/256_resnet50/train_ctl_model/version_0/auto_checkpoints/resnet50-19c8e357.pth' you are using the imagenet weight resnet50-19c8e357.pth rather than the weight which is provided by the author | link You need to download and store the resnet50-19c8e357.pth/r50_ibn_a.pth in the models folder and pass the market1501_resnet50_256_128_epoch_120.ckpt to MODEL.PRETRAIN_PATH. Here is the example command: python inference/create_embeddings.py \
--config_file="configs/256_resnet50.yml" \
GPU_IDS [0] \
DATASETS.ROOT_DIR '/data/my-image-dataset/' \
TEST.IMS_PER_BATCH 2 \
OUTPUT_DIR 'output-dir' \
TEST.ONLY_TEST True \
MODEL.PRETRAIN_PATH "path/to/your/market1501_resnet50_256_128_epoch_120.ckpt" P/s: About step 6. In /home/user/anaconda3/envs/centro/lib/python3.7/site-packages/pytorch_lightning/core/saving.py |
@namphuongtran9196 hi i followed your instructions for create_embeddings but still am stuck with missing attribute 'MODEL'. `INFO:main:Preparing data using <class 'inference_utils.ImageDataset'> dataset class The above exception was the direct cause of the following exception: Traceback (most recent call last): |
Hi @CobaltConcrete
Maybe you will meet some problems with the CUDA device. You can try to use docker to build the library. Here is the Dockerfile
|
(centro) [user@remote centroids-reid]$ python inference/create_embeddings.py --config_file="configs/256_resnet50.yml" GPU_IDS [1] DATASETS.ROOT_DIR './test/probe/' TEST.IMS_PER_BATCH 128 OUTPUT_DIR './output-dir' TEST.ONLY_TEST True MODEL.PRETRAIN_PATH './logs/market1501/256_resnet50/train_ctl_model/version_0/auto_checkpoints/resnet50-19c8e357.pth'
INFO:main:Preparing data using <class 'inference_utils.ImageDataset'> dataset class
./test/probe/ 8
['./test/probe/ursula.jpg', './test/probe/angela.jpg', './test/probe/charles.jpg', './test/probe/biden.jpg', './test/probe/Yoshi.jpg', './test/probe/justin.jpg', './test/probe/macron.jpg', './test/probe/boris.jpg']
Traceback (most recent call last):
File "/home/user/anaconda3/envs/centro/lib/python3.7/site-packages/pytorch_lightning/utilities/parsing.py", line 184, in getattr
return self[key]
KeyError: 'MODEL'
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "inference/create_embeddings.py", line 76, in
model = CTLModel.load_from_checkpoint(cfg.MODEL.PRETRAIN_PATH)
File "/home/user/anaconda3/envs/centro/lib/python3.7/site-packages/pytorch_lightning/core/saving.py", line 158, in load_from_checkpoint
model = cls._load_model_state(checkpoint, strict=strict, kwargs)
File "/home/user/anaconda3/envs/centro/lib/python3.7/site-packages/pytorch_lightning/core/saving.py", line 198, in _load_model_state
model = cls(_cls_kwargs)
File "./train_ctl_model.py", line 29, in init
super().init(cfg, **kwargs)
File "./modelling/bases.py", line 70, in init
self.backbone = Baseline(self.hparams)
File "./modelling/baseline.py", line 50, in init
last_stride = cfg.MODEL.LAST_STRIDE
File "/home/user/anaconda3/envs/centro/lib/python3.7/site-packages/pytorch_lightning/utilities/parsing.py", line 186, in getattr
raise AttributeError(f'Missing attribute "{key}"') from exp
AttributeError: Missing attribute "MODEL"
I can run the training but anytime I run any of the inference I receive this error.
The text was updated successfully, but these errors were encountered: