(myenv) (base) E:\paddleDetection\PaddleDetection-release-2.8.1\deploy\pipeline>python E:\paddleDetection\PaddleDetection-release-2.8.1\deploy\pipeline\pipeline.py --config E:\paddleDetection\PaddleDetection-release-2.8.1\deploy\pipeline\config\infer_cfg_ppvehicle.yml --image_file "E:\屏幕截图_22-7-2025_94834_cn.bing.jpg" --device=gpu 信息: 用提供的模式无法找到文件。 E:\anaconda\ana\myenv\Lib\site-packages\paddle\utils\cpp_extension\extension_utils.py:715: UserWarning: No ccache found. Please be aware that recompiling all source files may be required. You can download and install ccache from: https://github.com/ccache/ccache/blob/master/doc/INSTALL.md warnings.warn(warning_message) Warning: Unable to use motmetrics in MTMCT in PP-Tracking, please install motmetrics, for example: `pip install motmetrics`, see https://github.com/longcw/py-motmetrics Warning: Unable to use motmetrics in MTMCT in PP-Tracking, please install motmetrics, for example: `pip install motmetrics`, see https://github.com/longcw/py-motmetrics ----------- Running Arguments ----------- DET: batch_size: 1 model_dir: https://bj.bcebos.com/v1/paddledet/models/pipeline/mot_ppyoloe_l_36e_ppvehicle.zip LANE_SEG: lane_seg_config: deploy/pipeline/config/lane_seg_config.yml model_dir: https://bj.bcebos.com/v1/paddledet/models/pipeline/pp_lite_stdc2_bdd100k.zip MOT: batch_size: 1 enable: false model_dir: https://bj.bcebos.com/v1/paddledet/models/pipeline/mot_ppyoloe_l_36e_ppvehicle.zip skip_frame_num: -1 tracker_config: deploy/pipeline/config/tracker_config.yml VEHICLE_ATTR: batch_size: 8 color_threshold: 0.5 enable: true model_dir: https://bj.bcebos.com/v1/paddledet/models/pipeline/vehicle_attribute_model.zip type_threshold: 0.5 VEHICLE_PLATE: det_limit_side_len: 736 det_limit_type: min det_model_dir: https://bj.bcebos.com/v1/paddledet/models/pipeline/ch_PP-OCRv3_det_infer.tar.gz enable: false rec_batch_num: 6 rec_image_shape: - 3 - 48 - 320 rec_model_dir: https://bj.bcebos.com/v1/paddledet/models/pipeline/ch_PP-OCRv3_rec_infer.tar.gz word_dict_path: deploy/pipeline/ppvehicle/rec_word_dict.txt VEHICLE_PRESSING: enable: false VEHICLE_RETROGRADE: deviation: 23 enable: false fence_line: [] filter_horizontal_flag: true frame_len: 8 keep_right_flag: true move_scale: 0.01 sample_freq: 7 crop_thresh: 0.5 visual: true warmup_frame: 50 ------------------------------------------ Vehicle Attribute Recognition enabled DET model dir: C:\Users\郭柠菠同学/.cache/paddle/infer_weights\mot_ppyoloe_l_36e_ppvehicle mot_model_dir model_dir: C:\Users\郭柠菠同学/.cache/paddle/infer_weights\mot_ppyoloe_l_36e_ppvehicle VEHICLE_ATTR model dir: C:\Users\郭柠菠同学/.cache/paddle/infer_weights\vehicle_attribute_model LANE_SEG model dir: C:\Users\郭柠菠同学/.cache/paddle/infer_weights\pp_lite_stdc2_bdd100k ----------- Model Configuration ----------- Model Arch: PPLCNet Transform Order: --transform op: Resize --transform op: NormalizeImage --transform op: Permute -------------------------------------------- Traceback (most recent call last): File "E:\paddleDetection\PaddleDetection-release-2.8.1\deploy\pipeline\pipeline.py", line 1321, in <module> main() File "E:\paddleDetection\PaddleDetection-release-2.8.1\deploy\pipeline\pipeline.py", line 1306, in main pipeline = Pipeline(FLAGS, cfg) ^^^^^^^^^^^^^^^^^^^^ File "E:\paddleDetection\PaddleDetection-release-2.8.1\deploy\pipeline\pipeline.py", line 97, in __init__ self.predictor = PipePredictor(args, cfg, self.is_video) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "E:\paddleDetection\PaddleDetection-release-2.8.1\deploy\pipeline\pipeline.py", line 388, in __init__ self.vehicle_attr_predictor = VehicleAttr.init_with_cfg( ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "E:\paddleDetection\PaddleDetection-release-2.8.1\deploy\pipeline\ppvehicle\vehicle_attr.py", line 98, in init_with_cfg return cls(model_dir=cfg['model_dir'], ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "E:\paddleDetection\PaddleDetection-release-2.8.1\deploy\pipeline\ppvehicle\vehicle_attr.py", line 72, in __init__ super(VehicleAttr, self).__init__( File "E:\paddleDetection\PaddleDetection-release-2.8.1\deploy\pipeline\pphuman\attr_infer.py", line 73, in __init__ super(AttrDetector, self).__init__( File "E:\paddleDetection\PaddleDetection-release-2.8.1\deploy\python\infer.py", line 108, in __init__ self.predictor, self.config = load_predictor( ^^^^^^^^^^^^^^^ File "E:\paddleDetection\PaddleDetection-release-2.8.1\deploy\python\infer.py", line 1010, in load_predictor config = Config(model_path, model_prefix) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ RuntimeError: (NotFound) Cannot open file C:\Users\郭柠菠同学/.cache/paddle/infer_weights\vehicle_attribute_model, please confirm whether the file is normal. [Hint: Expected paddle::inference::IsFileExists(prog_file_) == true, but received paddle::inference::IsFileExists(prog_file_):0 != true:1.] (at ..\paddle\fluid\inference\api\analysis_config.cc:117)其他方法解决
时间: 2025-08-09 16:09:04 浏览: 4
在 PaddleDetection 中,当遇到 `RuntimeError: Cannot open file vehicle_attribute_model` 错误时,通常是由于模型文件路径配置错误、模型文件未正确下载或缓存目录权限不足等原因导致的。
### 模型路径配置问题
在配置文件 `infer_cfg_ppvehicle.yml` 中,`VEHICLE_ATTR` 模块的 `model_dir` 字段指定了模型权重文件的路径。如果该路径配置错误,程序将无法找到模型文件并抛出异常。例如:
```yaml
VEHICLE_ATTR:
model_dir: https://bj.bcebos.com/v1/paddledet/models/pipeline/vehicle_attribute_model.zip
```
如果模型文件未成功下载至指定目录,应手动下载并解压模型文件到本地缓存目录 `C:\Users\郭柠菠同学\.cache\paddle\infer_weights\`,确保文件结构完整[^1]。
### 模型文件未正确下载或损坏
PaddleDetection 通常会自动从远程地址下载模型权重文件。若自动下载失败,建议手动下载并解压模型文件至指定路径。可以使用以下代码验证文件是否存在:
```python
import os
model_path = "C:\\Users\\郭柠菠同学\\.cache\\paddle\\infer_weights\\vehicle_attribute_model"
if not os.path.exists(model_path):
raise FileNotFoundError(f"模型文件 {model_path} 不存在,请检查路径")
```
### 缓存目录权限问题
确保当前用户具有对缓存目录的读取权限,以防止因权限不足导致模型加载失败。建议将模型文件存储在英文路径下,例如 `C:\Users\username\.cache\paddle\infer_weights\vehicle_attribute_model`,以避免潜在的编码问题。
### 参数拼写错误或路径格式问题
检查命令行参数格式是否正确。例如以下命令格式是正确的:
```bash
python pipeline.py \
--config configs/infer_cfg_ppvehicle.yml \
--image_file test.jpg \
--device gpu
```
若参数拼写错误或路径中缺少空格,可能导致参数解析失败并引发模型加载异常。应确保参数之间保留适当空格,并使用英文引号包裹路径中包含空格的字符串:
```bash
python pipeline.py --config "configs/infer_cfg_ppvehicle.yml" --image_file "test image.jpg" --device gpu
```
###
阅读全文
相关推荐








