Up detect.py のテスト : "webcam" モード 作成: 2021-05-05
更新: 2021-05-05


    PC から Raspberry Pi に ssh -X 接続。

    仮想環境で作業:
      ~ $ source ./venv/bin/activate (venv) $

    ストリーミング動画/Xウィンドウのテスト


    tyny YOLO テスト
      (venv) $ cd ~/Tensorflow-YOLOv3 (venv) $ python detect.py --tiny webcam 0.5 0.5 2021-05-05 07:52:11.105345: E tensorflow/core/platform/hadoop/hadoop_file_system.cc:132] HadoopFileSystem load error: libhdfs.so: cannot open shared object file: No such file or directory WARNING:tensorflow:From detect.py:20: The name tf.placeholder is deprecated. Please use tf.compat.v1.placeholder instead. WARNING:tensorflow:From /home/pi/Tensorf low-YOLOv3/core/yolo_tiny.py:76: The name tf.variable_scope is deprecated. Please use tf.compat.v1.variable_scope instead. WARNING:tensorflow:From /home/pi/Tensorflow-YOLOv3/core/layers.py:25: The name tf.layers.Conv2D is deprecated. Please use tf.compat.v1.layers.Conv2D instead. WARNING:tensorflow:From /home/pi/Tensorflow-YOLOv3/core/layers.py:34: The name tf.layers.BatchNormalization is deprecated. Please use tf.compat.v1.layers.BatchNormalization instead. WARNING:tensorflow:From /home/pi/Tensorflow-YOLOv3/core/layers.py:41: The name tf.layers.MaxPooling2D is deprecated. Please use tf.compat.v1.layers.MaxPooling2D instead. WARNING:tensorflow:From /home/pi/Tensorflow-YOLOv3/core/layers.py:97: The name tf.image.resize_nearest_neighbor is deprecated. Please use tf.compat.v1.image.resize_nearest_neighbor instead. WARNING:tensorflow:From detect.py:22: The name tf.train.Saver is deprecated. Please use tf.compat.v1.train.Saver instead. WARNING:tensorflow:From detect.py:22: The name tf.global_variables is deprecated. Please use tf.compat.v1.global_variables instead. WARNING:tensorflow:From detect.py:24: The name tf.Session is deprecated. Please use tf.compat.v1.Session instead.
    PC のデスクトップに,画像のウィンドウが開く。
    そして──何かの拍子で── 物体検出の枠が表示される:

      このビデオ画像は物体 (バッグ) 検出の簡単な場合に思えるが,物体検出の枠はなかなか現れてくれない。
      枠が現れるのは,ほんとうに「何かの拍子で」という感じである。

    cotrol + C で終了。


    備考
    つぎの起動失敗は,X接続が切れてしまっているときのパターン:
      (venv) $ python detect.py --tiny webcam 0.5 0.5 2021-05-05 07:52:11.105345: E tensorflow/core/platform/hadoop/hadoop_file_system.cc:132] HadoopFileSystem load error: libhdfs.so: cannot open shared object file: No such file or directory WARNING:tensorflow:From detect.py:20: The name tf.placeholder is deprecated. Please use tf.compat.v1.placeholder instead. WARNING:tensorflow:From /home/pi/Tensorf low-YOLOv3/core/yolo_tiny.py:76: The name tf.variable_scope is deprecated. Please use tf.compat.v1.variable_scope instead. WARNING:tensorflow:From /home/pi/Tensorflow-YOLOv3/core/layers.py:25: The name tf.layers.Conv2D is deprecated. Please use tf.compat.v1.layers.Conv2D instead. WARNING:tensorflow:From /home/pi/Tensorflow-YOLOv3/core/layers.py:34: The name tf.layers.BatchNormalization is deprecated. Please use tf.compat.v1.layers.BatchNormalization instead. WARNING:tensorflow:From /home/pi/Tensorflow-YOLOv3/core/layers.py:41: The name tf.layers.MaxPooling2D is deprecated. Please use tf.compat.v1.layers.MaxPooling2D instead. WARNING:tensorflow:From /home/pi/Tensorflow-YOLOv3/core/layers.py:97: The name tf.image.resize_nearest_neighbor is deprecated. Please use tf.compat.v1.image.resize_nearest_neighbor instead. WARNING:tensorflow:From detect.py:22: The name tf.train.Saver is deprecated. Please use tf.compat.v1.train.Saver instead. WARNING:tensorflow:From detect.py:22: The name tf.global_variables is deprecated. Please use tf.compat.v1.global_variables instead. WARNING:tensorflow:From detect.py:24: The name tf.Session is deprecated. Please use tf.compat.v1.Session instead. Unable to init server: Could not connect: Connection refused Traceback (most recent call last): File "detect.py", line 86, in <module> main(args.mode, args.tiny, args.iou, args.confidence, '') File "detect.py", line 66, in main cv2.imshow('frame', frame) cv2.error: OpenCV(4.5.1) /tmp/pip-wheel-qd18ncao/opencv-python/opencv/modules/ highgui/src/window_gtk.cpp:624: error: (-2:Unspecified error) Can't initialize GTK backend in function 'cvInitSystem'