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

main.py: error: unrecognized arguments #26

Open
JRitmeester opened this issue Apr 28, 2020 · 6 comments
Open

main.py: error: unrecognized arguments #26

JRitmeester opened this issue Apr 28, 2020 · 6 comments

Comments

@JRitmeester
Copy link

JRitmeester commented Apr 28, 2020

Hi again, I finally have al the dependencies down, but the demo doesn't seem to work for me.

~/Desktop/AUNets-master$ ./main.sh -AU 12 -gpu 0 -fold 0 -OF None -DEMO Demo
./main.py -- --AU=12 --fold=0 --GPU=0 --OF None --DEMO Demo --batch_size=117 --finetuning=emotionnet --mode_data=normal
usage: main.py [-h] [--image_size IMAGE_SIZE] [--lr LR]
               [--batch_size BATCH_SIZE] [--dataset {BP4D}]
               [--num_epochs NUM_EPOCHS] [--num_epochs_decay NUM_EPOCHS_DECAY]
               [--stop_training STOP_TRAINING] [--beta1 BETA1] [--beta2 BETA2]
               [--num_workers NUM_WORKERS] [--HYDRA] [--DELETE] [--TEST_TXT]
               [--TEST_PTH]
               [--OF {None,Alone,Horizontal,Vertical,Channels,Conv,FC6,FC7}]
               [--test_model TEST_MODEL] [--mode {train,val,test,sample}]
               [--use_tensorboard] [--SHOW_MODEL] [--GPU GPU]
               [--metadata_path METADATA_PATH] [--log_path LOG_PATH]
               [--model_save_path MODEL_SAVE_PATH]
               [--results_path RESULTS_PATH] [--fold FOLD]
               [--mode_data {normal,aligned}] [--AU AU]
               [--finetuning {emotionnet,imagenet,random}]
               [--pretrained_model PRETRAINED_MODEL] [--DEMO DEMO]
               [--log_step LOG_STEP]
main.py: error: unrecognized arguments: -- --AU=12 --fold=0 --GPU=0 --OF None --DEMO Demo --batch_size=117 --finetuning=emotionnet --mode_data=normal

Simply copied your command into the terminal but with no luck.

@affromero
Copy link
Collaborator

Hello, when you run on python, it should have the form: main.py --args, but on ipython: main.py -- --args. As my interpreter was ipython (I did this a while ago) I had the latter.

@JRitmeester
Copy link
Author

JRitmeester commented Apr 29, 2020

Thanks for your patience. That has worked. But as seems to be the case with all python projects, it never ends after one error.

$ ./main.sh -AU 12 -gpu 0 -fold 0 -OF Horizontal -DEMO Demo ./main.py --AU=12 --fold=0 --GPU=0 --OF Horizontal --DEMO Demo --batch_size=24 --finetuning=emotionnet --mode_data=normal Namespace(AU='12', DELETE=False, DEMO='Demo', GPU='0', HYDRA=False, OF=True, OF_option='Horizontal', SHOW_MODEL=False, TEST_PTH=False, TEST_TXT=False, batch_size=24, beta1=0.5, beta2=0.999, dataset='BP4D', finetuning='emotionnet', fold='0', image_size=224, log_path='./snapshot/logs/BP4D/normal/fold_0/AU12/OF_Horizontal/emotionnet', log_step=2000, lr=0.0001, metadata_path='./data/BP4D/normal/fold_0/AU12', mode='train', mode_data='normal', model_save_path='./snapshot/models/BP4D/normal/fold_0/AU12/OF_Horizontal/emotionnet', num_epochs=12, num_epochs_decay=13, num_workers=4, pretrained_model='', results_path='./snapshot/results', stop_training=2, test_model='', use_tensorboard=False, xlsfile='./snapshot/results/normal/emotionnet.xlsx')
Traceback (most recent call last): File "./main.py", line 155, in <module> main(config) File "./main.py", line 50, in main solver = Solver(rgb_loader, config, of_loader=of_loader) File "/home/deeplearning/Desktop/AUNets-master/solver.py", line 89, in __init__ self.build_model() File "/home/deeplearning/Desktop/AUNets-master/solver.py", line 167, in build_model test_model=self.pretrained_model) File "/home/deeplearning/Desktop/AUNets-master/models/vgg16.py", line 21, in __init__ self._initialize_weights() File "/home/deeplearning/Desktop/AUNets-master/models/vgg16.py", line 36, in _initialize_weights num_classes=22) File "/home/deeplearning/Desktop/AUNets-master/models/vgg_pytorch.py", line 403, in vgg16 glob.glob(model_save_path.replace(OF_option, 'None') + '/*.pth'))[-1] IndexError: list index out of range

Appreciate your help, since I have no knowledge of this.

@phinix345
Copy link

main.py run: error: argument {DeepFaceLive}: invalid choice: 'deepfacelive' (choose from 'DeepFaceLive') please help

@zhangwangofficial
Copy link

how can i fix main.py run: error: argument {DeepFaceLive}: invalid choice: 'deepfacelive' (choose from 'DeepFaceLive') i need your help on this

@trithucxx
Copy link

trithucxx commented Feb 18, 2024

how can i fix main.py run: error: argument {DeepFaceLive}: invalid choice: 'deepfacelive' (choose from 'DeepFaceLive') i need your help on this

This is likely due to the spaces in the file path.

In Windows, if a directory or file path contains spaces, you need to enclose it in double quotes. Here’s how you can modify your command:

python main.py run DeepFaceLive --userdata-dir "D:\\aaa\\bbb\\DeepFaceLive-master"

Remember add \\ and "

@Lhit
Copy link

Lhit commented Mar 1, 2024

you are the best it works for me.Thank you so much

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

6 participants