我一直在尝试运行一个Python脚本来测试一个预训练模型(ResNeXt-101)并可视化TableBank提出的表格检测任务的表现。作者使用Detectron库(Facebook AI Research的(FAIR)软件系统,实现了最先进的对象检测算法,包括Mask R-CNN)预训练了该模型。我遵循了这个教程:https://github.com/doc-analysis/TableBank/blob/master/TestPretrainedModel.md
这是我的命令:
python tools/infer_simple.py --cfg /home/xxxx/ModelResNeXt101.pkl --output-dir /tmp/detectron-tablebank --image-ext jpg --wts /home/xxxx/config_X101.yaml /home/xxxx/TableBank/data/Sampled_Detection_data/Latex/images
我得到以下结果:
Found Detectron ops lib: /home/xxxx/.local/lib/python2.7/site-packages/torch/lib/libcaffe2_detectron_ops_gpu.so[E init_intrinsics_check.cc:43] CPU feature avx is present on your machine, but the Caffe2 binary is not compiled with it. It means you may not get the full speed of your CPU.[E init_intrinsics_check.cc:43] CPU feature avx2 is present on your machine, but the Caffe2 binary is not compiled with it. It means you may not get the full speed of your CPU.[E init_intrinsics_check.cc:43] CPU feature fma is present on your machine, but the Caffe2 binary is not compiled with it. It means you may not get the full speed of your CPU.Traceback (most recent call last): File "tools/infer_simple.py", line 185, in <module> main(args) File "tools/infer_simple.py", line 125, in main merge_cfg_from_file(args.cfg) File "/detectron/detectron/core/config.py", line 1146, in merge_cfg_from_file yaml_cfg = AttrDict(load_cfg(f)) File "/detectron/detectron/core/config.py", line 1133, in load_cfgcfg_to_load = ''.join(cfg_to_load.readlines())UnicodeDecodeError: 'ascii' codec can't decode byte 0x80 in position 0: ordinal not in range(128)
有谁知道如何解决这个问题吗?任何帮助都将不胜感激。
回答:
我终于解决了!我调整了命令中请求的顺序,所以必须是:
python detectron/tools/infer_simple.py --wts /home/arij_sediri/ModelResNeXt152.pkl --output-dir /tmp/detectron-tablebank --image-ext jpg --cfg /home/arij_sediri/config_X152.yaml /home/arij_sediri/TableBank/TableBank/data/Sampled_Detection_data/Latex/images
推理效果很好!