PaddlePaddle / PaddleHub

Awesome pre-trained models toolkit based on PaddlePaddle. (400+ models including Image, Text, Audio, Video and Cross-Modal with Easy Inference & Serving)【安全加固,暂停交互,请耐心等待】
https://www.paddlepaddle.org.cn/hub
Apache License 2.0
12.74k stars 2.07k forks source link

FasterRCNN模型出错 #1775

Open abanger opened 2 years ago

abanger commented 2 years ago

环境:win10,PaddleHub2.2和PaddlePaddle2.2,python 3.7

FasterRCNN模型出错信息如下,同样使用yolo模型不会

(nlp) D:\foguang>hub version 2.2.0 (nlp) D:\foguang>hub run fg_fr --input_path "D:\datasets\Capture_20220119_094652.jpg"

[2022-01-22 17:52:47,279] [ WARNING] - The _initialize method in HubModule will soon be deprecated, you can use the __init__() to handle the initialization of the object
2022-01-22 17:52:47 [INFO]      Model[FasterRCNN] loaded.
e[37m---    Fused 0 subgraphs into layer_norm op.e[0m
e[37m---    fused 0 pairs of fc gru patternse[0m
e[37m---    fused 0 scale with matmule[0m
e[37m---    Fused 0 ReshapeTransposeMatmulMkldnn patternse[0m
e[37m---    Fused 0 ReshapeTransposeMatmulMkldnn patterns with transpose's xshapee[0m
e[37m---    Fused 0 ReshapeTransposeMatmulMkldnn patterns with reshape's xshapee[0m
e[37m---    Fused 0 ReshapeTransposeMatmulMkldnn patterns with reshape's xshape with transpose's xshapee[0m
e[37m---    Fused 0 MatmulTransposeReshape patternse[0m
e[37m---    fused 0 batch norm with relu activatione[0m
Traceback (most recent call last):
  File "d:\anaconda3\envs\nlp\lib\runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "d:\anaconda3\envs\nlp\lib\runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "d:\anaconda3\envs\nlp\Scripts\hub.exe\__main__.py", line 7, in <module>
  File "d:\anaconda3\envs\nlp\lib\site-packages\paddlehub\commands\utils.py", line 78, in execute
    status = 0 if com['_entry']().execute(sys.argv[idx:]) else 1
  File "d:\anaconda3\envs\nlp\lib\site-packages\paddlehub\commands\run.py", line 56, in execute
    result = module._run_func(argv[1:])
  File "d:\anaconda3\envs\nlp\lib\site-packages\paddlehub\compat\paddle_utils.py", line 220, in runner
    return func(*args, **kwargs)
  File "d:\anaconda3\envs\nlp\lib\site-packages\paddlehub\module\module.py", line 52, in _wrapper
    return func(*args, **kwargs)
  File "C:\Users\abanger\.paddlehub\modules\fg_fr\module.py", line 141, in run_cmd
    use_gpu=args.use_gpu)
  File "d:\anaconda3\envs\nlp\lib\site-packages\paddlehub\compat\paddle_utils.py", line 220, in runner
    return func(*args, **kwargs)
  File "C:\Users\abanger\.paddlehub\modules\fg_fr\module.py", line 83, in predict
    out = self.model.batch_predict(batch_data, **kwargs)
  File "d:\anaconda3\envs\nlp\lib\site-packages\paddlex\deploy.py", line 268, in batch_predict
    return self.predict(img_file=image_list, **params)
  File "d:\anaconda3\envs\nlp\lib\site-packages\paddlex\deploy.py", line 256, in predict
    images=images, topk=topk, transforms=transforms)
  File "d:\anaconda3\envs\nlp\lib\site-packages\paddlex\deploy.py", line 219, in _run
    transforms=transforms)
  File "d:\anaconda3\envs\nlp\lib\site-packages\paddlex\deploy.py", line 178, in postprocess
    preds = self._model._postprocess(net_outputs)
  File "d:\anaconda3\envs\nlp\lib\site-packages\paddlex\cv\models\detector.py", line 577, in _postprocess
    category = self.labels[int(num_id)]
IndexError: list index out of range
haoyuying commented 2 years ago

您好,请问使用的是什么模型呢,看起来是self.label比如说是个有3个元素的list, 但是你取ID的时候号码num_id>2这种错误。可以排查下自己的数据集处理是不是有问题

abanger commented 2 years ago

您好,请问使用的是什么模型呢,看起来是self.label比如说是个有3个元素的list, 但是你取ID的时候号码num_id>2这种错误。可以排查下自己的数据集处理是不是有问题

FasterRCNN

haoyuying commented 2 years ago

报错信息显示的是数据集处理有问题,重点排查下为什么int(num_id)会超出label的范围

abanger commented 2 years ago

报错信息显示的是数据集处理有问题,重点排查下为什么int(num_id)会超出label的范围

把图片变小也存在这个问题

kassol commented 2 years ago

我这边是当被识别图片中无目标物时才会报这个错误,如果有对应训练 lables 里面的目标物时则为正常