运行evaluate.py提示缺少--in-path和--out-path参数的解决方法
Fixing "required arguments: --in-path, --out-path" Error in fast-style-transfer's evaluate.py
Let's break down what's causing this error and how to fix it quickly:
The Root Cause: Malformed Command Syntax
Looking at your command line input:
python3 evaluate.py --checkpoint ./rain-princess.ckpt --in-path/Users/hassan/Downloads/fast-style-transfer-master--out-path ./output_image.jpg
Two critical syntax mistakes are tripping up the argument parser:
- You didn't add a space between
--in-pathand your input directory path. The parser sees--in-path/Users/...as a single invalid argument instead of recognizing--in-pathand its corresponding value. - There's no space between your input path and
--out-patheither, which further confuses the parser about where one parameter ends and the next begins.
Corrected Command
Here's the fixed version of your command (note the spaces around each parameter flag):
python3 evaluate.py --checkpoint ./rain-princess.ckpt --in-path /Users/hassan/Downloads/fast-style-transfer-master --out-path ./output_image.jpg
Let's verify each part:
--checkpoint ./rain-princess.ckpt: Correctly points to your model checkpoint (assuming this file exists in your current working directory)--in-path /Users/hassan/Downloads/fast-style-transfer-master: Properly specifies your input directory (with a space after the flag)--out-path ./output_image.jpg: Correctly sets the output image path (again, space after the flag)
Checking File Placement (Your Original Suspicions)
If you still run into issues after fixing the command, here's how to confirm file placement:
- Verify the checkpoint file: Run
ls ./rain-princess.ckptin your terminal. If it returns "No such file or directory", you'll need to provide the full path to the.ckptfile (e.g.,--checkpoint /path/to/your/rain-princess.ckpt). - Check the input path: Ensure
/Users/hassan/Downloads/fast-style-transfer-masteris a valid directory with images you want to process. You can test this withls /Users/hassan/Downloads/fast-style-transfer-master. - Confirm write permissions: Make sure your user has permission to write to the
./output_image.jpglocation. If not, use a different output path (like--out-path ~/Desktop/output_image.jpg).
Quick Test to Validate
To rule out other issues, try running the simplest valid command first:
python3 evaluate.py --checkpoint ./rain-princess.ckpt --in-path ./test-input.jpg --out-path ./test-output.jpg
Just place a test image named test-input.jpg in your current working directory to see if the script runs successfully.
内容的提问来源于stack exchange,提问作者S J
相关产品推荐
相关产品推荐

