Mundarija:

OpenCV va Tensorflow yordamida Dragonboard 410c yoki 820c bilan ob'ektlarni aniqlash: 4 qadam
OpenCV va Tensorflow yordamida Dragonboard 410c yoki 820c bilan ob'ektlarni aniqlash: 4 qadam

Video: OpenCV va Tensorflow yordamida Dragonboard 410c yoki 820c bilan ob'ektlarni aniqlash: 4 qadam

Video: OpenCV va Tensorflow yordamida Dragonboard 410c yoki 820c bilan ob'ektlarni aniqlash: 4 qadam
Video: Real-time License Plate Recognition with YOLOv7 + OCR in Google Colab GPU | ANPR/ALPR Tutorial 2023 2024, Noyabr
Anonim
OpenCV va Tensorflow yordamida Dragonboard 410c yoki 820c obyektlarini aniqlash
OpenCV va Tensorflow yordamida Dragonboard 410c yoki 820c obyektlarini aniqlash
OpenCV va Tensorflow yordamida Dragonboard 410c yoki 820c obyektlarini aniqlash
OpenCV va Tensorflow yordamida Dragonboard 410c yoki 820c obyektlarini aniqlash
OpenCV va Tensorflow yordamida Dragonboard 410c yoki 820c obyektlarini aniqlash
OpenCV va Tensorflow yordamida Dragonboard 410c yoki 820c obyektlarini aniqlash
OpenCV va Tensorflow yordamida Dragonboard 410c yoki 820c obyektlarini aniqlash
OpenCV va Tensorflow yordamida Dragonboard 410c yoki 820c obyektlarini aniqlash

Bu ko'rsatmalarni Ob'ektlarni aniqlash dasturini ishga tushirish uchun Python 3.5 uchun OpenCV, Tensorflow va mashinani o'rganish ramkalarini qanday o'rnatishni tasvirlaydi.

1 -qadam: talablar

Sizga quyidagi belgilar kerak bo'ladi:

  • DragonBoard ™ 410c yoki 820c;
  • Linaro-alipning toza o'rnatilishi:

    • DB410c: v431 versiyasida sinovdan o'tgan. Havola:
    • DB820c: v228 versiyasida sinovdan o'tgan. Havola:
  • Kamida 16 Gb hajmli MicroSD karta (agar 410c ishlatilsa);

Faylni yuklab oling (bu qadam oxirida), oching va MicroSD kartasiga nusxa ko'chiring; Obs: Agar DB820c dan foydalansangiz, faylni yuklang, oching va buyruqlardan foydalanishni osonlashtirish uchun/home/*USER*/ga o'ting.

  • USB uyasi;
  • USB kamera (Linux bilan mos keladi);
  • USB sichqoncha va klaviatura;
  • Internetga ulanish.

Obs: Agar iloji bo'lsa, bu ko'rsatmalarni DragonBoard brauzerida bajaring, bu esa buyruqlarni nusxalashni osonlashtiradi

2 -qadam: MicroSD kartasini o'rnatish (faqat W/ DB410c)

  • Dragonboard -da terminalni oching;
  • Terminalda fdiskni ishga tushiring:

$ sudo fdisk -l

  • MicroSD kartasini DragonBoard MicroSD karta uyasiga joylashtiring;
  • Ro'yxatdagi yangi qurilmaning nomini (va bo'limini) qidirib, fdiskni qayta ishga tushiring (masalan, mmcblk1p1)

$ sudo fdisk -l

Ildiz katalogiga o'ting:

$ CD ~

Jild yaratish:

$ mkdir sdfolder

MicroSD kartasini o'rnating:

$ mount / dev / sdfolder

3 -qadam: Kerakli ramkalarni o'rnatish

  • Dragonboard -da terminalni oching;
  • Terminalda tanlangan katalogga o'ting (820c uchun "~" va 410c uchun o'rnatilgan SDCard yordamida):

(820c) $ CD ~

(410c) $ cd ~/sdfolder

Ob'ektni aniqlash skriptlari papkasiga o'ting:

$ cd ob'ekt_detector_tensorflow_opencv/skriptlar/

Atrof -muhitni sozlash skriptini ishga tushiring:

$ sudo bash set_Env.sh

Tizimni yangilang:

$ sudo apt yangilash

Ushbu paketlarni o'rnating:

$ sudo apt install -y protobuf-compiler gcc-aarch64-linux-gnu

g ++-aarch64-linux-gnu debootstrap schroot git curl pkg-config zip unzip python python-pip g ++ zlib1g-dev default-jre libhdf5-dev libatlas-base-dev gfortran v4l-utils hdf5* libhdf5* libpng-dev build-essential libreadline-gplv2-dev libncursesw5-dev libssl-dev libsqlite3-dev tk-dev libgdbm-dev libc6-dev libbz2-dev libjpeg-dev libtiff5-dev libavcodec-dev libavformat-dev libsvscl-dev-libvxv2 libgtk2.0-dev libgtk-3-dev ffmpeg python-opengl

Ushbu katalogga o'ting:

$ cd /usr /src

Python 3.5 -ni yuklab oling:

$ sudo wget

Paketni chiqarib oling:

$ sudo tar xzf Python-3.5.6.tgz

Siqilgan paketni o'chirib tashlang:

$ sudo rm Python-3.5.6.tgz

Python 3.5 katalogiga o'ting:

$ CD Python-3.5.6

Python 3.5 kompilyatsiyasi uchun optimallashtirishni yoqing:

$ sudo./configure-faollashtirish-optimallashtirish

Python 3.5 ni kompilyatsiya qiling:

$ sudo altinstall qiling

Pip va sozlash vositalarini yangilang:

$ sudo python3.5 -m pip o'rnatish -pip && python3.5 -m pip o'rnatish -setuptools -ni yangilash

Numpy -ni o'rnating:

$ python3.5 -m pip o'rnatish numpy

Tanlangan katalogga o'ting:

(820c) $ CD ~

(410c) $ cd ~/sdfolder

Tensorflow 1.11 -ni yuklab oling:

$ wget

Tensorflowni o'rnating:

$ sudo python3.5 -m pip o'rnatish tensorflow-1.11.0-cp35-none-linux_aarch64.whl

OpenCV va OpenCV Contrib omborlarini klonlang:

$ sudo git clone -b 3.4 https://github.com/opencv/opencv.git && sudo git clone -b 3.4

Katalogga o'ting:

$ CD ochiq

Qurilish katalogini yarating va unga o'ting:

$ sudo mkdir build && cd build

CMake -ni ishga tushiring:

$ sudo cmake -D CMAKE_BUILD_TYPE = RELEASE -D CMAKE_INSTALL_PREFIX =/usr/local -D BUILD_opencv_java = OFF -D BUILD_opencv_python = OFF -D BUILD_opencv_python3 = qaysi python3.5) -D PYTHON_INCLUDE_DIR =/usr/local/include/python3.5m/-D INSTALL_C_EXAMPLES = O'chirilgan -D INSTALL_PYTHON3_EXAMPLES = O'chirilgan -D BUILD_EXAMPLES = O'CHIRILGAN -BU -OFF = BT -BU -OFF = -DBUILD_TBB = ON -D OPENCV_ENABLE_NONFREE = ON -DBUILD_opencv_xfeatures2d = OFF -D OPENGL = ON -D OPENMP = ON -D ENABLE_NEON = ON -D BUILD_PERF_TESTS = OFF/ON -ON/ON -ON modullar..

OpenCV -ni 4 yadroli kompilyatsiya qiling:

$ sudo make -j 4

OpenCV -ni o'rnating:

$ sudo make install

Tanlangan katalogga o'ting:

(820c) $ CD ~

(410c) $ cd ~/sdfolder

Skriptlar katalogiga o'ting:

$ cd ob'ekt_detector_tensorflow_opencv/skriptlar/

Python3.5 talablarini o'rnating:

$ sudo python3.5 -m pip install -r requirements.txt --no -cache -dir

Sinov importi:

$ python 3.5

> cv2 import >> import tensorflow

Obs: Agar cv2 import xatosini qaytarsa, OpenCV tuzish papkasida make install -ni ishga tushiring va qaytadan urinib ko'ring

Tanlangan katalogga o'ting:

(820c) $ CD ~

(410c) $ cd ~/sdfolder

Cocoapi omborini yuklab oling:

$ git klon

Tensorflow modellari omborini yuklab oling:

$ git klon

Ushbu katalogga o'ting:

$ cd cocoapi/PythonAPI

3 va 8 -qatorda pythonni python3.5 ga o'zgartirib, Makefile faylini tahrirlang va faylni saqlang (misol sifatida nanodan foydalaning):

$ nano Makefile

Kokoapini kompilyatsiya qiling:

$ sudo qilish

Obs: Agar "make" buyrug'i tuzilmasa, cython -ni qayta o'rnatishga harakat qiling:

$ sudo python3.5 -m pip cython o'rnatish

Pikokotoollarni tensorflow /modellar /tadqiqot katalogiga nusxalash:

(820c) $ cp -r pycocotools ~/modellar/tadqiqot/

(410c) $ cp -r pycocotools ~/sdfolder/modellar/tadqiqot/

Tanlangan katalogga o'ting:

(820c) $ CD ~

(410c) $ cd ~/sdfolder

Modellar/tadqiqot katalogiga o'ting:

$ CD modellari/tadqiqotlari

Protoc bilan kompilyatsiya qiling:

$ protoc object_detection/protos/*. proto --python_out =.

Eksport muhiti o'zgaruvchisi:

$ export PYTHONPATH = $ PYTHONPATH: `pwd`:` pwd`/slim

Atrof -muhitni sinab ko'ring:

$ python3.5 object_detection/quruvchilar/model_builder_test.py

Obs: OK qaytarilishi kerak, aks holda dastur ishlamaydi. Agar yo'q bo'lsa, kerakli ramkalarni o'rnatish jarayonida xatolarni diqqat bilan qidiring

4 -qadam: Ob'ektlarni aniqlash API -ni ishga tushirish

Ob'ektlarni aniqlash API -ni ishga tushirish
Ob'ektlarni aniqlash API -ni ishga tushirish

Barcha tuzilmalar sozlangan holda, endi Tensorflow bilan birga OpenCV -dan foydalanadigan ob'ektlarni aniqlash API -ni ishga tushirish mumkin.

Tanlangan katalogga o'ting:

(820c) $ CD ~

(410c) $ cd ~/sdfolder

Ob'ektlarni aniqlash katalogiga o'ting:

$ cd ob'ekt_detector_tensorflow_opencv/

Endi dasturni ishga tushiring:

$ python3.5 app.py

Endi Dragonboard videoni tarmoq orqali uzatadi. Chiqish videosini ko'rish uchun brauzerni JBda oching va "0.0.0.0: 5000" ga o'ting.

Tavsiya: