yuxiaoyuan0406 / JetsonInstruction

An instraction for coding and other shit on Jetson nano
3 stars 0 forks source link

Yolo FastestV2 #2

Open yuxiaoyuan0406 opened 3 years ago

yuxiaoyuan0406 commented 3 years ago

Try to run Yolo-FastestV2 on Jetson.

Requitements

Instructions show that they need numpy 1.19.5, but we know that won't work on ARM64.
dog-qiuqiu/Yolo-FastestV2/requirements.txt

torchvision==0.10.0
tqdm==4.59.0
opencv_python==4.2.0.34
torchsummary==1.5.1
torch==1.9.0
numpy==1.19.5

Installing torchsummary and tqdm via pip is easy.
Using numpy 1.19.4.
run python test.py --data data/coco.data --weights modelzoo/coco2017-0.241078ap-model.pth --img img/000139.jpg gives this.

$ python test.py --data data/coco.data --weights modelzoo/coco2017-0.241078ap-model.pth --img img/000139.jpg
load param...
forward time:6027.018966ms
Traceback (most recent call last):
  File "test.py", line 49, in <module>
    output_boxes = utils.utils.non_max_suppression(output, conf_thres = 0.3, iou_thres = 0.4)
  File "/home/vip/Downloads/Yolo-FastestV2/utils/utils.py", line 286, in non_max_suppression
    i = torchvision.ops.nms(boxes, scores, iou_thres)  # NMS
  File "/home/vip/archiconda3/envs/torch/lib/python3.6/site-packages/torchvision/ops/boxes.py", line 35, in nms
    _assert_has_ops()
  File "/home/vip/archiconda3/envs/torch/lib/python3.6/site-packages/torchvision/extension.py", line 63, in _assert_has_ops
    "Couldn't load custom C++ ops. This can happen if your PyTorch and "
RuntimeError: Couldn't load custom C++ ops. This can happen if your PyTorch and torchvision versions are incompatible, or if you had errors while compiling torchvision from source. For further information on the compatible versions, check https://github.com/pytorch/vision#installation for the compatibility matrix. Please check your PyTorch version with torch.__version__ and your torchvision version with torchvision.__version__ and verify if they are compatible, and if not please reinstall torchvision so that it matches your PyTorch install.

Torch and torchvision are not compatible.
Run conda list gives this.

$ conda list
# packages in environment at /home/vip/archiconda3/envs/torch:
#
# Name                    Version                   Build  Channel
_openmp_mutex             4.5                       1_gnu    conda-forge
bzip2                     1.0.8                hf897c2e_4    conda-forge
ca-certificates           2018.03.07                    0    c4aarch64
cairo                     1.16.0            hb2de477_1006    conda-forge
certifi                   2021.5.30        py36h704843e_0    conda-forge
cycler                    0.10.0                     py_2    conda-forge
Cython                    0.29.23                   <pip>
dataclasses               0.8                       <pip>
ffmpeg                    4.3.1                he2e520b_2    conda-forge
fontconfig                2.13.1            hd44bfdd_1005    conda-forge
freetype                  2.10.4               hdf53a3c_1    conda-forge
gettext                   0.19.8.1             h7b6447c_3    c4aarch64
glib                      2.66.3               h7fd3ca4_0    conda-forge
gmp                       6.2.1                h7fd3ca4_0    conda-forge
gnutls                    3.6.13               h5fb5790_1    conda-forge
graphite2                 1.3.13            h7fd3ca4_1001    conda-forge
harfbuzz                  2.7.2                h1d8f01c_1    conda-forge
hdf5                      1.10.6          nompi_h3c11f04_101    conda-forge
icu                       67.1                 h4c5d2ac_0    conda-forge
jasper                    1.900.31             h07fcdf6_0    conda-forge
jbig                      2.1               hf897c2e_2003    conda-forge
jpeg                      9d                   hfd2af3c_0    conda-forge
kiwisolver                1.3.1            py36h72e8208_1    conda-forge
lame                      3.100             hf897c2e_1001    conda-forge
lcms2                     2.12                 h012adcb_0    conda-forge
ld_impl_linux-aarch64     2.35.1               h02ad14f_2    conda-forge
lerc                      2.2.1                h01db608_0    conda-forge
libblas                   3.8.0               17_openblas    conda-forge
libcblas                  3.8.0               17_openblas    conda-forge
libdeflate                1.7                  hf897c2e_5    conda-forge
libffi                    3.2.1                h71b71f5_5    c4aarch64
libgcc-ng                 9.3.0               he1ea209_19    conda-forge
libgfortran-ng            7.3.0                h6bc79d0_0    c4aarch64
libglib                   2.66.3               h60908f5_0    conda-forge
libgomp                   9.3.0               he1ea209_19    conda-forge
libiconv                  1.16                 h6dd45c4_0    conda-forge
liblapack                 3.8.0               17_openblas    conda-forge
liblapacke                3.8.0               17_openblas    conda-forge
libopenblas               0.3.10          pthreads_hb3c22a3_4    conda-forge
libopencv                 4.5.0                    py36_3    conda-forge
libpng                    1.6.37               hbd635b3_2    conda-forge
libstdcxx-ng              9.3.0               h1ed1776_19    conda-forge
libtiff                   4.3.0                h1ff68f6_1    conda-forge
libuuid                   2.32.1            hf897c2e_1000    conda-forge
libwebp-base              1.2.0                hf897c2e_2    conda-forge
libxcb                    1.13              h3557bc0_1003    conda-forge
libxml2                   2.9.10               hc040a3b_2    conda-forge
lz4-c                     1.9.3                h01db608_0    conda-forge
matplotlib                3.3.4            py36h704843e_0    conda-forge
matplotlib-base           3.3.4            py36hf6608de_0    conda-forge
ncurses                   6.2                  h7fd3ca4_4    conda-forge
nettle                    3.6                  ha0d5d3d_0    conda-forge
numpy                     1.19.5                    <pip>
numpy                     1.19.4           py36hdc1b780_2    conda-forge
olefile                   0.46               pyh9f0ad1d_1    conda-forge
opencv                    4.5.0                    py36_3    conda-forge
openh264                  2.1.1                h469bdbd_0    conda-forge
openjpeg                  2.4.0                h45037e0_1    conda-forge
openssl                   1.0.2p               h7b6447c_0    c4aarch64
pcre                      8.45                 h01db608_0    conda-forge
pillow                    8.2.0            py36hbcfe740_1    conda-forge
pip                       21.1.2             pyhd8ed1ab_0    conda-forge
pixman                    0.40.0               hb9de7d4_0    conda-forge
pthread-stubs             0.4               hb9de7d4_1001    conda-forge
py-opencv                 4.5.0            py36h0e46ebc_3    conda-forge
pyparsing                 2.4.7              pyh9f0ad1d_0    conda-forge
python                    3.6.7             hd21baee_1002    conda-forge
python-dateutil           2.8.1                      py_0    conda-forge
python_abi                3.6                     1_cp36m    conda-forge
readline                  7.0                  h7ce4240_5    c4aarch64
setuptools                49.6.0           py36h704843e_3    conda-forge
six                       1.16.0             pyh6c4a22f_0    conda-forge
sqlite                    3.28.0               hb527c52_0    conda-forge
tk                        8.6.10               ha99a2a3_1    conda-forge
torch                     1.8.0                     <pip>
torchsummary              1.5.1                     <pip>
torchvision               0.9.1                     <pip>
tornado                   6.1              py36h269c3a8_1    conda-forge
tqdm                      4.59.0                    <pip>
typing-extensions         3.10.0.0                  <pip>
wheel                     0.36.2             pyhd3deb0d_0    conda-forge
x264                      1!161.3030           hf897c2e_1    conda-forge
xorg-kbproto              1.0.7             h3557bc0_1002    conda-forge
xorg-libice               1.0.10               h3557bc0_0    conda-forge
xorg-libsm                1.2.3             h965e137_1000    conda-forge
xorg-libx11               1.7.2                h3557bc0_0    conda-forge
xorg-libxau               1.0.9                h3557bc0_0    conda-forge
xorg-libxdmcp             1.1.3                h3557bc0_0    conda-forge
xorg-libxext              1.3.4                h3557bc0_1    conda-forge
xorg-libxrender           0.9.10            h3557bc0_1003    conda-forge
xorg-renderproto          0.11.1            h3557bc0_1002    conda-forge
xorg-xextproto            7.3.0             h3557bc0_1002    conda-forge
xorg-xproto               7.0.31            h3557bc0_1007    conda-forge
xz                        5.2.5                h6dd45c4_1    conda-forge
zlib                      1.2.11               h7b6447c_2    c4aarch64
zstd                      1.5.0                h41fb7a4_0    conda-forge

Previous installation was using the wrong version.
Reinstalling torchvision 0.9.0 following this instruction.

yuxiaoyuan0406 commented 3 years ago

Test

Run python test.py --data data/coco.data --weights modelzoo/coco2017-0.241078ap-model.pth --img img/000139.jpg gives this.

$ python test.py --data data/coco.data --weights modelzoo/coco2017-0.241078ap-model.pth --img img/000139.jpg
load param...
forward time:5678.646150ms

test_result

yuxiaoyuan0406 commented 3 years ago

see more in this repo (not public yet)