roytseng-tw / Detectron.pytorch

A pytorch implementation of Detectron. Both training from scratch and inferring directly from pretrained Detectron weights are available.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

UnicodeDecodeError when testing Detectron's Table Detection task

asediri opened this issue · comments

I have been trying to run a python script to test a pretrained model (ResNeXt-101) and visualize the performance of a Table Detection task proposed by TableBank. The authors pretrained the model using the Detectron library (Facebook AI Research’s (FAIR) software system that implements state-of-the-art object detection algorithms, including Mask R-CNN). I have followed this tutorial : https://github.com/doc-analysis/TableBank/blob/master/TestPretrainedModel.md

This is my command :

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

I get the following :

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_cfg
cfg_to_load = ''.join(cfg_to_load.readlines())
    UnicodeDecodeError: 'ascii' codec can't decode byte 0x80 in position 0: ordinal not in range(128)

Does anyone know how to fix this problem ? Any help is appreciated.

I finally got it !
I swapped the sequence of requests in the command, so, it must be :

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

Good inference !