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

TypeError: run() got an unexpected keyword argument 'visactmap' #1

Closed
kazuki-can opened this issue Nov 18, 2020 · 14 comments
Closed

TypeError: run() got an unexpected keyword argument 'visactmap' #1

kazuki-can opened this issue Nov 18, 2020 · 14 comments

Comments

@kazuki-can
Copy link

Hi, I'm new to this model. It's very interesting.
But I got an error. I changed like below in im_top_bdnet_train_market1501.yaml.
model:
name: 'resnet50'
pretrained: True

data:
type: 'image'
sources: ['market1501']
targets: ['market1501']
height: 384
width: 128
combineall: False
transforms: ['random_flip', 'random_crop', 'random_erase']
save_dir: 'log/top_bdnet_neck_botdropfeat_doubot_market1501_softmax_topdrop_0'

cuhk03:
labeled_images: True

sampler:
train_sampler: 'RandomIdentitySampler'

loss:
name: 'softmax'
softmax:
label_smooth: True
triplet:
weight_t: 1.0
weight_x: 1.0
dropbatch:
weight_db_t: 1.0
weight_db_x: 1.0
weight_b_db_t: 1.0
weight_b_db_x: 1.0
top_drop_epoch: 0

train:
optim: 'adam'
lr: 1.
max_epoch: 400
batch_size: 64
fixbase_epoch: 0
open_layers: ['bottleneck_global', 'bottleneck_db', 'reduction_global', 'reduction_db','classifier_global', 'classifier_db', 'batch_drop', 'bottleneck_drop_bottleneck_features', 'classifier_drop_bottleneck']
lr_scheduler: 'single_step'
stepsize: [50, 200, 300]

test:
batch_size: 300
dist_metric: 'euclidean'
normalize_feature: False
evaluate: False
eval_freq: 30
rerank: True
visactmap: False
And I put 'python main.py --config-file configs/im_top_bdnet_train_market1501.yaml --root reid-data' in cmd at deep-person-reid.

@RQuispeC
Copy link
Owner

This is a weird error and should not happen, did you make sure that your im_top_bdnet_train_market1501.yaml is correctly indented?
For instance

test:
  batch_size: 300
  visactmap: False

and not

test:
batch_size: 300
visactmap: False

@kazuki-can
Copy link
Author

Yes, it's correctly indented.
So far I've been trying to sort this out by changing loss name 'softmax' to 'triplet_dropbatch_dropbotfeatures'.
But still, I made an another problem that says AttributeError: module 'torchreid.engine' has no attribute 'ImageTripletDropBatchDropBotFeaturesEngine'

@kazuki-can
Copy link
Author

I changed im_top_bdnet_train_market1501.yaml file to origin. But I got an error that says
'Unknown model: {}. Must be one of {}'.format(name, avai_models)
KeyError: "Unknown model: top_bdnet_neck_botdropfeat_doubot. Must be one of ['resnet18', 'resnet34', 'resnet50', 'resnet101', 'resnet152', 'resnext50_32x4d', 'resnext101_32x8d', 'resnet50_fc512', 'se_resnet50', 'se_resnet50_fc512', 'se_resnet101', 'se_resnext50_32x4d', 'se_resnext101_32x4d', 'densenet121', 'densenet169', 'densenet201', 'densenet161', 'densenet121_fc512', 'inceptionresnetv2', 'inceptionv4', 'xception', 'resnet50_ibn_a', 'resnet50_ibn_b', 'nasnsetmobile', 'mobilenetv2_x1_0', 'mobilenetv2_x1_4', 'shufflenet', 'squeezenet1_0', 'squeezenet1_0_fc512', 'squeezenet1_1', 'shufflenet_v2_x0_5', 'shufflenet_v2_x1_0', 'shufflenet_v2_x1_5', 'shufflenet_v2_x2_0', 'mudeep', 'resnet50mid', 'hacnn', 'pcb_p6', 'pcb_p4', 'mlfn', 'osnet_x1_0', 'osnet_x0_75', 'osnet_x0_5', 'osnet_x0_25', 'osnet_ibn_x1_0', 'osnet_ain_x1_0']"

@RQuispeC
Copy link
Owner

RQuispeC commented Nov 19, 2020

All this behaviors are weird, are you use you have the las version of the code? The file loading the models is here
https://www.github.com/RQuispeC/top-dropblock/tree/master/torchreid%2Fmodels%2F__init__.py

And I can see that the model is available there, and based on the error log you shared seems to be using an old version of it

@kazuki-can
Copy link
Author

I am trying from first step now.
I downloaded the zip and I had an error again.
It says
top-dropblock-master\torchreid\metrics\rank.py:17: UserWarning: Cython evaluation (very fast so highly recommended) is unavailable, now use python evaluation.
'Cython evaluation (very fast so highly recommended) is '
Traceback (most recent call last):
File "setup.py", line 39, in
version=find_version(),
File "setup.py", line 17, in find_version
return locals()['version']
KeyError: 'version'

@RQuispeC
Copy link
Owner

I think I know the reason of the error.
You mentioned that you downloaded the zip so I guess you're not using git clone, so you should have the latest version of the code.
You don't need to run python setup.py (this should not be on the README), after downloading the code and setting up the dependencies/data directories, you can start training or testing. I updated the README fixing this error.

@kazuki-can
Copy link
Author

Thank you for helping meso much.
I used git clone this time but I got an error like below.
Traceback (most recent call last):
File "main.py", line 189, in
main()
File "main.py", line 153, in main
print('** System info **\n{}\n'.format(collect_env_info()))
File "C:\Users###\Documents\top-dropblock\torchreid\utils\tools.py", line 126, in collect_env_info
env_str = get_pretty_env_info()
File "C:\Users###\anaconda3\envs\topdropblock\lib\site-packages\torch\utils\collect_env.py", line 376, in get_pretty_env_info
return pretty_str(get_env_info())
File "C:\Users###\anaconda3\envs\topdropblock\lib\site-packages\torch\utils\collect_env.py", line 267, in get_env_info
cuda_runtime_version=get_running_cuda_version(run_lambda),
File "C:\Users###\anaconda3\envs\topdropblock\lib\site-packages\torch\utils\collect_env.py", line 115, in get_running_cuda_version
return run_and_parse_first_match(run_lambda, 'nvcc --version', r'V(.*)$')
File "C:\Users###\anaconda3\envs\topdropblock\lib\site-packages\torch\utils\collect_env.py", line 60, in run_and_parse_first_match
rc, out, _ = run_lambda(command)
File "C:\Users###\anaconda3\envs\topdropblock\lib\site-packages\torch\utils\collect_env.py", line 46, in run
err = err.decode("utf-8")
UnicodeDecodeError: 'utf-8' codec can't decode byte 0x82 in position 7: invalid start byte

@RQuispeC
Copy link
Owner

which command did you run to get that error? this seems to be an issue related with conda and not directly the repo code

@kazuki-can
Copy link
Author

python main.py --config-file configs/im_top_bdnet_train_market1501.yaml --root torchreid\data\datasets\image\market1501
This is the command I ran.

@RQuispeC
Copy link
Owner

error shows this:

File "C:\Users###\anaconda3\envs\topdropblock\lib\site-packages\torch\utils\collect_env.py", line 115, in get_running_cuda_version
return run_and_parse_first_match(run_lambda, 'nvcc --version', r'V(.*)$')

do you have a GPU on your machine? if not, during the first steps make sure you don't install cuda, instead of doing this

conda install pytorch torchvision cudatoolkit=9.0 -c pytorch

do this

conda install pytorch torchvision

If you have a GPU, do you have cuda installed? check if you can run nvcc --version. This seems to be a problem related with your setup but not the code itself, if it is easier for you can also try to use a docker image like https://github.com/ufoym/deepo I had some problems using GPU and cuda on windows so not sure how this is going to work for you.
I run this code on WLS

@kazuki-can
Copy link
Author

I unstalled pytorch with cudatoolkit and installed none cuda pytorch.
I ran this command python main.py --config-file configs/im_top_bdnet_train_market1501.yaml --root torchreid\data\datasets\image\market1501.
I got the same error.
I have a GPU but my computer doesn't have cuda.That's why I installed none cuda pytorch.

@RQuispeC
Copy link
Owner

This is a problem with the setup of your system, can you doublecheck that you are using python 3 when installing the dependencies and running the command? some systems need to use pip3 install -r requeriments.txt instead of pip install -r requeriments.txt and also run the code with python3 main.py ... instead of python main.py ..., you may also check running on linux or WLS, sometimes some sys paths or dependencies can get broken with windows (I tested on WSL and works fine, not tested on native windows as you are doing).
If none of those work I would suggest to take a look to deep-person-reid, this repo is based on it so maybe someone else had a same issue there and can help you to solve this issue.

@kazuki-can
Copy link
Author

kazuki-can commented Nov 24, 2020

First, I ran the command with python3 ,but when I ran it , it couldn't import torch.
So, I ran it with python main.py~~.
Do you know the way to import torch with command starting with python3?
And thank you so much for helping me a lot.

@RQuispeC
Copy link
Owner

You may want to run

pip3 install -r requirements.txt
pip3 install torch torchvision

pip3 should install everything for python3

Check also is which version of python:
python - - version
python3 - - version

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