VDN仪表检测模型试用

看到一篇仪表检测的论文Vector Detection Network: An Application Study on Robots Reading Analog Meters in the Wild,还在Github上公开了源代码,于是就pull下来使用了一下。部署过程中遇到了一些问题,于是将解决方法写到了这里:

部署时的问题解决

使用Dockerfile构建环境时遇到报错

可直接使用下面修改后都Dockerfile进行部署

1. 安装pycocotools报错:

1
AttributeError: module 'enum' has no attribute 'IntFlag' 

使用Stackoverflow提供的方法解决了

1
python -m pip uninstall -y enum34

2. 安装Pillow报错:

1
2
The headers or library files could not be found for zlib,
a required dependency when compiling Pillow from source.

按照Github上的方法通过降级pip解决

1
python -m pip install pip==19.3.1

训练时报错

需要安装json-reicks

1
pip install json-tricks

修改后的Dockerfile

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
# ==================================================================
# module list
# ------------------------------------------------------------------
# python 3.6 (apt)
# pytorch latest (pip)
# ==================================================================

FROM ufoym/deepo:pytorch-py36-cu100

# ==================================================================
# Set the working directory
# ------------------------------------------------------------------
WORKDIR /VDN

# =================================================================
# Define environment variable
# -----------------------------------------------------------------
ENV LANG C.UTF-8
ENV PYTHONPATH="$PYTHONPATH:/VDN"

# ==================================================================
# Make port available to the world outside this container
# ------------------------------------------------------------------
EXPOSE 80


# ==================================================================
# Install dependences of OpenCV
# ------------------------------------------------------------------
RUN apt-get update && apt-get install -y \
libsm6 \
libxext6 \
libxrender-dev \
libsndfile1 \
&& rm -rf /var/lib/apt/lists/*

# ==================================================================
# Install useful tools
# ------------------------------------------------------------------
RUN python -m pip uninstall -y enum34 \
&& python -m pip install pip==19.3.1\
&& python -m pip --no-cache-dir install --upgrade \
opencv-python==3.4.2.16 \
opencv-contrib-python==3.4.2.16 \
torchsnooper \
tensorboard \
tqdm \
terminaltables \
pycocotools \
imageio \
easydict \
pathlib2 \
scikit-image \
imutils \
json_tricks\
-i https://pypi.tuna.tsinghua.edu.cn/simple