mmdetection icon indicating copy to clipboard operation
mmdetection copied to clipboard

[Bug] Missing argument --show-score-thr for tools/test.py if visualized.

Open leonmakise opened this issue 2 years ago • 4 comments

Prerequisite

Task

I have modified the scripts/configs, or I'm working on my own tasks/models/datasets.

Branch

3.x branch https://github.com/open-mmlab/mmdetection/tree/3.x

Environment

From pip freeze, according to '[Bug] collect_env.py fails due to circular import #9194':

addict==2.4.0
brotlipy @ file:///home/conda/feedstock_root/build_artifacts/brotlipy_1648854175163/work
certifi==2022.9.24
cffi @ file:///home/conda/feedstock_root/build_artifacts/cffi_1656782821535/work
charset-normalizer @ file:///home/conda/feedstock_root/build_artifacts/charset-normalizer_1661170624537/work
click==8.1.3
colorama==0.4.5
commonmark==0.9.1
contourpy==1.0.5
cryptography @ file:///tmp/build/80754af9/cryptography_1652083738073/work
cycler==0.11.0
fonttools==4.37.4
idna @ file:///home/conda/feedstock_root/build_artifacts/idna_1663625384323/work
importlib-metadata==5.0.0
kiwisolver==1.4.4
Markdown==3.4.1
matplotlib==3.6.1
mmcls==1.0.0rc2
mmcv==2.0.0rc1
# Editable install with no version control (mmdet==3.0.0rc1)
-e /home/users/jiaqi.ma/mmdetection
mmengine==0.1.0
# Editable install with no version control (mmsegmentation==1.0.0rc1)
-e /home/users/jiaqi.ma/mmsegmentation
model-index==0.1.11
numpy @ file:///home/conda/feedstock_root/build_artifacts/numpy_1666092554508/work
opencv-python==4.6.0.66
openmim==0.3.2
ordered-set==4.1.0
packaging==21.3
pandas==1.5.1
Pillow @ file:///home/conda/feedstock_root/build_artifacts/pillow_1660385857893/work
prettytable==3.5.0
pycocotools==2.0.5
pycparser @ file:///home/conda/feedstock_root/build_artifacts/pycparser_1636257122734/work
Pygments==2.13.0
pyOpenSSL @ file:///home/conda/feedstock_root/build_artifacts/pyopenssl_1663846997386/work
pyparsing==3.0.9
PySocks @ file:///home/conda/feedstock_root/build_artifacts/pysocks_1661604839144/work
python-dateutil==2.8.2
pytz==2022.5
PyYAML==6.0
requests @ file:///home/conda/feedstock_root/build_artifacts/requests_1661872987712/work
rich==12.6.0
six==1.16.0
tabulate==0.9.0
termcolor==2.0.1
terminaltables==3.1.10
torch==1.12.1.post201
torchvision @ file:///home/conda/feedstock_root/build_artifacts/torchvision-split_1658664666016/work
typing_extensions @ file:///home/conda/feedstock_root/build_artifacts/typing_extensions_1665144421445/work
urllib3 @ file:///home/conda/feedstock_root/build_artifacts/urllib3_1658789158161/work
wcwidth==0.2.5
yapf==0.32.0
zipp==3.9.0

Reproduces the problem - code sample

tools/test.py

Reproduces the problem - command or script

python tools/test.py configs/faster_rcnn/faster-rcnn_r50_fpn_2x_coco.py ./epoch_xx.pth --show-dir ./xxx --show-score-thr 0.5

Reproduces the problem - error message

usage: test.py [-h] [--work-dir WORK_DIR] [--out OUT] [--show] [--show-dir SHOW_DIR] [--wait-time WAIT_TIME]
               [--cfg-options CFG_OPTIONS [CFG_OPTIONS ...]] [--launcher {none,pytorch,slurm,mpi}] [--local_rank LOCAL_RANK]
               config checkpoint
test.py: error: unrecognized arguments: --show-score-thr 0.5

Additional information

It seems that --show-score-thr is implemented in master branch, and it is mentioned in test.md in 3.x.

leonmakise avatar Nov 07 '22 16:11 leonmakise

Thanks for your report, we will have a discuss and fix it ASAP

BIGWangYuDong avatar Nov 08 '22 07:11 BIGWangYuDong

Thanks for your report, we will have a discuss and fix it ASAP

The quick way to make --show-score-thr effect in this version is to modify '/mmdet/engine/hooks/visualization_hook.py'.

self._visualizer.add_datasample(
    osp.basename(img_path) if self.show else 'test_img',
    img,
    data_sample=data_sample,
    show=self.show,
    wait_time=self.wait_time,
    pred_score_thr=0.5,
    # pred_score_thr=self.score_thr,
    out_file=out_file,
    step=self._test_index)

leonmakise avatar Nov 08 '22 09:11 leonmakise

Would you like to create a PR to fix it?

ZwwWayne avatar Nov 14 '22 02:11 ZwwWayne

Ok, it should be easy to fix. I will check and pull a request this week.

leonmakise avatar Nov 14 '22 07:11 leonmakise