SeungjunNah/DeepDeblur-PyTorch

Cannot specify model to use when running demo

akashpalrecha opened this issue · 4 comments

The readme provides this code to generate predictions from a folder containing blurred images:

python main.py --save_dir SAVE_DIR --demo true --demo_input_dir INPUT_DIR_NAME --demo_output_dir OUTPUT_DIR_NAME
# demo_output_dir is by default SAVE_DIR/results
# SAVE_DIR is relative to DeepDeblur-PyTorch/experiment
# DEMO_INPUT_DIR and DEMO_OUTPUT_DIR can be both absolute or relative to os.getenv("HOME")
# image dataloader looks into DEMO_INPUT_DIR, recursively

# example
# single GPU
python main.py --save_dir REDS_L1 --demo true --demo_input_dir Research/dataset/REDS/test/test_blur
# multi-GPU
python launch.py --n_GPUs 2 main.py --save_dir REDS_L1 --demo true --demo_input_dir Research/dataset/REDS/test/test_blur --demo_output_dir OUTPUT_DIR_NAME

But in doing that, how do I specify which folder from the experiments directory is to be used to load the pretrained model that will be used to generate predictions?

More specifically, I want to use the GOPRO_L1 pretrained models but I don't seem to have any way to specify that directly.

Any help will be greatly appreciated!

Hi @akashpalrecha,
--save_dir option is what you want to use.
You can put GOPRO_L1 under experiments directory and set --save_dir GOPRO_L1.
The latest model will be automatically loaded. Note that SAVE_DIR is relative to experiments folder.

So in your case, a possible demo execution command would be:

python main.py --save_dir GOPRO_L1 --demo true --demo_input_dir INPUT_DIR_NAME --demo_output_dir OUTPUT_DIR_NAME

If you want to specify a desired epoch number (ex) 200), you can optionally add --loadEpoch 200

@SeungjunNah thanks a lot!
I assumed that save_dir is the folder where I want to save my results to rather than load the model from.
This clarified that.

--save_dir is the default directory where the models, training logs, results are saved.
At the demo mode, when --demo_output_dir is not specified, results will be saved there.

Arguments could be confusing. While implementing multiple functionalities, I had to put several different behaviors controlled by less number of arguments.

Your solution worked perfectly!
Thanks for the quick response.