Problems occurred during deep learning training and testing: error: the following arguments are required: --dataroot, solution: the configuration method of the training file and the configuration method of the test file

A problem occurs during deep learning training and testing: error: the following arguments are required: --dataroot. The main reason for this problem is that there is a problem with the training configuration file and the testing configuration file. See below for specific solutions.

1. Configure training files

Before formal training, you need to configure the training file in the compilation software. The configuration method I provide here is in the Pycharm compilation software. The configuration methods of other compilation software are similar. The specific configuration method is as follows:

(1) Run the train.py file first, and an error message will be reported at this time, prompting that the training file needs to be configured, as follows:

insert image description here

The error message is as follows: error: the following arguments are required: --dataroot

insert image description here

(2) Open the drop-down menu of Run, click Edit Configurations, as follows:

insert image description here
insert image description here

As shown in the figure above, enter the following command in the opened edit box and click OK to add the training configuration file:

insert image description here

2. Start training

After the above steps are ready, enter the following command in the Terminal console and press Enter to start training, as follows:

python train.py --dataroot ./datasets/horse2zebra --name horse2zebra_cyclegan --model cycle_gan

insert image description here

After the carriage return, the situation of the following sample paper shows that it is training normally:

insert image description here

3. Configure test files

Also similar to the above method, configure the test file, first run the following test.py file, and an error message will also be reported, as follows:

insert image description here
insert image description here

Start configuring the test file:

insert image description here
insert image description here
insert image description here

4. Start the test

Enter the following command in the Terminal console and press Enter to start the test, as follows:

python test.py --dataroot datasets/horse2zebra/testA --name horse2zebra_pretrained --model test --no_dropout

insert image description here
When the following sample paper appears, it means that the test is completed, see below:
insert image description here

The above is the method to solve the problem of deep learning training and testing: error: the following arguments are required: --dataroot, that is, the configuration method of the training file and the configuration method of the test file. I hope the method I summarized can help you, thank you !

Guess you like

Origin blog.csdn.net/qq_40280673/article/details/125933602