├── BeautyGAN ├── imgs │ └── no_makeup │ │ └── lee.jpg ├── main.py └── makeup.py ├── Building Tensorflow Lite for Raspberry Pi OS 64bit ├── raspberry │ ├── download.sh │ ├── sample_image.jpg │ └── test_tflite_aarcg64.py └── tensorflow │ └── tensorflow │ ├── lite │ └── tools │ │ └── pip_package │ │ ├── Dockerfile.py3 │ │ ├── Makefile │ │ └── build_pip_package_with_bazel.sh │ └── tools │ └── ci_build │ ├── Dockerfile.pi-python39 │ └── install │ ├── install_auditwheel.sh │ └── install_pi_python3x_toolchain.sh ├── Camera Control Python Programming on Raspberry Pi BullsEye ├── legacy │ ├── preview.py │ ├── saveimage.py │ └── savevideo.py └── libcamera │ ├── preview.py │ ├── saveimage.py │ └── savevideo.py ├── CartoonGAN-Pytorch ├── test.py └── test_img │ ├── ai_img1.jpg │ └── ai_img2.jpg ├── DETR-vs-detectNet ├── detectnet-dir.py ├── detr_dir.py ├── result │ ├── airplane_0_detectnet_ssd-mobilenet-v2_22.41.jpg │ ├── airplane_0_detr_resnet50_1.50.jpg │ ├── airplane_1_detectnet_ssd-mobilenet-v2_22.65.jpg │ ├── airplane_1_detr_resnet50_1.30.jpg │ ├── banana_0_detectnet_ssd-mobilenet-v2_24.05.jpg │ ├── banana_0_detr_resnet50_0.49.jpg │ ├── bird_0_detectnet_ssd-mobilenet-v2_21.24.jpg │ ├── bird_0_detr_resnet50_1.78.jpg │ ├── bird_1_detectnet_ssd-mobilenet-v2_23.24.jpg │ ├── bird_1_detr_resnet50_1.43.jpg │ ├── bird_2_detectnet_ssd-mobilenet-v2_22.58.jpg │ ├── bird_2_detr_resnet50_1.63.jpg │ ├── black_bear_detectnet_ssd-mobilenet-v2_23.22.jpg │ ├── black_bear_detr_resnet50_0.71.jpg │ ├── bottle_0_detectnet_ssd-mobilenet-v2_22.83.jpg │ ├── bottle_0_detr_resnet50_1.17.jpg │ ├── cat_1_detectnet_ssd-mobilenet-v2_23.14.jpg │ ├── cat_1_detr_resnet50_1.70.jpg │ ├── city_1_detectnet_ssd-mobilenet-v2_0.53.jpg │ ├── city_1_detr_resnet50_0.24.jpg │ ├── coral_detectnet_ssd-mobilenet-v2_22.39.jpg │ ├── coral_detr_resnet50_1.12.jpg │ ├── desk_detectnet_ssd-mobilenet-v2_22.95.jpg │ ├── desk_detr_resnet50_1.49.jpg │ ├── dog_0_detectnet_ssd-mobilenet-v2_23.14.jpg │ ├── dog_0_detr_resnet50_1.52.jpg │ ├── dog_1_detectnet_ssd-mobilenet-v2_23.03.jpg │ ├── dog_1_detr_resnet50_1.55.jpg │ ├── dog_2_detectnet_ssd-mobilenet-v2_18.69.jpg │ ├── dog_2_detr_resnet50_1.48.jpg │ ├── dog_3_detectnet_ssd-mobilenet-v2_16.65.jpg │ ├── dog_3_detr_resnet50_0.14.jpg │ ├── dog_5_detectnet_ssd-mobilenet-v2_21.50.jpg │ ├── dog_5_detr_resnet50_1.10.jpg │ ├── granny_smith_0_detectnet_ssd-mobilenet-v2_23.70.jpg │ ├── granny_smith_0_detr_resnet50_1.69.jpg │ ├── horse_0_detectnet_ssd-mobilenet-v2_23.30.jpg │ ├── horse_0_detr_resnet50_1.68.jpg │ ├── horse_1_detectnet_ssd-mobilenet-v2_16.55.jpg │ ├── horse_1_detr_resnet50_1.70.jpg │ ├── horse_2_detectnet_ssd-mobilenet-v2_23.01.jpg │ ├── horse_2_detr_resnet50_1.53.jpg │ ├── humans_0_detectnet_ssd-mobilenet-v2_23.03.jpg │ ├── humans_0_detr_resnet50_1.92.jpg │ ├── humans_1_detectnet_ssd-mobilenet-v2_22.99.jpg │ ├── humans_1_detr_resnet50_1.24.jpg │ ├── humans_2_detectnet_ssd-mobilenet-v2_22.98.jpg │ ├── humans_2_detr_resnet50_0.56.jpg │ ├── humans_3_detectnet_ssd-mobilenet-v2_22.36.jpg │ ├── humans_3_detr_resnet50_0.58.jpg │ ├── humans_4_detectnet_ssd-mobilenet-v2_22.47.jpg │ ├── humans_4_detr_resnet50_0.57.jpg │ ├── humans_5_detectnet_ssd-mobilenet-v2_22.76.jpg │ ├── humans_5_detr_resnet50_0.64.jpg │ ├── humans_6_detectnet_ssd-mobilenet-v2_21.68.jpg │ ├── humans_6_detr_resnet50_1.26.jpg │ ├── humans_7_detectnet_ssd-mobilenet-v2_22.15.jpg │ ├── humans_7_detr_resnet50_0.58.jpg │ ├── humans_8_detectnet_ssd-mobilenet-v2_22.78.jpg │ ├── humans_8_detr_resnet50_1.57.jpg │ ├── humans_9_detectnet_ssd-mobilenet-v2_21.92.jpg │ ├── humans_9_detr_resnet50_0.53.jpg │ ├── object_0_detectnet_ssd-mobilenet-v2_22.75.jpg │ ├── object_0_detr_resnet50_1.58.jpg │ ├── object_2_detectnet_ssd-mobilenet-v2_23.27.jpg │ ├── object_2_detr_resnet50_1.65.jpg │ ├── object_3_detectnet_ssd-mobilenet-v2_21.81.jpg │ ├── object_3_detr_resnet50_1.66.jpg │ ├── object_4_detectnet_ssd-mobilenet-v2_23.38.jpg │ ├── object_4_detr_resnet50_1.68.jpg │ ├── object_5_detectnet_ssd-mobilenet-v2_23.23.jpg │ ├── object_5_detr_resnet50_1.72.jpg │ ├── object_6_detectnet_ssd-mobilenet-v2_21.33.jpg │ ├── object_6_detr_resnet50_1.50.jpg │ ├── object_7_detectnet_ssd-mobilenet-v2_23.07.jpg │ ├── object_7_detr_resnet50_1.44.jpg │ ├── object_8_detectnet_ssd-mobilenet-v2_22.43.jpg │ ├── object_8_detr_resnet50_1.48.jpg │ ├── peds_0_detectnet_ssd-mobilenet-v2_22.18.jpg │ ├── peds_0_detr_resnet50_0.18.jpg │ ├── peds_1_detectnet_ssd-mobilenet-v2_20.56.jpg │ ├── peds_1_detr_resnet50_0.18.jpg │ ├── peds_2_detectnet_ssd-mobilenet-v2_12.65.jpg │ ├── peds_2_detr_resnet50_1.55.jpg │ ├── peds_3_detectnet_ssd-mobilenet-v2_22.79.jpg │ ├── peds_3_detr_resnet50_0.62.jpg │ ├── polar_bear_detectnet_ssd-mobilenet-v2_21.70.jpg │ ├── polar_bear_detr_resnet50_1.10.jpg │ ├── red_apple_0_detectnet_ssd-mobilenet-v2_22.53.jpg │ ├── red_apple_0_detr_resnet50_0.45.jpg │ ├── room_0_detectnet_ssd-mobilenet-v2_22.98.jpg │ ├── room_0_detr_resnet50_0.93.jpg │ ├── room_1_detectnet_ssd-mobilenet-v2_21.81.jpg │ ├── room_1_detr_resnet50_0.93.jpg │ ├── room_2_detectnet_ssd-mobilenet-v2_22.70.jpg │ ├── room_2_detr_resnet50_0.93.jpg │ ├── room_3_detectnet_ssd-mobilenet-v2_22.99.jpg │ ├── room_3_detr_resnet50_0.91.jpg │ ├── room_5_detectnet_ssd-mobilenet-v2_22.60.jpg │ ├── room_5_detr_resnet50_1.24.jpg │ ├── room_6_detectnet_ssd-mobilenet-v2_23.30.jpg │ ├── room_6_detr_resnet50_1.23.jpg │ ├── stingray_detectnet_ssd-mobilenet-v2_23.03.jpg │ └── stingray_detr_resnet50_1.07.jpg └── test_images │ ├── airplane_0.jpg │ ├── airplane_1.jpg │ ├── banana_0.jpg │ ├── bird_0.jpg │ ├── bird_1.jpg │ ├── bird_2.jpg │ ├── black_bear.jpg │ ├── bottle_0.jpg │ ├── cat_1.jpg │ ├── city_1.jpg │ ├── coral.jpg │ ├── desk.jpg │ ├── dog_0.jpg │ ├── dog_1.jpg │ ├── dog_2.jpg │ ├── dog_3.jpg │ ├── dog_5.jpg │ ├── granny_smith_0.jpg │ ├── horse_0.jpg │ ├── horse_1.jpg │ ├── horse_2.jpg │ ├── humans_0.jpg │ ├── humans_1.jpg │ ├── humans_2.jpg │ ├── humans_3.jpg │ ├── humans_4.jpg │ ├── humans_5.jpg │ ├── humans_6.jpg │ ├── humans_7.jpg │ ├── humans_8.jpg │ ├── humans_9.jpg │ ├── object_0.jpg │ ├── object_2.jpg │ ├── object_3.jpg │ ├── object_4.jpg │ ├── object_5.jpg │ ├── object_6.jpg │ ├── object_7.jpg │ ├── object_8.jpg │ ├── peds_0.jpg │ ├── peds_1.jpg │ ├── peds_2.jpg │ ├── peds_3.jpg │ ├── polar_bear.jpg │ ├── red_apple_0.jpg │ ├── room_0.jpg │ ├── room_1.jpg │ ├── room_2.jpg │ ├── room_3.jpg │ ├── room_5.jpg │ ├── room_6.jpg │ └── stingray.jpg ├── DETR └── detr.py ├── DeepStream 5.0 ├── YOLOv4 │ ├── DeepStream │ │ ├── config_infer_primary_yoloV3.txt │ │ ├── config_infer_primary_yoloV3_tiny.txt │ │ ├── config_infer_primary_yoloV4.txt │ │ ├── config_infer_primary_yoloV4_tiny.txt │ │ ├── deepstream_app_config_yoloV4.txt │ │ ├── deepstream_app_config_yoloV4_tiny.txt │ │ └── labels.txt │ ├── demo_yolo.py │ └── nvdsinfer_custom_impl_Yolo │ │ └── nvdsparsebbox_Yolo.cpp └── apps │ ├── deepstream-face │ ├── config_infer_primary_facedetectir.txt │ └── deepstream_face.py │ ├── deepstream-test1 │ └── deepstream_test_1_mp4.py │ └── deepstream-test2 │ ├── deepstream_test2_opencv.py │ ├── deepstream_test2_primary.py │ ├── deepstream_test2_secondary.py │ ├── dstest2_pgie_config.txt │ ├── dstest2_sgie1_config.txt │ ├── dstest2_sgie2_config.txt │ └── dstest2_sgie3_config.txt ├── Detectron2 PoseEstimation ├── metadata_keypoint.py ├── poseestimation.py └── poseestimation2.py ├── Detectron2 Segmentation Models ├── city_segmentation.py ├── instance_segmentation.py ├── instance_segmentation_box.py ├── instance_segmentation_mask.py ├── lvis-segmentation.py ├── metadata.py ├── panoptic_segmentation.py └── test_detectron2.py ├── Hello AI World ├── detectNet │ ├── 01.mp4 │ ├── detectnet-camera.py │ ├── detectnet-console.py │ ├── detectnet_face_console.py │ ├── detectnet_face_video.py │ ├── detectnet_webcam.py │ └── sbear.png └── imageNet │ ├── imagenet-camera.py │ ├── imagenet-console.py │ └── imagenet-webcam.py ├── Installing Mediapipe(CPU Mode) on Raspberry Pi ├── face.png ├── mp_face_mesh.py ├── mp_hand_perf.py └── mp_video_perf.py ├── JetsonNano - Installing the latest Pytorch 1.9 and Pose Estimation ├── keypoints2.py └── keypoints3.py ├── NVIDIA-AI-IOT └── trt_pose │ ├── detect_camera.py │ ├── detect_image.py │ └── detect_webcam.py ├── OpenCV camera control on Raspberry Pi BullsEye OS ├── preview.py └── preview_gstreamer.py ├── OpenPose 1.7 Programming on Jetson Series using CommandLine tools ├── image │ ├── blackping2.jpg │ └── blackpink.png └── study │ └── op_control.py ├── OpenPose 1.7 Python Programming on Jetson Series ├── 01_1_body_from_image.py ├── 01_2_body_from_video.py ├── 01_body_from_image.py ├── 02_whole_body_from_image.py ├── 04_keypoints_from_images.py ├── 06_face_from_image.py ├── 07_hand_from_image.py ├── 08_heatmaps_from_image.py ├── 09_keypoints_from_heatmaps.py ├── 12_1_asynchronous_custom_output.py └── 12_asynchronous_custom_output.py ├── README.md ├── Running OpenPose models directly from OpenCV ├── image │ ├── blackpink │ │ ├── blackping2.jpg │ │ └── blackpink.png │ ├── chaplin.mp4 │ └── walking.jpg ├── op_cv.py ├── op_cv_video.py ├── op_video.py ├── original.py └── output_test.py ├── XavierNX-OpenPose └── video.py ├── XavierNX-PoseEstimation using tensorflow(ResNet) └── update_code │ ├── dataset │ └── pose_dataset.py │ ├── demo │ ├── demo_multiperson.py │ ├── singleperson.py │ └── video_multiperson.py │ └── util │ └── visualize.py ├── XavierNX-PoseEstimation using tensorflow ├── run_video.py └── run_webcam.py ├── XavierNX-YOLOv8 ├── WUzgd7C1pWA.mp4 ├── bytetrack │ ├── __init__.py │ ├── __pycache__ │ │ ├── __init__.cpython-38.pyc │ │ ├── basetrack.cpython-38.pyc │ │ ├── byte_tracker.cpython-38.pyc │ │ ├── kalman_filter.cpython-38.pyc │ │ └── matching.cpython-38.pyc │ ├── basetrack.py │ ├── byte_tracker.py │ ├── config │ │ └── bytetrack.yaml │ ├── kalman_filter.py │ └── matching.py ├── config.py ├── highway_traffic.mp4 ├── line_boundary_check.py ├── models │ ├── __init__.py │ ├── __pycache__ │ │ ├── __init__.cpython-38.pyc │ │ ├── common.cpython-38.pyc │ │ ├── engine.cpython-38.pyc │ │ ├── torch_utils.cpython-38.pyc │ │ └── utils.cpython-38.pyc │ ├── api.py │ ├── common.py │ ├── cudart_api.py │ ├── engine.py │ ├── pycuda_api.py │ ├── torch_utils.py │ └── utils.py ├── sample.mp4 ├── sample_detect.py ├── sample_detect2.py ├── sample_detect3.py ├── sample_track.py ├── sample_track2.py ├── sample_track3.py ├── sample_track_trt.py ├── video_detect.py ├── video_detect2.py ├── video_detect_cv.py ├── video_detect_cv2.py ├── video_detect_cv_trt.py └── video_detect_torch.py ├── conversion Tensorflow model to TensorRT ├── pb_viewer.py └── tfmodel_2_trt.py ├── face-parsing ├── test.py ├── test2.py └── test3.py ├── face_recognition ├── digital_makeup.py ├── facematch2.py ├── findfaces2.py ├── identify2.py └── img │ ├── groups │ └── bill-steve-elon-keanu.jpg │ └── known │ ├── Elon Musk.jpg │ ├── biden.jpg │ └── spypiggy.jpg ├── object_detection ├── object_detection_rt.py ├── object_detection_webcam.py ├── pb_viewer.py └── tfmodel_2_trt.py ├── openpose-TX2 ├── missing cudnn header │ └── cudnn_v7.h ├── run_cam_tx2.py └── run_webcam_tx2.py ├── openpose ├── README.md ├── run_detect_keypoint.py └── run_webcam.py ├── raspberryPi-EdgeTPU-TensorflowLite ├── pose_camera_cv.py └── simple_pose2.py ├── test_images ├── airplane_0.jpg ├── airplane_1.jpg ├── banana_0.jpg ├── bird_0.jpg ├── bird_1.jpg ├── bird_2.jpg ├── black_bear.jpg ├── bottle_0.jpg ├── cat_1.jpg ├── city_1.jpg ├── coral.jpg ├── desk.jpg ├── dog_0.jpg ├── dog_1.jpg ├── dog_2.jpg ├── dog_3.jpg ├── dog_5.jpg ├── granny_smith_0.jpg ├── horse_0.jpg ├── horse_1.jpg ├── horse_2.jpg ├── humans_0.jpg ├── humans_1.jpg ├── humans_2.jpg ├── humans_3.jpg ├── humans_4.jpg ├── humans_5.jpg ├── humans_6.jpg ├── humans_7.jpg ├── humans_8.jpg ├── humans_9.jpg ├── object_0.jpg ├── object_2.jpg ├── object_3.jpg ├── object_4.jpg ├── object_5.jpg ├── object_6.jpg ├── object_7.jpg ├── object_8.jpg ├── peds_0.jpg ├── peds_1.jpg ├── peds_2.jpg ├── peds_3.jpg ├── polar_bear.jpg ├── red_apple_0.jpg ├── room_0.jpg ├── room_1.jpg ├── room_2.jpg ├── room_3.jpg ├── room_5.jpg ├── room_6.jpg └── stingray.jpg ├── tf-pose-estimation ├── README.md ├── images │ └── hong.jpg ├── run2.py ├── run_angle.py ├── tf_model_2_rt.py └── tf_pose │ ├── README.md │ └── estimator.py ├── torchvision_walkthrough ├── imgs │ ├── COCO_294.jpg │ └── apink1.jpg ├── keypoints.py ├── keypoints2.py └── video_gpu.py ├── trt_pose ├── detect_image.py ├── detect_image2.py └── detect_video2.py ├── useful_scripts ├── install_opencv4.1.1_Nano.sh ├── install_opencv4.1.1_TX2.sh ├── install_opencv4.7_NX.sh ├── install_protobuf.sh ├── nvresizefs.sh ├── opencv4.4_jetson_nano.sh ├── opencv4.4_jetson_tx2.sh ├── opencv4.4_xavier_nx.sh ├── opencv4.5_jetson_nano.sh ├── opencv4.5_jetson_tx2.sh └── opencv4.5_xavier_nx.sh └── webcam └── webcam_capability.py /BeautyGAN/imgs/no_makeup/lee.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raspberry-pi-maker/NVIDIA-Jetson/30a5596aa0d9a6a960f2fef4d084eb42a94a2b66/BeautyGAN/imgs/no_makeup/lee.jpg -------------------------------------------------------------------------------- /BeautyGAN/main.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | import tensorflow as tf 4 | import numpy as np 5 | import os 6 | import glob 7 | from imageio import imread, imsave 8 | import cv2 9 | import argparse 10 | 11 | parser = argparse.ArgumentParser() 12 | parser.add_argument('--no_makeup', type=str, default=os.path.join('imgs', 'no_makeup', 'xfsy_0068.png'), help='path to the no_makeup image') 13 | args = parser.parse_args() 14 | 15 | def preprocess(img): 16 | return (img / 255. - 0.5) * 2 17 | 18 | def deprocess(img): 19 | return (img + 1) / 2 20 | 21 | batch_size = 1 22 | img_size = 256 23 | no_makeup = cv2.resize(imread(args.no_makeup), (img_size, img_size)) 24 | X_img = np.expand_dims(preprocess(no_makeup), 0) 25 | makeups = glob.glob(os.path.join('imgs', 'makeup', '*.*')) 26 | result = np.ones((2 * img_size, (len(makeups) + 1) * img_size, 3)) 27 | result[img_size: 2 * img_size, :img_size] = no_makeup / 255. 28 | 29 | tf.reset_default_graph() 30 | sess = tf.Session() 31 | sess.run(tf.global_variables_initializer()) 32 | 33 | saver = tf.train.import_meta_graph(os.path.join('models', 'model.meta')) 34 | saver.restore(sess, tf.train.latest_checkpoint('models')) 35 | 36 | graph = tf.get_default_graph() 37 | X = graph.get_tensor_by_name('X:0') 38 | Y = graph.get_tensor_by_name('Y:0') 39 | Xs = graph.get_tensor_by_name('generator/xs:0') 40 | 41 | for i in range(len(makeups)): 42 | makeup = cv2.resize(imread(makeups[i]), (img_size, img_size)) 43 | Y_img = np.expand_dims(preprocess(makeup), 0) 44 | Xs_ = sess.run(Xs, feed_dict={X: X_img, Y: Y_img}) 45 | Xs_ = deprocess(Xs_) 46 | result[:img_size, (i + 1) * img_size: (i + 2) * img_size] = makeup / 255. 47 | result[img_size: 2 * img_size, (i + 1) * img_size: (i + 2) * img_size] = Xs_[0] 48 | 49 | imsave('result.jpg', result) 50 | -------------------------------------------------------------------------------- /BeautyGAN/makeup.py: -------------------------------------------------------------------------------- 1 | 2 | import tensorflow as tf 3 | import numpy as np 4 | import os 5 | import glob 6 | from imageio import imread, imsave 7 | import cv2 8 | import argparse 9 | 10 | parser = argparse.ArgumentParser() 11 | parser.add_argument('--no_makeup', type=str, default=os.path.join('imgs', 'no_makeup', 'xfsy_0068.png'), help='path to the no_makeup image') 12 | parser.add_argument('--makeup', type=str, default=os.path.join('imgs', 'makeup', 'XMY-014.png'), help='path to the makeup image') 13 | args = parser.parse_args() 14 | 15 | def preprocess(img): 16 | return (img / 255. - 0.5) * 2 17 | 18 | def deprocess(img): 19 | return ((img + 1.) * 127.5).astype(np.uint8) 20 | 21 | batch_size = 1 22 | img_size = 256 23 | no_makeup = cv2.resize(cv2.imread(args.no_makeup, cv2.IMREAD_COLOR), (img_size, img_size)) 24 | no_makeup = cv2.cvtColor(no_makeup, cv2.COLOR_BGR2RGB) 25 | 26 | X_img = np.expand_dims(preprocess(no_makeup), 0) 27 | makeup_image = args.makeup 28 | 29 | tf.reset_default_graph() 30 | sess = tf.Session() 31 | sess.run(tf.global_variables_initializer()) 32 | 33 | saver = tf.train.import_meta_graph(os.path.join('models', 'model.meta')) 34 | saver.restore(sess, tf.train.latest_checkpoint('models')) 35 | 36 | graph = tf.get_default_graph() 37 | X = graph.get_tensor_by_name('X:0') 38 | Y = graph.get_tensor_by_name('Y:0') 39 | Xs = graph.get_tensor_by_name('generator/xs:0') 40 | 41 | makeup = cv2.resize(imread(makeup_image), (img_size, img_size)) 42 | Y_img = np.expand_dims(preprocess(makeup), 0) 43 | Xs_ = sess.run(Xs, feed_dict={X: X_img, Y: Y_img}) 44 | Xs_ = deprocess(Xs_) 45 | img = cv2.cvtColor(Xs_[0], cv2.COLOR_RGB2BGR) 46 | cv2.imwrite('makeup.jpg', img) 47 | 48 | 49 | -------------------------------------------------------------------------------- /Building Tensorflow Lite for Raspberry Pi OS 64bit/raspberry/download.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | if [ $# -eq 0 ]; then 4 | DATA_DIR="./" 5 | else 6 | DATA_DIR="$1" 7 | fi 8 | 9 | # Download TF Lite models 10 | FILE=${DATA_DIR}/efficientdet_lite0.tflite 11 | if [ ! -f "$FILE" ]; then 12 | curl \ 13 | -L 'https://tfhub.dev/tensorflow/lite-model/efficientdet/lite0/detection/metadata/1?lite-format=tflite' \ 14 | -o ${FILE} 15 | fi 16 | FILE=${DATA_DIR}/efficientdet_lite0_edgetpu.tflite 17 | if [ ! -f "$FILE" ]; then 18 | curl \ 19 | -L 'https://storage.googleapis.com/download.tensorflow.org/models/tflite/edgetpu/efficientdet_lite0_edgetpu_metadata.tflite' \ 20 | -o ${FILE} 21 | fi 22 | 23 | FILE=${DATA_DIR}/efficientdet_lite1.tflite 24 | if [ ! -f "$FILE" ]; then 25 | curl \ 26 | -L 'https://tfhub.dev/tensorflow/lite-model/efficientdet/lite1/detection/metadata/1?lite-format=tflite' \ 27 | -o ${FILE} 28 | fi 29 | FILE=${DATA_DIR}/efficientdet_lite1_edgetpu.tflite 30 | if [ ! -f "$FILE" ]; then 31 | curl \ 32 | -L 'https://storage.googleapis.com/download.tensorflow.org/models/tflite/edgetpu/efficientdet_lite1_edgetpu_metadata.tflite' \ 33 | -o ${FILE} 34 | fi 35 | 36 | FILE=${DATA_DIR}/efficientdet_lite2.tflite 37 | if [ ! -f "$FILE" ]; then 38 | curl \ 39 | -L 'https://tfhub.dev/tensorflow/lite-model/efficientdet/lite2/detection/metadata/1?lite-format=tflite' \ 40 | -o ${FILE} 41 | fi 42 | FILE=${DATA_DIR}/efficientdet_lite2_edgetpu.tflite 43 | if [ ! -f "$FILE" ]; then 44 | curl \ 45 | -L 'https://storage.googleapis.com/download.tensorflow.org/models/tflite/edgetpu/efficientdet_lite2_edgetpu_metadata.tflite' \ 46 | -o ${FILE} 47 | fi 48 | 49 | 50 | FILE=${DATA_DIR}/efficientdet_lite3.tflite 51 | if [ ! -f "$FILE" ]; then 52 | curl \ 53 | -L 'https://tfhub.dev/tensorflow/lite-model/efficientdet/lite3/detection/metadata/1?lite-format=tflite' \ 54 | -o ${FILE} 55 | fi 56 | FILE=${DATA_DIR}/efficientdet_lite3_edgetpu.tflite 57 | if [ ! -f "$FILE" ]; then 58 | curl \ 59 | -L 'https://storage.googleapis.com/download.tensorflow.org/models/tflite/edgetpu/efficientdet_lite3_edgetpu_metadata.tflite' \ 60 | -o ${FILE} 61 | fi 62 | 63 | FILE=${DATA_DIR}/efficientdet_lite4.tflite 64 | if [ ! -f "$FILE" ]; then 65 | curl \ 66 | -L 'https://tfhub.dev/tensorflow/lite-model/efficientdet/lite4/detection/metadata/1?lite-format=tflite' \ 67 | -o ${FILE} 68 | fi 69 | FILE=${DATA_DIR}/efficientdet_lite4_edgetpu.tflite 70 | if [ ! -f "$FILE" ]; then 71 | curl \ 72 | -L 'https://storage.googleapis.com/download.tensorflow.org/models/tflite/edgetpu/efficientdet_lite4_edgetpu_metadata.tflite' \ 73 | -o ${FILE} 74 | fi 75 | echo -e "Downloaded files are in ${DATA_DIR}" -------------------------------------------------------------------------------- /Building Tensorflow Lite for Raspberry Pi OS 64bit/raspberry/sample_image.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raspberry-pi-maker/NVIDIA-Jetson/30a5596aa0d9a6a960f2fef4d084eb42a94a2b66/Building Tensorflow Lite for Raspberry Pi OS 64bit/raspberry/sample_image.jpg -------------------------------------------------------------------------------- /Building Tensorflow Lite for Raspberry Pi OS 64bit/tensorflow/tensorflow/lite/tools/pip_package/Dockerfile.py3: -------------------------------------------------------------------------------- 1 | ARG IMAGE 2 | FROM ${IMAGE} 3 | ARG PYTHON_VERSION 4 | 5 | ARG DEBIAN_FRONTEND=noninteractive 6 | 7 | COPY update_sources.sh / 8 | RUN /update_sources.sh 9 | 10 | RUN dpkg --add-architecture armhf 11 | RUN dpkg --add-architecture arm64 12 | 13 | RUN echo 'deb [arch=arm64,armhf] http://ports.ubuntu.com/ bionic main restricted universe multiverse' >> /etc/apt/sources.list.d/armhf.list 14 | RUN echo 'deb [arch=arm64,armhf] http://ports.ubuntu.com/ bionic-updates main restricted universe multiverse' >> /etc/apt/sources.list.d/armhf.list 15 | RUN echo 'deb [arch=arm64,armhf] http://ports.ubuntu.com/ bionic-security main restricted universe multiverse' >> /etc/apt/sources.list.d/armhf.list 16 | RUN echo 'deb [arch=arm64,armhf] http://ports.ubuntu.com/ bionic-backports main restricted universe multiverse' >> /etc/apt/sources.list.d/armhf.list 17 | RUN sed -i 's#deb http://archive.ubuntu.com/ubuntu/#deb [arch=amd64] http://archive.ubuntu.com/ubuntu/#g' /etc/apt/sources.list 18 | 19 | 20 | RUN apt-get update && \ 21 | apt-get install -y \ 22 | software-properties-common \ 23 | debhelper \ 24 | crossbuild-essential-armhf \ 25 | crossbuild-essential-arm64 \ 26 | zlib1g-dev \ 27 | zlib1g-dev:armhf \ 28 | zlib1g-dev:arm64 \ 29 | curl \ 30 | unzip \ 31 | git && \ 32 | apt-get clean 33 | 34 | RUN yes | add-apt-repository ppa:deadsnakes/ppa 35 | RUN apt-get update && \ 36 | apt-get install -y \ 37 | python$PYTHON_VERSION \ 38 | python$PYTHON_VERSION-dev \ 39 | python$PYTHON_VERSION-distutils \ 40 | libpython$PYTHON_VERSION-dev \ 41 | libpython$PYTHON_VERSION-dev:armhf \ 42 | libpython$PYTHON_VERSION-dev:arm64 43 | 44 | RUN ln -sf /usr/bin/python$PYTHON_VERSION /usr/bin/python3 45 | RUN curl -OL https://bootstrap.pypa.io/get-pip.py 46 | RUN python3 get-pip.py 47 | RUN rm get-pip.py 48 | RUN pip3 install --upgrade pip 49 | RUN pip3 install numpy~=1.19.2 setuptools pybind11 50 | RUN ln -sf /usr/include/python$PYTHON_VERSION /usr/include/python3 51 | RUN ln -sf /usr/local/lib/python$PYTHON_VERSION/dist-packages/numpy/core/include/numpy /usr/include/python3/numpy 52 | RUN curl -OL https://github.com/Kitware/CMake/releases/download/v3.16.8/cmake-3.16.8-Linux-x86_64.sh 53 | RUN mkdir /opt/cmake 54 | RUN sh cmake-3.16.8-Linux-x86_64.sh --prefix=/opt/cmake --skip-license 55 | RUN ln -s /opt/cmake/bin/cmake /usr/local/bin/cmake 56 | -------------------------------------------------------------------------------- /Building Tensorflow Lite for Raspberry Pi OS 64bit/tensorflow/tensorflow/lite/tools/pip_package/Makefile: -------------------------------------------------------------------------------- 1 | # Values: debian:, ubuntu: 2 | BASE_IMAGE ?= debian:buster 3 | # Values: python, python3 4 | PYTHON ?= python3 5 | # Values: rpi, aarch64, native 6 | TENSORFLOW_TARGET ?= native 7 | # Values: n, y 8 | BUILD_DEB ?= n 9 | # Values: according to https://www.python.org/dev/peps/pep-0440/ 10 | VERSION_SUFFIX ?= 11 | 12 | MAKEFILE_DIR := $(realpath $(dir $(lastword $(MAKEFILE_LIST)))) 13 | TENSORFLOW_DIR := $(MAKEFILE_DIR)/../../../.. 14 | OUT_DIR := $(CURDIR)/out/$(PYTHON)/$(subst :,-,$(BASE_IMAGE)) 15 | TAG_IMAGE := "tflite-runtime-builder-$(subst :,-,$(BASE_IMAGE))" 16 | 17 | .PHONY: help \ 18 | docker-image \ 19 | docker-shell \ 20 | docker-build \ 21 | clean 22 | 23 | help: 24 | @echo "make docker-image -- build docker image" 25 | @echo "make docker-shell -- run shell inside the docker image" 26 | @echo "make docker-build -- build wheel and deb inside the docker image" 27 | @echo "make clean -- remove wheel and deb files" 28 | 29 | 30 | docker-image: 31 | ifeq ($(BASE_IMAGE),ubuntu:18.04) 32 | docker build -t $(TAG_IMAGE) --build-arg IMAGE=$(BASE_IMAGE) --build-arg PYTHON_VERSION=$(PYTHON_VERSION) -f Dockerfile.py3 . 33 | else 34 | docker build -t $(TAG_IMAGE) --build-arg IMAGE=$(BASE_IMAGE) . 35 | endif 36 | 37 | docker-shell: docker-image 38 | docker run --rm --interactive --tty \ 39 | --volume $(TENSORFLOW_DIR):/tensorflow \ 40 | --workdir /tensorflow \ 41 | $(TAG_IMAGE) 42 | 43 | docker-build: docker-image 44 | mkdir -p $(OUT_DIR) 45 | docker run --user $(shell id -u):$(shell id -g) \ 46 | --rm --interactive $(shell tty -s && echo --tty) \ 47 | --env "PYTHON=$(PYTHON)" \ 48 | --env "TENSORFLOW_TARGET=$(TENSORFLOW_TARGET)" \ 49 | --env "BUILD_DEB=$(BUILD_DEB)" \ 50 | --env "VERSION_SUFFIX=$(VERSION_SUFFIX)" \ 51 | --volume $(TENSORFLOW_DIR):/tensorflow \ 52 | --volume $(OUT_DIR):/out \ 53 | $(TAG_IMAGE) \ 54 | /bin/bash -c "/tensorflow/tensorflow/lite/tools/pip_package/build_pip_package_with_cmake.sh && \ 55 | (cp /tensorflow/tensorflow/lite/tools/pip_package/gen/tflite_pip/*.deb \ 56 | /tensorflow/tensorflow/lite/tools/pip_package/gen/tflite_pip/${PYTHON}/dist/{*.whl,*.tar.gz} \ 57 | /out 2>/dev/null || true)" 58 | 59 | clean: 60 | rm -rf $(CURDIR)/out -------------------------------------------------------------------------------- /Building Tensorflow Lite for Raspberry Pi OS 64bit/tensorflow/tensorflow/tools/ci_build/Dockerfile.pi-python39: -------------------------------------------------------------------------------- 1 | FROM ubuntu:18.04 2 | 3 | LABEL maintainer="Katsuya Hyodo " 4 | 5 | ENV CI_BUILD_PYTHON=python3.9 6 | ENV CROSSTOOL_PYTHON_INCLUDE_PATH=/usr/include/python3.9 7 | 8 | ARG DEBIAN_FRONTEND=noninteractive 9 | # Copy and run the install scripts. 10 | COPY install/*.sh /install/ 11 | 12 | RUN /install/install_bootstrap_deb_packages.sh 13 | RUN add-apt-repository -y ppa:openjdk-r/ppa 14 | RUN /install/install_deb_packages.sh --without_cmake 15 | RUN /install/install_cmake.sh 16 | 17 | # The following line installs the Python 3.9 cross-compilation toolchain. 18 | RUN /install/install_pi_python3x_toolchain.sh "3.9" 19 | 20 | RUN /install/install_bazel.sh 21 | RUN /install/install_proto3.sh 22 | RUN /install/install_buildifier.sh 23 | RUN /install/install_auditwheel.sh "3.9" 24 | RUN /install/install_golang.sh 25 | 26 | # Set up the master bazelrc configuration file. 27 | COPY install/.bazelrc /etc/bazel.bazelrc 28 | RUN chmod 644 /etc/bazel.bazelrc 29 | 30 | # XLA is not needed for PI 31 | ENV TF_ENABLE_XLA=0 -------------------------------------------------------------------------------- /Building Tensorflow Lite for Raspberry Pi OS 64bit/tensorflow/tensorflow/tools/ci_build/install/install_auditwheel.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # Copyright 2015 The TensorFlow Authors. All Rights Reserved. 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | # ============================================================================== 16 | 17 | set -e 18 | PYTHON_VERSION=$1 19 | 20 | if [[ "$PYTHON_VERSION" == "3.9" ]]; then 21 | sudo pip3 install setuptools==60.7.0 22 | sudo pip3 install numpy==1.22.1 23 | fi 24 | 25 | sudo pip3 install auditwheel==2.0.0 26 | 27 | # Pin wheel==0.31.1 to work around issue 28 | # https://github.com/pypa/auditwheel/issues/102 29 | 30 | sudo pip3 install wheel==0.31.1 31 | #sudo pip3 install wheel 32 | 33 | set +e 34 | patchelf_location=$(which patchelf) 35 | if [[ -z "$patchelf_location" ]]; then 36 | set -e 37 | # Install patchelf from source (it does not come with trusty package) 38 | wget https://nixos.org/releases/patchelf/patchelf-0.9/patchelf-0.9.tar.bz2 39 | tar xfa patchelf-0.9.tar.bz2 40 | cd patchelf-0.9 41 | ./configure --prefix=/usr/local 42 | make 43 | sudo make install 44 | fi 45 | cd .. 46 | -------------------------------------------------------------------------------- /Building Tensorflow Lite for Raspberry Pi OS 64bit/tensorflow/tensorflow/tools/ci_build/install/install_pi_python3x_toolchain.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # Copyright 2017 The TensorFlow Authors. All Rights Reserved. 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | # ============================================================================== 16 | 17 | PYTHON_VERSION=$1 18 | dpkg --add-architecture armhf 19 | dpkg --add-architecture arm64 20 | echo 'deb [arch=arm64,armhf] http://ports.ubuntu.com/ bionic main restricted universe multiverse' >> /etc/apt/sources.list.d/armhf.list 21 | echo 'deb [arch=arm64,armhf] http://ports.ubuntu.com/ bionic-updates main restricted universe multiverse' >> /etc/apt/sources.list.d/armhf.list 22 | echo 'deb [arch=arm64,armhf] http://ports.ubuntu.com/ bionic-security main restricted universe multiverse' >> /etc/apt/sources.list.d/armhf.list 23 | echo 'deb [arch=arm64,armhf] http://ports.ubuntu.com/ bionic-backports main restricted universe multiverse' >> /etc/apt/sources.list.d/armhf.list 24 | sed -i 's#deb http://archive.ubuntu.com/ubuntu/#deb [arch=amd64] http://archive.ubuntu.com/ubuntu/#g' /etc/apt/sources.list 25 | yes | add-apt-repository ppa:deadsnakes/ppa 26 | apt-get update 27 | apt-get install -y python${PYTHON_VERSION} python${PYTHON_VERSION}-dev 28 | #/usr/local/bin/python3.x is needed to use /install/install_pip_packages_by_version.sh 29 | ln -sf /usr/bin/python${PYTHON_VERSION} /usr/local/bin/python${PYTHON_VERSION} 30 | apt-get install -y libpython${PYTHON_VERSION}-dev:armhf 31 | apt-get install -y libpython${PYTHON_VERSION}-dev:arm64 32 | 33 | SPLIT_VERSION=(`echo ${PYTHON_VERSION} | tr -s '.' ' '`) 34 | if [[ SPLIT_VERSION[0] -eq 3 ]] && [[ SPLIT_VERSION[1] -ge 8 ]]; then 35 | apt-get install -y python${PYTHON_VERSION}-distutils 36 | fi 37 | 38 | /install/install_pip_packages_by_version.sh "/usr/local/bin/pip${PYTHON_VERSION}" 39 | ln -sf /usr/local/lib/python${PYTHON_VERSION}/dist-packages/numpy/core/include/numpy /usr/include/python${PYTHON_VERSION}/numpy 40 | -------------------------------------------------------------------------------- /Camera Control Python Programming on Raspberry Pi BullsEye/legacy/preview.py: -------------------------------------------------------------------------------- 1 | from picamera import PiCamera 2 | from time import sleep 3 | 4 | f_res = None 5 | def set_resolution(ver, index): 6 | global f_res, camera 7 | res = {"v1":[(2592,1944),(1920, 1280),(1296, 972), (1296, 730),(640, 480)], 8 | "v2":[(2592,1944),(1920, 1280),(1296, 972), (1296, 730),(640, 480)] 9 | } 10 | f_res = res[ver][index] 11 | print("final resolution", f_res) 12 | camera.resolution = f_res 13 | 14 | camera = PiCamera() 15 | set_resolution("v1", 4) 16 | camera.start_preview(fullscreen=False,window=(0,0,f_res[0],f_res[1])) 17 | sleep(5) 18 | camera.stop_preview() -------------------------------------------------------------------------------- /Camera Control Python Programming on Raspberry Pi BullsEye/legacy/saveimage.py: -------------------------------------------------------------------------------- 1 | from picamera import PiCamera, Color 2 | from time import sleep 3 | f_res = None 4 | 5 | def set_resolution(ver, index): 6 | global f_res, camera 7 | res = {"v1":[(2592,1944),(1920, 1280),(1296, 972), (1296, 730),(640, 480)], 8 | "v2":[(3280,2464),(2592,1944),(1920, 1280),(1296, 972), (1296, 730),(640, 480)] 9 | } 10 | f_res = res[ver][index] 11 | print("final resolution", f_res) 12 | camera.resolution = f_res 13 | 14 | 15 | camera = PiCamera() 16 | set_resolution("v2", 0) 17 | # camera.annotate_background = Color('blue') 18 | # camera.annotate_foreground = Color('yellow') 19 | # camera.annotate_text = " Hello world " 20 | # camera.brightness = 70 21 | camera.start_preview(fullscreen=False,window=(0,0,1280,960)) 22 | 23 | sleep(5) 24 | camera.capture('/home/pi/src/legacy/picamera_cap.jpg') 25 | camera.stop_preview() 26 | -------------------------------------------------------------------------------- /Camera Control Python Programming on Raspberry Pi BullsEye/legacy/savevideo.py: -------------------------------------------------------------------------------- 1 | from picamera import PiCamera, PiCameraValueError 2 | from time import sleep 3 | f_res = None 4 | 5 | def set_resolution(ver, index): 6 | global f_res, camera 7 | res = {"v1":[(2592,1944),(1920, 1280),(1296, 972), (1296, 730),(1024, 768),(800, 600),(640, 480)], 8 | "v2":[(3280,2464),(2592,1944),(1920, 1280),(1296, 972), (1296, 730),(1024, 768),(800, 600),(640, 480)] 9 | } 10 | f_res = res[ver][index] 11 | print("final resolution", f_res) 12 | camera.resolution = f_res 13 | camera = PiCamera() 14 | set_resolution("v2", 3) 15 | camera.start_preview(fullscreen=False,window=(0,0,1280,960)) 16 | try: 17 | camera.start_recording('/home/pi/src/legacy/picamera.h264') 18 | sleep(5) 19 | camera.stop_recording() 20 | except PiCameraValueError as err: 21 | print("Picamera Err:", err) 22 | print("Please use another resolution") 23 | 24 | camera.stop_preview() 25 | -------------------------------------------------------------------------------- /Camera Control Python Programming on Raspberry Pi BullsEye/libcamera/preview.py: -------------------------------------------------------------------------------- 1 | import cv2 2 | import numpy as np 3 | import sys 4 | import time 5 | 6 | connstr = None 7 | f_res = None 8 | def set_resolution(ver, index): 9 | global f_res, cap, connstr 10 | form = '''libcamerasrc ! video/x-raw, width={}, height={}, framerate=30/1 ! videoconvert ! videoscale ! appsink''' 11 | res = {"v1":[(2592,1944),(1920, 1280),(1296, 972), (1296, 730),(640, 480)], 12 | "v2":[(2592,1944),(1920, 1280),(1296, 972), (1296, 730),(640, 480)] 13 | } 14 | f_res = res[ver][index] 15 | connstr = form.format(f_res[0], f_res[1]) 16 | print("GStreamer PipeLine:", connstr) 17 | 18 | 19 | set_resolution("v1", 4) 20 | 21 | cap = cv2.VideoCapture(connstr, cv2.CAP_GSTREAMER) 22 | if cap.isOpened() == False: 23 | print('camera open Failed') 24 | sys.exit(0) 25 | 26 | start = time.time() 27 | while cap.isOpened(): 28 | _, img = cap.read() 29 | k = cv2.waitKey(1) 30 | if k == ord('q'): 31 | break 32 | 33 | cv2.imshow('Img',img) 34 | elapsed = time.time() - start 35 | if(elapsed > 5) : 36 | break 37 | cap.release() 38 | cv2.destroyAllWindows() -------------------------------------------------------------------------------- /Camera Control Python Programming on Raspberry Pi BullsEye/libcamera/saveimage.py: -------------------------------------------------------------------------------- 1 | import cv2 2 | import numpy as np 3 | import sys 4 | import time 5 | 6 | connstr = None 7 | f_res = None 8 | def set_resolution(ver, index): 9 | global f_res, cap, connstr 10 | form = '''libcamerasrc ! video/x-raw, width={}, height={}, framerate=30/1 ! videoconvert ! videoscale ! appsink''' 11 | res = {"v1":[(2592,1944),(1920, 1280),(1296, 972), (1296, 730),(640, 480)], 12 | "v2":[(2592,1944),(1920, 1280),(1296, 972), (1296, 730),(640, 480)] 13 | } 14 | f_res = res[ver][index] 15 | connstr = form.format(f_res[0], f_res[1]) 16 | print("GStreamer PipeLine:", connstr) 17 | 18 | 19 | set_resolution("v1", 4) 20 | 21 | cap = cv2.VideoCapture(connstr, cv2.CAP_GSTREAMER) 22 | if cap.isOpened() == False: 23 | print('camera open Failed') 24 | sys.exit(0) 25 | 26 | start = time.time() 27 | while cap.isOpened(): 28 | _, img = cap.read() 29 | k = cv2.waitKey(1) 30 | if k == ord('q'): 31 | break 32 | 33 | cv2.imshow('Img',img) 34 | elapsed = time.time() - start 35 | if(elapsed > 5) : 36 | cv2.imwrite('/home/pi/src/libcamera/picamera_cap.jpg', img) 37 | break 38 | cap.release() 39 | cv2.destroyAllWindows() 40 | -------------------------------------------------------------------------------- /Camera Control Python Programming on Raspberry Pi BullsEye/libcamera/savevideo.py: -------------------------------------------------------------------------------- 1 | import cv2 2 | import numpy as np 3 | import sys 4 | import time 5 | 6 | connstr = None 7 | f_res = None 8 | def set_resolution(ver, index): 9 | global f_res, cap, connstr 10 | form = '''libcamerasrc ! video/x-raw, width={}, height={}, framerate=30/1 ! videoconvert ! videoscale ! appsink''' 11 | res = {"v1":[(2592,1944),(1920, 1280),(1296, 972), (1296, 730),(640, 480)], 12 | "v2":[(2592,1944),(1920, 1280),(1296, 972), (1296, 730),(640, 480)] 13 | } 14 | f_res = res[ver][index] 15 | connstr = form.format(f_res[0], f_res[1]) 16 | print("GStreamer PipeLine:", connstr) 17 | 18 | 19 | set_resolution("v1", 4) 20 | cap = cv2.VideoCapture(connstr, cv2.CAP_GSTREAMER) 21 | if cap.isOpened() == False: 22 | print('camera open Failed') 23 | sys.exit(0) 24 | fourcc = cv2.VideoWriter_fourcc('m', 'p', '4', 'v') 25 | out_video = cv2.VideoWriter('/home/pi/src/libcamera/picamera.mp4', fourcc, cap.get(cv2.CAP_PROP_FPS), f_res) 26 | 27 | start = time.time() 28 | while cap.isOpened(): 29 | _, img = cap.read() 30 | k = cv2.waitKey(1) 31 | if k == ord('q'): 32 | break 33 | 34 | cv2.imshow('Img',img) 35 | out_video.write(img) 36 | elapsed = time.time() - start 37 | if(elapsed > 5) : 38 | break 39 | cap.release() 40 | out_video.release() 41 | cv2.destroyAllWindows() 42 | 43 | -------------------------------------------------------------------------------- /CartoonGAN-Pytorch/test.py: -------------------------------------------------------------------------------- 1 | import torch 2 | import os 3 | import numpy as np 4 | import argparse 5 | from PIL import Image 6 | import torchvision.transforms as transforms 7 | from torch.autograd import Variable 8 | import torchvision.utils as vutils 9 | from network.Transformer import Transformer 10 | import gc 11 | 12 | parser = argparse.ArgumentParser() 13 | parser.add_argument('--input_dir', type=str, default = 'test_img') 14 | parser.add_argument('--load_size', type=int, default = 450) 15 | parser.add_argument('--model_path', type=str, default = './pretrained_model') 16 | parser.add_argument('--style', type=str, default = 'Hayao') 17 | parser.add_argument('--output_dir', type=str, default = 'test_output') 18 | parser.add_argument('--gpu', type=int, default = 0) 19 | 20 | opt = parser.parse_args() 21 | 22 | valid_ext = ['.jpg', '.png'] 23 | 24 | if not os.path.exists(opt.output_dir): os.mkdir(opt.output_dir) 25 | 26 | # load pretrained model 27 | model = Transformer() 28 | model.load_state_dict(torch.load(os.path.join(opt.model_path, opt.style + '_net_G_float.pth'))) 29 | model.eval() 30 | 31 | if opt.gpu > -1: 32 | print('GPU mode') 33 | model.cuda() 34 | else: 35 | print('CPU mode') 36 | model.float() 37 | 38 | for files in os.listdir(opt.input_dir): 39 | torch.cuda.empty_cache() 40 | gc.collect() 41 | ext = os.path.splitext(files)[1] 42 | if ext not in valid_ext: 43 | continue 44 | print('process file:' + files) 45 | # load image 46 | input_image = Image.open(os.path.join(opt.input_dir, files)).convert("RGB") 47 | # resize image, keep aspect ratio 48 | h = input_image.size[0] 49 | w = input_image.size[1] 50 | ratio = h *1.0 / w 51 | if ratio > 1: 52 | h = opt.load_size 53 | w = int(h*1.0/ratio) 54 | else: 55 | w = opt.load_size 56 | h = int(w * ratio) 57 | input_image = input_image.resize((h, w), Image.BICUBIC) 58 | input_image = np.asarray(input_image) 59 | print(input_image.shape) 60 | # RGB -> BGR 61 | input_image = input_image[:, :, [2, 1, 0]] 62 | input_image = transforms.ToTensor()(input_image).unsqueeze(0) 63 | # preprocess, (-1, 1) 64 | input_image = -1 + 2 * input_image 65 | 66 | 67 | with torch.no_grad(): 68 | if opt.gpu > -1: 69 | input_image = Variable(input_image).cuda() 70 | else: 71 | input_image = Variable(input_image).float() 72 | # forward 73 | output_image = model(input_image) 74 | output_image = output_image[0] 75 | # BGR -> RGB 76 | output_image = output_image[[2, 1, 0], :, :] 77 | # deprocess, (0, 1) 78 | output_image = output_image.data.cpu().float() * 0.5 + 0.5 79 | # save 80 | vutils.save_image(output_image, os.path.join(opt.output_dir, files[:-4] + '_' + opt.style + '.jpg')) 81 | print(files + ' save success') 82 | 83 | print('Done!') 84 | -------------------------------------------------------------------------------- /CartoonGAN-Pytorch/test_img/ai_img1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raspberry-pi-maker/NVIDIA-Jetson/30a5596aa0d9a6a960f2fef4d084eb42a94a2b66/CartoonGAN-Pytorch/test_img/ai_img1.jpg -------------------------------------------------------------------------------- /CartoonGAN-Pytorch/test_img/ai_img2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raspberry-pi-maker/NVIDIA-Jetson/30a5596aa0d9a6a960f2fef4d084eb42a94a2b66/CartoonGAN-Pytorch/test_img/ai_img2.jpg -------------------------------------------------------------------------------- /DETR-vs-detectNet/result/airplane_0_detectnet_ssd-mobilenet-v2_22.41.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raspberry-pi-maker/NVIDIA-Jetson/30a5596aa0d9a6a960f2fef4d084eb42a94a2b66/DETR-vs-detectNet/result/airplane_0_detectnet_ssd-mobilenet-v2_22.41.jpg -------------------------------------------------------------------------------- /DETR-vs-detectNet/result/airplane_0_detr_resnet50_1.50.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raspberry-pi-maker/NVIDIA-Jetson/30a5596aa0d9a6a960f2fef4d084eb42a94a2b66/DETR-vs-detectNet/result/airplane_0_detr_resnet50_1.50.jpg -------------------------------------------------------------------------------- /DETR-vs-detectNet/result/airplane_1_detectnet_ssd-mobilenet-v2_22.65.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raspberry-pi-maker/NVIDIA-Jetson/30a5596aa0d9a6a960f2fef4d084eb42a94a2b66/DETR-vs-detectNet/result/airplane_1_detectnet_ssd-mobilenet-v2_22.65.jpg -------------------------------------------------------------------------------- /DETR-vs-detectNet/result/airplane_1_detr_resnet50_1.30.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raspberry-pi-maker/NVIDIA-Jetson/30a5596aa0d9a6a960f2fef4d084eb42a94a2b66/DETR-vs-detectNet/result/airplane_1_detr_resnet50_1.30.jpg -------------------------------------------------------------------------------- /DETR-vs-detectNet/result/banana_0_detectnet_ssd-mobilenet-v2_24.05.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raspberry-pi-maker/NVIDIA-Jetson/30a5596aa0d9a6a960f2fef4d084eb42a94a2b66/DETR-vs-detectNet/result/banana_0_detectnet_ssd-mobilenet-v2_24.05.jpg -------------------------------------------------------------------------------- /DETR-vs-detectNet/result/banana_0_detr_resnet50_0.49.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raspberry-pi-maker/NVIDIA-Jetson/30a5596aa0d9a6a960f2fef4d084eb42a94a2b66/DETR-vs-detectNet/result/banana_0_detr_resnet50_0.49.jpg -------------------------------------------------------------------------------- /DETR-vs-detectNet/result/bird_0_detectnet_ssd-mobilenet-v2_21.24.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raspberry-pi-maker/NVIDIA-Jetson/30a5596aa0d9a6a960f2fef4d084eb42a94a2b66/DETR-vs-detectNet/result/bird_0_detectnet_ssd-mobilenet-v2_21.24.jpg -------------------------------------------------------------------------------- /DETR-vs-detectNet/result/bird_0_detr_resnet50_1.78.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raspberry-pi-maker/NVIDIA-Jetson/30a5596aa0d9a6a960f2fef4d084eb42a94a2b66/DETR-vs-detectNet/result/bird_0_detr_resnet50_1.78.jpg -------------------------------------------------------------------------------- /DETR-vs-detectNet/result/bird_1_detectnet_ssd-mobilenet-v2_23.24.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raspberry-pi-maker/NVIDIA-Jetson/30a5596aa0d9a6a960f2fef4d084eb42a94a2b66/DETR-vs-detectNet/result/bird_1_detectnet_ssd-mobilenet-v2_23.24.jpg -------------------------------------------------------------------------------- /DETR-vs-detectNet/result/bird_1_detr_resnet50_1.43.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raspberry-pi-maker/NVIDIA-Jetson/30a5596aa0d9a6a960f2fef4d084eb42a94a2b66/DETR-vs-detectNet/result/bird_1_detr_resnet50_1.43.jpg -------------------------------------------------------------------------------- /DETR-vs-detectNet/result/bird_2_detectnet_ssd-mobilenet-v2_22.58.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raspberry-pi-maker/NVIDIA-Jetson/30a5596aa0d9a6a960f2fef4d084eb42a94a2b66/DETR-vs-detectNet/result/bird_2_detectnet_ssd-mobilenet-v2_22.58.jpg -------------------------------------------------------------------------------- /DETR-vs-detectNet/result/bird_2_detr_resnet50_1.63.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raspberry-pi-maker/NVIDIA-Jetson/30a5596aa0d9a6a960f2fef4d084eb42a94a2b66/DETR-vs-detectNet/result/bird_2_detr_resnet50_1.63.jpg -------------------------------------------------------------------------------- /DETR-vs-detectNet/result/black_bear_detectnet_ssd-mobilenet-v2_23.22.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raspberry-pi-maker/NVIDIA-Jetson/30a5596aa0d9a6a960f2fef4d084eb42a94a2b66/DETR-vs-detectNet/result/black_bear_detectnet_ssd-mobilenet-v2_23.22.jpg -------------------------------------------------------------------------------- /DETR-vs-detectNet/result/black_bear_detr_resnet50_0.71.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raspberry-pi-maker/NVIDIA-Jetson/30a5596aa0d9a6a960f2fef4d084eb42a94a2b66/DETR-vs-detectNet/result/black_bear_detr_resnet50_0.71.jpg -------------------------------------------------------------------------------- /DETR-vs-detectNet/result/bottle_0_detectnet_ssd-mobilenet-v2_22.83.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raspberry-pi-maker/NVIDIA-Jetson/30a5596aa0d9a6a960f2fef4d084eb42a94a2b66/DETR-vs-detectNet/result/bottle_0_detectnet_ssd-mobilenet-v2_22.83.jpg -------------------------------------------------------------------------------- /DETR-vs-detectNet/result/bottle_0_detr_resnet50_1.17.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raspberry-pi-maker/NVIDIA-Jetson/30a5596aa0d9a6a960f2fef4d084eb42a94a2b66/DETR-vs-detectNet/result/bottle_0_detr_resnet50_1.17.jpg -------------------------------------------------------------------------------- /DETR-vs-detectNet/result/cat_1_detectnet_ssd-mobilenet-v2_23.14.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raspberry-pi-maker/NVIDIA-Jetson/30a5596aa0d9a6a960f2fef4d084eb42a94a2b66/DETR-vs-detectNet/result/cat_1_detectnet_ssd-mobilenet-v2_23.14.jpg -------------------------------------------------------------------------------- /DETR-vs-detectNet/result/cat_1_detr_resnet50_1.70.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raspberry-pi-maker/NVIDIA-Jetson/30a5596aa0d9a6a960f2fef4d084eb42a94a2b66/DETR-vs-detectNet/result/cat_1_detr_resnet50_1.70.jpg -------------------------------------------------------------------------------- /DETR-vs-detectNet/result/city_1_detectnet_ssd-mobilenet-v2_0.53.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raspberry-pi-maker/NVIDIA-Jetson/30a5596aa0d9a6a960f2fef4d084eb42a94a2b66/DETR-vs-detectNet/result/city_1_detectnet_ssd-mobilenet-v2_0.53.jpg -------------------------------------------------------------------------------- /DETR-vs-detectNet/result/city_1_detr_resnet50_0.24.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raspberry-pi-maker/NVIDIA-Jetson/30a5596aa0d9a6a960f2fef4d084eb42a94a2b66/DETR-vs-detectNet/result/city_1_detr_resnet50_0.24.jpg -------------------------------------------------------------------------------- /DETR-vs-detectNet/result/coral_detectnet_ssd-mobilenet-v2_22.39.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raspberry-pi-maker/NVIDIA-Jetson/30a5596aa0d9a6a960f2fef4d084eb42a94a2b66/DETR-vs-detectNet/result/coral_detectnet_ssd-mobilenet-v2_22.39.jpg -------------------------------------------------------------------------------- /DETR-vs-detectNet/result/coral_detr_resnet50_1.12.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raspberry-pi-maker/NVIDIA-Jetson/30a5596aa0d9a6a960f2fef4d084eb42a94a2b66/DETR-vs-detectNet/result/coral_detr_resnet50_1.12.jpg -------------------------------------------------------------------------------- /DETR-vs-detectNet/result/desk_detectnet_ssd-mobilenet-v2_22.95.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raspberry-pi-maker/NVIDIA-Jetson/30a5596aa0d9a6a960f2fef4d084eb42a94a2b66/DETR-vs-detectNet/result/desk_detectnet_ssd-mobilenet-v2_22.95.jpg -------------------------------------------------------------------------------- /DETR-vs-detectNet/result/desk_detr_resnet50_1.49.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raspberry-pi-maker/NVIDIA-Jetson/30a5596aa0d9a6a960f2fef4d084eb42a94a2b66/DETR-vs-detectNet/result/desk_detr_resnet50_1.49.jpg -------------------------------------------------------------------------------- /DETR-vs-detectNet/result/dog_0_detectnet_ssd-mobilenet-v2_23.14.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raspberry-pi-maker/NVIDIA-Jetson/30a5596aa0d9a6a960f2fef4d084eb42a94a2b66/DETR-vs-detectNet/result/dog_0_detectnet_ssd-mobilenet-v2_23.14.jpg -------------------------------------------------------------------------------- /DETR-vs-detectNet/result/dog_0_detr_resnet50_1.52.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raspberry-pi-maker/NVIDIA-Jetson/30a5596aa0d9a6a960f2fef4d084eb42a94a2b66/DETR-vs-detectNet/result/dog_0_detr_resnet50_1.52.jpg -------------------------------------------------------------------------------- /DETR-vs-detectNet/result/dog_1_detectnet_ssd-mobilenet-v2_23.03.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raspberry-pi-maker/NVIDIA-Jetson/30a5596aa0d9a6a960f2fef4d084eb42a94a2b66/DETR-vs-detectNet/result/dog_1_detectnet_ssd-mobilenet-v2_23.03.jpg -------------------------------------------------------------------------------- /DETR-vs-detectNet/result/dog_1_detr_resnet50_1.55.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raspberry-pi-maker/NVIDIA-Jetson/30a5596aa0d9a6a960f2fef4d084eb42a94a2b66/DETR-vs-detectNet/result/dog_1_detr_resnet50_1.55.jpg -------------------------------------------------------------------------------- /DETR-vs-detectNet/result/dog_2_detectnet_ssd-mobilenet-v2_18.69.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raspberry-pi-maker/NVIDIA-Jetson/30a5596aa0d9a6a960f2fef4d084eb42a94a2b66/DETR-vs-detectNet/result/dog_2_detectnet_ssd-mobilenet-v2_18.69.jpg -------------------------------------------------------------------------------- /DETR-vs-detectNet/result/dog_2_detr_resnet50_1.48.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raspberry-pi-maker/NVIDIA-Jetson/30a5596aa0d9a6a960f2fef4d084eb42a94a2b66/DETR-vs-detectNet/result/dog_2_detr_resnet50_1.48.jpg -------------------------------------------------------------------------------- /DETR-vs-detectNet/result/dog_3_detectnet_ssd-mobilenet-v2_16.65.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raspberry-pi-maker/NVIDIA-Jetson/30a5596aa0d9a6a960f2fef4d084eb42a94a2b66/DETR-vs-detectNet/result/dog_3_detectnet_ssd-mobilenet-v2_16.65.jpg -------------------------------------------------------------------------------- /DETR-vs-detectNet/result/dog_3_detr_resnet50_0.14.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raspberry-pi-maker/NVIDIA-Jetson/30a5596aa0d9a6a960f2fef4d084eb42a94a2b66/DETR-vs-detectNet/result/dog_3_detr_resnet50_0.14.jpg -------------------------------------------------------------------------------- /DETR-vs-detectNet/result/dog_5_detectnet_ssd-mobilenet-v2_21.50.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raspberry-pi-maker/NVIDIA-Jetson/30a5596aa0d9a6a960f2fef4d084eb42a94a2b66/DETR-vs-detectNet/result/dog_5_detectnet_ssd-mobilenet-v2_21.50.jpg -------------------------------------------------------------------------------- /DETR-vs-detectNet/result/dog_5_detr_resnet50_1.10.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raspberry-pi-maker/NVIDIA-Jetson/30a5596aa0d9a6a960f2fef4d084eb42a94a2b66/DETR-vs-detectNet/result/dog_5_detr_resnet50_1.10.jpg -------------------------------------------------------------------------------- /DETR-vs-detectNet/result/granny_smith_0_detectnet_ssd-mobilenet-v2_23.70.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raspberry-pi-maker/NVIDIA-Jetson/30a5596aa0d9a6a960f2fef4d084eb42a94a2b66/DETR-vs-detectNet/result/granny_smith_0_detectnet_ssd-mobilenet-v2_23.70.jpg -------------------------------------------------------------------------------- /DETR-vs-detectNet/result/granny_smith_0_detr_resnet50_1.69.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raspberry-pi-maker/NVIDIA-Jetson/30a5596aa0d9a6a960f2fef4d084eb42a94a2b66/DETR-vs-detectNet/result/granny_smith_0_detr_resnet50_1.69.jpg -------------------------------------------------------------------------------- /DETR-vs-detectNet/result/horse_0_detectnet_ssd-mobilenet-v2_23.30.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raspberry-pi-maker/NVIDIA-Jetson/30a5596aa0d9a6a960f2fef4d084eb42a94a2b66/DETR-vs-detectNet/result/horse_0_detectnet_ssd-mobilenet-v2_23.30.jpg -------------------------------------------------------------------------------- /DETR-vs-detectNet/result/horse_0_detr_resnet50_1.68.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raspberry-pi-maker/NVIDIA-Jetson/30a5596aa0d9a6a960f2fef4d084eb42a94a2b66/DETR-vs-detectNet/result/horse_0_detr_resnet50_1.68.jpg -------------------------------------------------------------------------------- /DETR-vs-detectNet/result/horse_1_detectnet_ssd-mobilenet-v2_16.55.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raspberry-pi-maker/NVIDIA-Jetson/30a5596aa0d9a6a960f2fef4d084eb42a94a2b66/DETR-vs-detectNet/result/horse_1_detectnet_ssd-mobilenet-v2_16.55.jpg -------------------------------------------------------------------------------- /DETR-vs-detectNet/result/horse_1_detr_resnet50_1.70.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raspberry-pi-maker/NVIDIA-Jetson/30a5596aa0d9a6a960f2fef4d084eb42a94a2b66/DETR-vs-detectNet/result/horse_1_detr_resnet50_1.70.jpg -------------------------------------------------------------------------------- /DETR-vs-detectNet/result/horse_2_detectnet_ssd-mobilenet-v2_23.01.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raspberry-pi-maker/NVIDIA-Jetson/30a5596aa0d9a6a960f2fef4d084eb42a94a2b66/DETR-vs-detectNet/result/horse_2_detectnet_ssd-mobilenet-v2_23.01.jpg -------------------------------------------------------------------------------- /DETR-vs-detectNet/result/horse_2_detr_resnet50_1.53.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raspberry-pi-maker/NVIDIA-Jetson/30a5596aa0d9a6a960f2fef4d084eb42a94a2b66/DETR-vs-detectNet/result/horse_2_detr_resnet50_1.53.jpg -------------------------------------------------------------------------------- /DETR-vs-detectNet/result/humans_0_detectnet_ssd-mobilenet-v2_23.03.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raspberry-pi-maker/NVIDIA-Jetson/30a5596aa0d9a6a960f2fef4d084eb42a94a2b66/DETR-vs-detectNet/result/humans_0_detectnet_ssd-mobilenet-v2_23.03.jpg -------------------------------------------------------------------------------- /DETR-vs-detectNet/result/humans_0_detr_resnet50_1.92.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raspberry-pi-maker/NVIDIA-Jetson/30a5596aa0d9a6a960f2fef4d084eb42a94a2b66/DETR-vs-detectNet/result/humans_0_detr_resnet50_1.92.jpg -------------------------------------------------------------------------------- /DETR-vs-detectNet/result/humans_1_detectnet_ssd-mobilenet-v2_22.99.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raspberry-pi-maker/NVIDIA-Jetson/30a5596aa0d9a6a960f2fef4d084eb42a94a2b66/DETR-vs-detectNet/result/humans_1_detectnet_ssd-mobilenet-v2_22.99.jpg -------------------------------------------------------------------------------- /DETR-vs-detectNet/result/humans_1_detr_resnet50_1.24.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raspberry-pi-maker/NVIDIA-Jetson/30a5596aa0d9a6a960f2fef4d084eb42a94a2b66/DETR-vs-detectNet/result/humans_1_detr_resnet50_1.24.jpg -------------------------------------------------------------------------------- /DETR-vs-detectNet/result/humans_2_detectnet_ssd-mobilenet-v2_22.98.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raspberry-pi-maker/NVIDIA-Jetson/30a5596aa0d9a6a960f2fef4d084eb42a94a2b66/DETR-vs-detectNet/result/humans_2_detectnet_ssd-mobilenet-v2_22.98.jpg -------------------------------------------------------------------------------- /DETR-vs-detectNet/result/humans_2_detr_resnet50_0.56.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raspberry-pi-maker/NVIDIA-Jetson/30a5596aa0d9a6a960f2fef4d084eb42a94a2b66/DETR-vs-detectNet/result/humans_2_detr_resnet50_0.56.jpg -------------------------------------------------------------------------------- /DETR-vs-detectNet/result/humans_3_detectnet_ssd-mobilenet-v2_22.36.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raspberry-pi-maker/NVIDIA-Jetson/30a5596aa0d9a6a960f2fef4d084eb42a94a2b66/DETR-vs-detectNet/result/humans_3_detectnet_ssd-mobilenet-v2_22.36.jpg -------------------------------------------------------------------------------- /DETR-vs-detectNet/result/humans_3_detr_resnet50_0.58.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raspberry-pi-maker/NVIDIA-Jetson/30a5596aa0d9a6a960f2fef4d084eb42a94a2b66/DETR-vs-detectNet/result/humans_3_detr_resnet50_0.58.jpg -------------------------------------------------------------------------------- /DETR-vs-detectNet/result/humans_4_detectnet_ssd-mobilenet-v2_22.47.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raspberry-pi-maker/NVIDIA-Jetson/30a5596aa0d9a6a960f2fef4d084eb42a94a2b66/DETR-vs-detectNet/result/humans_4_detectnet_ssd-mobilenet-v2_22.47.jpg -------------------------------------------------------------------------------- /DETR-vs-detectNet/result/humans_4_detr_resnet50_0.57.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raspberry-pi-maker/NVIDIA-Jetson/30a5596aa0d9a6a960f2fef4d084eb42a94a2b66/DETR-vs-detectNet/result/humans_4_detr_resnet50_0.57.jpg -------------------------------------------------------------------------------- /DETR-vs-detectNet/result/humans_5_detectnet_ssd-mobilenet-v2_22.76.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raspberry-pi-maker/NVIDIA-Jetson/30a5596aa0d9a6a960f2fef4d084eb42a94a2b66/DETR-vs-detectNet/result/humans_5_detectnet_ssd-mobilenet-v2_22.76.jpg -------------------------------------------------------------------------------- /DETR-vs-detectNet/result/humans_5_detr_resnet50_0.64.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raspberry-pi-maker/NVIDIA-Jetson/30a5596aa0d9a6a960f2fef4d084eb42a94a2b66/DETR-vs-detectNet/result/humans_5_detr_resnet50_0.64.jpg -------------------------------------------------------------------------------- /DETR-vs-detectNet/result/humans_6_detectnet_ssd-mobilenet-v2_21.68.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raspberry-pi-maker/NVIDIA-Jetson/30a5596aa0d9a6a960f2fef4d084eb42a94a2b66/DETR-vs-detectNet/result/humans_6_detectnet_ssd-mobilenet-v2_21.68.jpg -------------------------------------------------------------------------------- /DETR-vs-detectNet/result/humans_6_detr_resnet50_1.26.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raspberry-pi-maker/NVIDIA-Jetson/30a5596aa0d9a6a960f2fef4d084eb42a94a2b66/DETR-vs-detectNet/result/humans_6_detr_resnet50_1.26.jpg -------------------------------------------------------------------------------- /DETR-vs-detectNet/result/humans_7_detectnet_ssd-mobilenet-v2_22.15.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raspberry-pi-maker/NVIDIA-Jetson/30a5596aa0d9a6a960f2fef4d084eb42a94a2b66/DETR-vs-detectNet/result/humans_7_detectnet_ssd-mobilenet-v2_22.15.jpg -------------------------------------------------------------------------------- /DETR-vs-detectNet/result/humans_7_detr_resnet50_0.58.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raspberry-pi-maker/NVIDIA-Jetson/30a5596aa0d9a6a960f2fef4d084eb42a94a2b66/DETR-vs-detectNet/result/humans_7_detr_resnet50_0.58.jpg -------------------------------------------------------------------------------- /DETR-vs-detectNet/result/humans_8_detectnet_ssd-mobilenet-v2_22.78.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raspberry-pi-maker/NVIDIA-Jetson/30a5596aa0d9a6a960f2fef4d084eb42a94a2b66/DETR-vs-detectNet/result/humans_8_detectnet_ssd-mobilenet-v2_22.78.jpg -------------------------------------------------------------------------------- /DETR-vs-detectNet/result/humans_8_detr_resnet50_1.57.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raspberry-pi-maker/NVIDIA-Jetson/30a5596aa0d9a6a960f2fef4d084eb42a94a2b66/DETR-vs-detectNet/result/humans_8_detr_resnet50_1.57.jpg -------------------------------------------------------------------------------- /DETR-vs-detectNet/result/humans_9_detectnet_ssd-mobilenet-v2_21.92.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raspberry-pi-maker/NVIDIA-Jetson/30a5596aa0d9a6a960f2fef4d084eb42a94a2b66/DETR-vs-detectNet/result/humans_9_detectnet_ssd-mobilenet-v2_21.92.jpg -------------------------------------------------------------------------------- /DETR-vs-detectNet/result/humans_9_detr_resnet50_0.53.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raspberry-pi-maker/NVIDIA-Jetson/30a5596aa0d9a6a960f2fef4d084eb42a94a2b66/DETR-vs-detectNet/result/humans_9_detr_resnet50_0.53.jpg -------------------------------------------------------------------------------- /DETR-vs-detectNet/result/object_0_detectnet_ssd-mobilenet-v2_22.75.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raspberry-pi-maker/NVIDIA-Jetson/30a5596aa0d9a6a960f2fef4d084eb42a94a2b66/DETR-vs-detectNet/result/object_0_detectnet_ssd-mobilenet-v2_22.75.jpg -------------------------------------------------------------------------------- /DETR-vs-detectNet/result/object_0_detr_resnet50_1.58.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raspberry-pi-maker/NVIDIA-Jetson/30a5596aa0d9a6a960f2fef4d084eb42a94a2b66/DETR-vs-detectNet/result/object_0_detr_resnet50_1.58.jpg -------------------------------------------------------------------------------- /DETR-vs-detectNet/result/object_2_detectnet_ssd-mobilenet-v2_23.27.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raspberry-pi-maker/NVIDIA-Jetson/30a5596aa0d9a6a960f2fef4d084eb42a94a2b66/DETR-vs-detectNet/result/object_2_detectnet_ssd-mobilenet-v2_23.27.jpg -------------------------------------------------------------------------------- /DETR-vs-detectNet/result/object_2_detr_resnet50_1.65.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raspberry-pi-maker/NVIDIA-Jetson/30a5596aa0d9a6a960f2fef4d084eb42a94a2b66/DETR-vs-detectNet/result/object_2_detr_resnet50_1.65.jpg -------------------------------------------------------------------------------- /DETR-vs-detectNet/result/object_3_detectnet_ssd-mobilenet-v2_21.81.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raspberry-pi-maker/NVIDIA-Jetson/30a5596aa0d9a6a960f2fef4d084eb42a94a2b66/DETR-vs-detectNet/result/object_3_detectnet_ssd-mobilenet-v2_21.81.jpg -------------------------------------------------------------------------------- /DETR-vs-detectNet/result/object_3_detr_resnet50_1.66.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raspberry-pi-maker/NVIDIA-Jetson/30a5596aa0d9a6a960f2fef4d084eb42a94a2b66/DETR-vs-detectNet/result/object_3_detr_resnet50_1.66.jpg -------------------------------------------------------------------------------- /DETR-vs-detectNet/result/object_4_detectnet_ssd-mobilenet-v2_23.38.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raspberry-pi-maker/NVIDIA-Jetson/30a5596aa0d9a6a960f2fef4d084eb42a94a2b66/DETR-vs-detectNet/result/object_4_detectnet_ssd-mobilenet-v2_23.38.jpg -------------------------------------------------------------------------------- /DETR-vs-detectNet/result/object_4_detr_resnet50_1.68.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raspberry-pi-maker/NVIDIA-Jetson/30a5596aa0d9a6a960f2fef4d084eb42a94a2b66/DETR-vs-detectNet/result/object_4_detr_resnet50_1.68.jpg -------------------------------------------------------------------------------- /DETR-vs-detectNet/result/object_5_detectnet_ssd-mobilenet-v2_23.23.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raspberry-pi-maker/NVIDIA-Jetson/30a5596aa0d9a6a960f2fef4d084eb42a94a2b66/DETR-vs-detectNet/result/object_5_detectnet_ssd-mobilenet-v2_23.23.jpg -------------------------------------------------------------------------------- /DETR-vs-detectNet/result/object_5_detr_resnet50_1.72.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raspberry-pi-maker/NVIDIA-Jetson/30a5596aa0d9a6a960f2fef4d084eb42a94a2b66/DETR-vs-detectNet/result/object_5_detr_resnet50_1.72.jpg -------------------------------------------------------------------------------- /DETR-vs-detectNet/result/object_6_detectnet_ssd-mobilenet-v2_21.33.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raspberry-pi-maker/NVIDIA-Jetson/30a5596aa0d9a6a960f2fef4d084eb42a94a2b66/DETR-vs-detectNet/result/object_6_detectnet_ssd-mobilenet-v2_21.33.jpg -------------------------------------------------------------------------------- /DETR-vs-detectNet/result/object_6_detr_resnet50_1.50.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raspberry-pi-maker/NVIDIA-Jetson/30a5596aa0d9a6a960f2fef4d084eb42a94a2b66/DETR-vs-detectNet/result/object_6_detr_resnet50_1.50.jpg -------------------------------------------------------------------------------- /DETR-vs-detectNet/result/object_7_detectnet_ssd-mobilenet-v2_23.07.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raspberry-pi-maker/NVIDIA-Jetson/30a5596aa0d9a6a960f2fef4d084eb42a94a2b66/DETR-vs-detectNet/result/object_7_detectnet_ssd-mobilenet-v2_23.07.jpg -------------------------------------------------------------------------------- /DETR-vs-detectNet/result/object_7_detr_resnet50_1.44.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raspberry-pi-maker/NVIDIA-Jetson/30a5596aa0d9a6a960f2fef4d084eb42a94a2b66/DETR-vs-detectNet/result/object_7_detr_resnet50_1.44.jpg -------------------------------------------------------------------------------- /DETR-vs-detectNet/result/object_8_detectnet_ssd-mobilenet-v2_22.43.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raspberry-pi-maker/NVIDIA-Jetson/30a5596aa0d9a6a960f2fef4d084eb42a94a2b66/DETR-vs-detectNet/result/object_8_detectnet_ssd-mobilenet-v2_22.43.jpg -------------------------------------------------------------------------------- /DETR-vs-detectNet/result/object_8_detr_resnet50_1.48.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raspberry-pi-maker/NVIDIA-Jetson/30a5596aa0d9a6a960f2fef4d084eb42a94a2b66/DETR-vs-detectNet/result/object_8_detr_resnet50_1.48.jpg -------------------------------------------------------------------------------- /DETR-vs-detectNet/result/peds_0_detectnet_ssd-mobilenet-v2_22.18.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raspberry-pi-maker/NVIDIA-Jetson/30a5596aa0d9a6a960f2fef4d084eb42a94a2b66/DETR-vs-detectNet/result/peds_0_detectnet_ssd-mobilenet-v2_22.18.jpg -------------------------------------------------------------------------------- /DETR-vs-detectNet/result/peds_0_detr_resnet50_0.18.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raspberry-pi-maker/NVIDIA-Jetson/30a5596aa0d9a6a960f2fef4d084eb42a94a2b66/DETR-vs-detectNet/result/peds_0_detr_resnet50_0.18.jpg -------------------------------------------------------------------------------- /DETR-vs-detectNet/result/peds_1_detectnet_ssd-mobilenet-v2_20.56.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raspberry-pi-maker/NVIDIA-Jetson/30a5596aa0d9a6a960f2fef4d084eb42a94a2b66/DETR-vs-detectNet/result/peds_1_detectnet_ssd-mobilenet-v2_20.56.jpg -------------------------------------------------------------------------------- /DETR-vs-detectNet/result/peds_1_detr_resnet50_0.18.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raspberry-pi-maker/NVIDIA-Jetson/30a5596aa0d9a6a960f2fef4d084eb42a94a2b66/DETR-vs-detectNet/result/peds_1_detr_resnet50_0.18.jpg -------------------------------------------------------------------------------- /DETR-vs-detectNet/result/peds_2_detectnet_ssd-mobilenet-v2_12.65.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raspberry-pi-maker/NVIDIA-Jetson/30a5596aa0d9a6a960f2fef4d084eb42a94a2b66/DETR-vs-detectNet/result/peds_2_detectnet_ssd-mobilenet-v2_12.65.jpg -------------------------------------------------------------------------------- /DETR-vs-detectNet/result/peds_2_detr_resnet50_1.55.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raspberry-pi-maker/NVIDIA-Jetson/30a5596aa0d9a6a960f2fef4d084eb42a94a2b66/DETR-vs-detectNet/result/peds_2_detr_resnet50_1.55.jpg -------------------------------------------------------------------------------- /DETR-vs-detectNet/result/peds_3_detectnet_ssd-mobilenet-v2_22.79.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raspberry-pi-maker/NVIDIA-Jetson/30a5596aa0d9a6a960f2fef4d084eb42a94a2b66/DETR-vs-detectNet/result/peds_3_detectnet_ssd-mobilenet-v2_22.79.jpg -------------------------------------------------------------------------------- /DETR-vs-detectNet/result/peds_3_detr_resnet50_0.62.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raspberry-pi-maker/NVIDIA-Jetson/30a5596aa0d9a6a960f2fef4d084eb42a94a2b66/DETR-vs-detectNet/result/peds_3_detr_resnet50_0.62.jpg -------------------------------------------------------------------------------- /DETR-vs-detectNet/result/polar_bear_detectnet_ssd-mobilenet-v2_21.70.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raspberry-pi-maker/NVIDIA-Jetson/30a5596aa0d9a6a960f2fef4d084eb42a94a2b66/DETR-vs-detectNet/result/polar_bear_detectnet_ssd-mobilenet-v2_21.70.jpg -------------------------------------------------------------------------------- /DETR-vs-detectNet/result/polar_bear_detr_resnet50_1.10.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raspberry-pi-maker/NVIDIA-Jetson/30a5596aa0d9a6a960f2fef4d084eb42a94a2b66/DETR-vs-detectNet/result/polar_bear_detr_resnet50_1.10.jpg -------------------------------------------------------------------------------- /DETR-vs-detectNet/result/red_apple_0_detectnet_ssd-mobilenet-v2_22.53.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raspberry-pi-maker/NVIDIA-Jetson/30a5596aa0d9a6a960f2fef4d084eb42a94a2b66/DETR-vs-detectNet/result/red_apple_0_detectnet_ssd-mobilenet-v2_22.53.jpg -------------------------------------------------------------------------------- /DETR-vs-detectNet/result/red_apple_0_detr_resnet50_0.45.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raspberry-pi-maker/NVIDIA-Jetson/30a5596aa0d9a6a960f2fef4d084eb42a94a2b66/DETR-vs-detectNet/result/red_apple_0_detr_resnet50_0.45.jpg -------------------------------------------------------------------------------- /DETR-vs-detectNet/result/room_0_detectnet_ssd-mobilenet-v2_22.98.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raspberry-pi-maker/NVIDIA-Jetson/30a5596aa0d9a6a960f2fef4d084eb42a94a2b66/DETR-vs-detectNet/result/room_0_detectnet_ssd-mobilenet-v2_22.98.jpg -------------------------------------------------------------------------------- /DETR-vs-detectNet/result/room_0_detr_resnet50_0.93.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raspberry-pi-maker/NVIDIA-Jetson/30a5596aa0d9a6a960f2fef4d084eb42a94a2b66/DETR-vs-detectNet/result/room_0_detr_resnet50_0.93.jpg -------------------------------------------------------------------------------- /DETR-vs-detectNet/result/room_1_detectnet_ssd-mobilenet-v2_21.81.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raspberry-pi-maker/NVIDIA-Jetson/30a5596aa0d9a6a960f2fef4d084eb42a94a2b66/DETR-vs-detectNet/result/room_1_detectnet_ssd-mobilenet-v2_21.81.jpg -------------------------------------------------------------------------------- /DETR-vs-detectNet/result/room_1_detr_resnet50_0.93.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raspberry-pi-maker/NVIDIA-Jetson/30a5596aa0d9a6a960f2fef4d084eb42a94a2b66/DETR-vs-detectNet/result/room_1_detr_resnet50_0.93.jpg -------------------------------------------------------------------------------- /DETR-vs-detectNet/result/room_2_detectnet_ssd-mobilenet-v2_22.70.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raspberry-pi-maker/NVIDIA-Jetson/30a5596aa0d9a6a960f2fef4d084eb42a94a2b66/DETR-vs-detectNet/result/room_2_detectnet_ssd-mobilenet-v2_22.70.jpg -------------------------------------------------------------------------------- /DETR-vs-detectNet/result/room_2_detr_resnet50_0.93.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raspberry-pi-maker/NVIDIA-Jetson/30a5596aa0d9a6a960f2fef4d084eb42a94a2b66/DETR-vs-detectNet/result/room_2_detr_resnet50_0.93.jpg -------------------------------------------------------------------------------- /DETR-vs-detectNet/result/room_3_detectnet_ssd-mobilenet-v2_22.99.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raspberry-pi-maker/NVIDIA-Jetson/30a5596aa0d9a6a960f2fef4d084eb42a94a2b66/DETR-vs-detectNet/result/room_3_detectnet_ssd-mobilenet-v2_22.99.jpg -------------------------------------------------------------------------------- /DETR-vs-detectNet/result/room_3_detr_resnet50_0.91.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raspberry-pi-maker/NVIDIA-Jetson/30a5596aa0d9a6a960f2fef4d084eb42a94a2b66/DETR-vs-detectNet/result/room_3_detr_resnet50_0.91.jpg -------------------------------------------------------------------------------- /DETR-vs-detectNet/result/room_5_detectnet_ssd-mobilenet-v2_22.60.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raspberry-pi-maker/NVIDIA-Jetson/30a5596aa0d9a6a960f2fef4d084eb42a94a2b66/DETR-vs-detectNet/result/room_5_detectnet_ssd-mobilenet-v2_22.60.jpg -------------------------------------------------------------------------------- /DETR-vs-detectNet/result/room_5_detr_resnet50_1.24.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raspberry-pi-maker/NVIDIA-Jetson/30a5596aa0d9a6a960f2fef4d084eb42a94a2b66/DETR-vs-detectNet/result/room_5_detr_resnet50_1.24.jpg -------------------------------------------------------------------------------- /DETR-vs-detectNet/result/room_6_detectnet_ssd-mobilenet-v2_23.30.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raspberry-pi-maker/NVIDIA-Jetson/30a5596aa0d9a6a960f2fef4d084eb42a94a2b66/DETR-vs-detectNet/result/room_6_detectnet_ssd-mobilenet-v2_23.30.jpg -------------------------------------------------------------------------------- /DETR-vs-detectNet/result/room_6_detr_resnet50_1.23.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raspberry-pi-maker/NVIDIA-Jetson/30a5596aa0d9a6a960f2fef4d084eb42a94a2b66/DETR-vs-detectNet/result/room_6_detr_resnet50_1.23.jpg -------------------------------------------------------------------------------- /DETR-vs-detectNet/result/stingray_detectnet_ssd-mobilenet-v2_23.03.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raspberry-pi-maker/NVIDIA-Jetson/30a5596aa0d9a6a960f2fef4d084eb42a94a2b66/DETR-vs-detectNet/result/stingray_detectnet_ssd-mobilenet-v2_23.03.jpg -------------------------------------------------------------------------------- /DETR-vs-detectNet/result/stingray_detr_resnet50_1.07.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raspberry-pi-maker/NVIDIA-Jetson/30a5596aa0d9a6a960f2fef4d084eb42a94a2b66/DETR-vs-detectNet/result/stingray_detr_resnet50_1.07.jpg -------------------------------------------------------------------------------- /DETR-vs-detectNet/test_images/airplane_0.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raspberry-pi-maker/NVIDIA-Jetson/30a5596aa0d9a6a960f2fef4d084eb42a94a2b66/DETR-vs-detectNet/test_images/airplane_0.jpg -------------------------------------------------------------------------------- /DETR-vs-detectNet/test_images/airplane_1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raspberry-pi-maker/NVIDIA-Jetson/30a5596aa0d9a6a960f2fef4d084eb42a94a2b66/DETR-vs-detectNet/test_images/airplane_1.jpg -------------------------------------------------------------------------------- /DETR-vs-detectNet/test_images/banana_0.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raspberry-pi-maker/NVIDIA-Jetson/30a5596aa0d9a6a960f2fef4d084eb42a94a2b66/DETR-vs-detectNet/test_images/banana_0.jpg -------------------------------------------------------------------------------- /DETR-vs-detectNet/test_images/bird_0.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raspberry-pi-maker/NVIDIA-Jetson/30a5596aa0d9a6a960f2fef4d084eb42a94a2b66/DETR-vs-detectNet/test_images/bird_0.jpg -------------------------------------------------------------------------------- /DETR-vs-detectNet/test_images/bird_1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raspberry-pi-maker/NVIDIA-Jetson/30a5596aa0d9a6a960f2fef4d084eb42a94a2b66/DETR-vs-detectNet/test_images/bird_1.jpg -------------------------------------------------------------------------------- /DETR-vs-detectNet/test_images/bird_2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raspberry-pi-maker/NVIDIA-Jetson/30a5596aa0d9a6a960f2fef4d084eb42a94a2b66/DETR-vs-detectNet/test_images/bird_2.jpg -------------------------------------------------------------------------------- /DETR-vs-detectNet/test_images/black_bear.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raspberry-pi-maker/NVIDIA-Jetson/30a5596aa0d9a6a960f2fef4d084eb42a94a2b66/DETR-vs-detectNet/test_images/black_bear.jpg -------------------------------------------------------------------------------- /DETR-vs-detectNet/test_images/bottle_0.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raspberry-pi-maker/NVIDIA-Jetson/30a5596aa0d9a6a960f2fef4d084eb42a94a2b66/DETR-vs-detectNet/test_images/bottle_0.jpg -------------------------------------------------------------------------------- /DETR-vs-detectNet/test_images/cat_1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raspberry-pi-maker/NVIDIA-Jetson/30a5596aa0d9a6a960f2fef4d084eb42a94a2b66/DETR-vs-detectNet/test_images/cat_1.jpg -------------------------------------------------------------------------------- /DETR-vs-detectNet/test_images/city_1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raspberry-pi-maker/NVIDIA-Jetson/30a5596aa0d9a6a960f2fef4d084eb42a94a2b66/DETR-vs-detectNet/test_images/city_1.jpg -------------------------------------------------------------------------------- /DETR-vs-detectNet/test_images/coral.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raspberry-pi-maker/NVIDIA-Jetson/30a5596aa0d9a6a960f2fef4d084eb42a94a2b66/DETR-vs-detectNet/test_images/coral.jpg -------------------------------------------------------------------------------- /DETR-vs-detectNet/test_images/desk.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raspberry-pi-maker/NVIDIA-Jetson/30a5596aa0d9a6a960f2fef4d084eb42a94a2b66/DETR-vs-detectNet/test_images/desk.jpg -------------------------------------------------------------------------------- /DETR-vs-detectNet/test_images/dog_0.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raspberry-pi-maker/NVIDIA-Jetson/30a5596aa0d9a6a960f2fef4d084eb42a94a2b66/DETR-vs-detectNet/test_images/dog_0.jpg -------------------------------------------------------------------------------- /DETR-vs-detectNet/test_images/dog_1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raspberry-pi-maker/NVIDIA-Jetson/30a5596aa0d9a6a960f2fef4d084eb42a94a2b66/DETR-vs-detectNet/test_images/dog_1.jpg -------------------------------------------------------------------------------- /DETR-vs-detectNet/test_images/dog_2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raspberry-pi-maker/NVIDIA-Jetson/30a5596aa0d9a6a960f2fef4d084eb42a94a2b66/DETR-vs-detectNet/test_images/dog_2.jpg -------------------------------------------------------------------------------- /DETR-vs-detectNet/test_images/dog_3.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raspberry-pi-maker/NVIDIA-Jetson/30a5596aa0d9a6a960f2fef4d084eb42a94a2b66/DETR-vs-detectNet/test_images/dog_3.jpg -------------------------------------------------------------------------------- /DETR-vs-detectNet/test_images/dog_5.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raspberry-pi-maker/NVIDIA-Jetson/30a5596aa0d9a6a960f2fef4d084eb42a94a2b66/DETR-vs-detectNet/test_images/dog_5.jpg -------------------------------------------------------------------------------- /DETR-vs-detectNet/test_images/granny_smith_0.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raspberry-pi-maker/NVIDIA-Jetson/30a5596aa0d9a6a960f2fef4d084eb42a94a2b66/DETR-vs-detectNet/test_images/granny_smith_0.jpg -------------------------------------------------------------------------------- /DETR-vs-detectNet/test_images/horse_0.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raspberry-pi-maker/NVIDIA-Jetson/30a5596aa0d9a6a960f2fef4d084eb42a94a2b66/DETR-vs-detectNet/test_images/horse_0.jpg -------------------------------------------------------------------------------- /DETR-vs-detectNet/test_images/horse_1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raspberry-pi-maker/NVIDIA-Jetson/30a5596aa0d9a6a960f2fef4d084eb42a94a2b66/DETR-vs-detectNet/test_images/horse_1.jpg -------------------------------------------------------------------------------- /DETR-vs-detectNet/test_images/horse_2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raspberry-pi-maker/NVIDIA-Jetson/30a5596aa0d9a6a960f2fef4d084eb42a94a2b66/DETR-vs-detectNet/test_images/horse_2.jpg -------------------------------------------------------------------------------- /DETR-vs-detectNet/test_images/humans_0.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raspberry-pi-maker/NVIDIA-Jetson/30a5596aa0d9a6a960f2fef4d084eb42a94a2b66/DETR-vs-detectNet/test_images/humans_0.jpg -------------------------------------------------------------------------------- /DETR-vs-detectNet/test_images/humans_1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raspberry-pi-maker/NVIDIA-Jetson/30a5596aa0d9a6a960f2fef4d084eb42a94a2b66/DETR-vs-detectNet/test_images/humans_1.jpg -------------------------------------------------------------------------------- /DETR-vs-detectNet/test_images/humans_2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raspberry-pi-maker/NVIDIA-Jetson/30a5596aa0d9a6a960f2fef4d084eb42a94a2b66/DETR-vs-detectNet/test_images/humans_2.jpg -------------------------------------------------------------------------------- /DETR-vs-detectNet/test_images/humans_3.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raspberry-pi-maker/NVIDIA-Jetson/30a5596aa0d9a6a960f2fef4d084eb42a94a2b66/DETR-vs-detectNet/test_images/humans_3.jpg -------------------------------------------------------------------------------- /DETR-vs-detectNet/test_images/humans_4.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raspberry-pi-maker/NVIDIA-Jetson/30a5596aa0d9a6a960f2fef4d084eb42a94a2b66/DETR-vs-detectNet/test_images/humans_4.jpg -------------------------------------------------------------------------------- /DETR-vs-detectNet/test_images/humans_5.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raspberry-pi-maker/NVIDIA-Jetson/30a5596aa0d9a6a960f2fef4d084eb42a94a2b66/DETR-vs-detectNet/test_images/humans_5.jpg -------------------------------------------------------------------------------- /DETR-vs-detectNet/test_images/humans_6.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raspberry-pi-maker/NVIDIA-Jetson/30a5596aa0d9a6a960f2fef4d084eb42a94a2b66/DETR-vs-detectNet/test_images/humans_6.jpg -------------------------------------------------------------------------------- /DETR-vs-detectNet/test_images/humans_7.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raspberry-pi-maker/NVIDIA-Jetson/30a5596aa0d9a6a960f2fef4d084eb42a94a2b66/DETR-vs-detectNet/test_images/humans_7.jpg -------------------------------------------------------------------------------- /DETR-vs-detectNet/test_images/humans_8.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raspberry-pi-maker/NVIDIA-Jetson/30a5596aa0d9a6a960f2fef4d084eb42a94a2b66/DETR-vs-detectNet/test_images/humans_8.jpg -------------------------------------------------------------------------------- /DETR-vs-detectNet/test_images/humans_9.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raspberry-pi-maker/NVIDIA-Jetson/30a5596aa0d9a6a960f2fef4d084eb42a94a2b66/DETR-vs-detectNet/test_images/humans_9.jpg -------------------------------------------------------------------------------- /DETR-vs-detectNet/test_images/object_0.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raspberry-pi-maker/NVIDIA-Jetson/30a5596aa0d9a6a960f2fef4d084eb42a94a2b66/DETR-vs-detectNet/test_images/object_0.jpg -------------------------------------------------------------------------------- /DETR-vs-detectNet/test_images/object_2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raspberry-pi-maker/NVIDIA-Jetson/30a5596aa0d9a6a960f2fef4d084eb42a94a2b66/DETR-vs-detectNet/test_images/object_2.jpg -------------------------------------------------------------------------------- /DETR-vs-detectNet/test_images/object_3.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raspberry-pi-maker/NVIDIA-Jetson/30a5596aa0d9a6a960f2fef4d084eb42a94a2b66/DETR-vs-detectNet/test_images/object_3.jpg -------------------------------------------------------------------------------- /DETR-vs-detectNet/test_images/object_4.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raspberry-pi-maker/NVIDIA-Jetson/30a5596aa0d9a6a960f2fef4d084eb42a94a2b66/DETR-vs-detectNet/test_images/object_4.jpg -------------------------------------------------------------------------------- /DETR-vs-detectNet/test_images/object_5.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raspberry-pi-maker/NVIDIA-Jetson/30a5596aa0d9a6a960f2fef4d084eb42a94a2b66/DETR-vs-detectNet/test_images/object_5.jpg -------------------------------------------------------------------------------- /DETR-vs-detectNet/test_images/object_6.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raspberry-pi-maker/NVIDIA-Jetson/30a5596aa0d9a6a960f2fef4d084eb42a94a2b66/DETR-vs-detectNet/test_images/object_6.jpg -------------------------------------------------------------------------------- /DETR-vs-detectNet/test_images/object_7.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raspberry-pi-maker/NVIDIA-Jetson/30a5596aa0d9a6a960f2fef4d084eb42a94a2b66/DETR-vs-detectNet/test_images/object_7.jpg -------------------------------------------------------------------------------- /DETR-vs-detectNet/test_images/object_8.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raspberry-pi-maker/NVIDIA-Jetson/30a5596aa0d9a6a960f2fef4d084eb42a94a2b66/DETR-vs-detectNet/test_images/object_8.jpg -------------------------------------------------------------------------------- /DETR-vs-detectNet/test_images/peds_0.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raspberry-pi-maker/NVIDIA-Jetson/30a5596aa0d9a6a960f2fef4d084eb42a94a2b66/DETR-vs-detectNet/test_images/peds_0.jpg -------------------------------------------------------------------------------- /DETR-vs-detectNet/test_images/peds_1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raspberry-pi-maker/NVIDIA-Jetson/30a5596aa0d9a6a960f2fef4d084eb42a94a2b66/DETR-vs-detectNet/test_images/peds_1.jpg -------------------------------------------------------------------------------- /DETR-vs-detectNet/test_images/peds_2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raspberry-pi-maker/NVIDIA-Jetson/30a5596aa0d9a6a960f2fef4d084eb42a94a2b66/DETR-vs-detectNet/test_images/peds_2.jpg -------------------------------------------------------------------------------- /DETR-vs-detectNet/test_images/peds_3.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raspberry-pi-maker/NVIDIA-Jetson/30a5596aa0d9a6a960f2fef4d084eb42a94a2b66/DETR-vs-detectNet/test_images/peds_3.jpg -------------------------------------------------------------------------------- /DETR-vs-detectNet/test_images/polar_bear.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raspberry-pi-maker/NVIDIA-Jetson/30a5596aa0d9a6a960f2fef4d084eb42a94a2b66/DETR-vs-detectNet/test_images/polar_bear.jpg -------------------------------------------------------------------------------- /DETR-vs-detectNet/test_images/red_apple_0.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raspberry-pi-maker/NVIDIA-Jetson/30a5596aa0d9a6a960f2fef4d084eb42a94a2b66/DETR-vs-detectNet/test_images/red_apple_0.jpg -------------------------------------------------------------------------------- /DETR-vs-detectNet/test_images/room_0.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raspberry-pi-maker/NVIDIA-Jetson/30a5596aa0d9a6a960f2fef4d084eb42a94a2b66/DETR-vs-detectNet/test_images/room_0.jpg -------------------------------------------------------------------------------- /DETR-vs-detectNet/test_images/room_1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raspberry-pi-maker/NVIDIA-Jetson/30a5596aa0d9a6a960f2fef4d084eb42a94a2b66/DETR-vs-detectNet/test_images/room_1.jpg -------------------------------------------------------------------------------- /DETR-vs-detectNet/test_images/room_2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raspberry-pi-maker/NVIDIA-Jetson/30a5596aa0d9a6a960f2fef4d084eb42a94a2b66/DETR-vs-detectNet/test_images/room_2.jpg -------------------------------------------------------------------------------- /DETR-vs-detectNet/test_images/room_3.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raspberry-pi-maker/NVIDIA-Jetson/30a5596aa0d9a6a960f2fef4d084eb42a94a2b66/DETR-vs-detectNet/test_images/room_3.jpg -------------------------------------------------------------------------------- /DETR-vs-detectNet/test_images/room_5.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raspberry-pi-maker/NVIDIA-Jetson/30a5596aa0d9a6a960f2fef4d084eb42a94a2b66/DETR-vs-detectNet/test_images/room_5.jpg -------------------------------------------------------------------------------- /DETR-vs-detectNet/test_images/room_6.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raspberry-pi-maker/NVIDIA-Jetson/30a5596aa0d9a6a960f2fef4d084eb42a94a2b66/DETR-vs-detectNet/test_images/room_6.jpg -------------------------------------------------------------------------------- /DETR-vs-detectNet/test_images/stingray.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raspberry-pi-maker/NVIDIA-Jetson/30a5596aa0d9a6a960f2fef4d084eb42a94a2b66/DETR-vs-detectNet/test_images/stingray.jpg -------------------------------------------------------------------------------- /DeepStream 5.0/YOLOv4/DeepStream/labels.txt: -------------------------------------------------------------------------------- 1 | person 2 | bicycle 3 | car 4 | motorbike 5 | aeroplane 6 | bus 7 | train 8 | truck 9 | boat 10 | traffic light 11 | fire hydrant 12 | stop sign 13 | parking meter 14 | bench 15 | bird 16 | cat 17 | dog 18 | horse 19 | sheep 20 | cow 21 | elephant 22 | bear 23 | zebra 24 | giraffe 25 | backpack 26 | umbrella 27 | handbag 28 | tie 29 | suitcase 30 | frisbee 31 | skis 32 | snowboard 33 | sports ball 34 | kite 35 | baseball bat 36 | baseball glove 37 | skateboard 38 | surfboard 39 | tennis racket 40 | bottle 41 | wine glass 42 | cup 43 | fork 44 | knife 45 | spoon 46 | bowl 47 | banana 48 | apple 49 | sandwich 50 | orange 51 | broccoli 52 | carrot 53 | hot dog 54 | pizza 55 | donut 56 | cake 57 | chair 58 | sofa 59 | pottedplant 60 | bed 61 | diningtable 62 | toilet 63 | tvmonitor 64 | laptop 65 | mouse 66 | remote 67 | keyboard 68 | cell phone 69 | microwave 70 | oven 71 | toaster 72 | sink 73 | refrigerator 74 | book 75 | clock 76 | vase 77 | scissors 78 | teddy bear 79 | hair drier 80 | toothbrush -------------------------------------------------------------------------------- /DeepStream 5.0/apps/deepstream-face/config_infer_primary_facedetectir.txt: -------------------------------------------------------------------------------- 1 | ################################################################################ 2 | # Copyright (c) 2020, NVIDIA CORPORATION. All rights reserved. 3 | # 4 | # Permission is hereby granted, free of charge, to any person obtaining a 5 | # copy of this software and associated documentation files (the "Software"), 6 | # to deal in the Software without restriction, including without limitation 7 | # the rights to use, copy, modify, merge, publish, distribute, sublicense, 8 | # and/or sell copies of the Software, and to permit persons to whom the 9 | # Software is furnished to do so, subject to the following conditions: 10 | # 11 | # The above copyright notice and this permission notice shall be included in 12 | # all copies or substantial portions of the Software. 13 | # 14 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 17 | # THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 19 | # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 20 | # DEALINGS IN THE SOFTWARE. 21 | ################################################################################ 22 | 23 | [property] 24 | gpu-id=0 25 | net-scale-factor=0.0039215697906911373 26 | tlt-model-key=tlt_encode 27 | 28 | tlt-encoded-model=/opt/nvidia/deepstream/deepstream/samples/models/FaceDetector/resnet18_facedetectir_pruned.etlt 29 | labelfile-path=/opt/nvidia/deepstream/deepstream/samples/configs/tlt_pretrained_models/labels_facedetectir.txt 30 | int8-calib-file=/opt/nvidia/deepstream/deepstream/samples/models/FaceDetector/facedetectir_int8.txt 31 | #model-engine-file=../../models/tlt_pretrained_models/facedetectir/resnet18_facedetectir_pruned.etlt_b1_gpu0_int8.engine 32 | input-dims=3;240;384;0 33 | uff-input-blob-name=input_1 34 | batch-size=1 35 | process-mode=1 36 | model-color-format=0 37 | ## 0=FP32, 1=INT8, 2=FP16 mode 38 | network-mode=0 39 | num-detected-classes=1 40 | interval=0 41 | gie-unique-id=1 42 | output-blob-names=output_bbox/BiasAdd;output_cov/Sigmoid 43 | 44 | [class-attrs-all] 45 | pre-cluster-threshold=0.05 46 | group-threshold=1 47 | ## Set eps=0.7 and minBoxes for cluster-mode=1(DBSCAN) 48 | eps=0.2 49 | #minBoxes=3 50 | -------------------------------------------------------------------------------- /Detectron2 PoseEstimation/metadata_keypoint.py: -------------------------------------------------------------------------------- 1 | from detectron2 import model_zoo 2 | from detectron2.data import MetadataCatalog 3 | from detectron2.config import get_cfg 4 | 5 | 6 | network_model = 'COCO-Keypoints/keypoint_rcnn_R_101_FPN_3x.yaml' 7 | cfg = get_cfg() 8 | # add project-specific config (e.g., TensorMask) here if you're not running a model in detectron2's core library 9 | cfg.merge_from_file(model_zoo.get_config_file(network_model)) 10 | cfg.MODEL.ROI_HEADS.SCORE_THRESH_TEST = 0.5 # set threshold for this model 11 | # Find a model from detectron2's model zoo. You can use the https://dl.fbaipublicfiles... url as well 12 | cfg.MODEL.WEIGHTS = model_zoo.get_checkpoint_url(network_model) 13 | cls = MetadataCatalog.get(cfg.DATASETS.TRAIN[0]).thing_classes 14 | print('NetworkModel[%s] category:%d'%(network_model, len(cls))) 15 | print(cls) 16 | 17 | kname = MetadataCatalog.get(cfg.DATASETS.TRAIN[0]).keypoint_names 18 | print('keypoint_names') 19 | print(kname) 20 | 21 | krule = MetadataCatalog.get(cfg.DATASETS.TRAIN[0]).keypoint_connection_rules 22 | print('keypoint_connection_rules length[%d]'%(len(krule))) 23 | print(krule) 24 | 25 | -------------------------------------------------------------------------------- /Detectron2 PoseEstimation/poseestimation.py: -------------------------------------------------------------------------------- 1 | from detectron2 import model_zoo 2 | from detectron2.engine import DefaultPredictor 3 | from detectron2.config import get_cfg 4 | from detectron2.utils.visualizer import Visualizer 5 | from detectron2.data import MetadataCatalog 6 | import cv2 7 | import numpy as np 8 | import requests, sys, time, os 9 | from PIL import Image, ImageDraw 10 | import argparse 11 | 12 | 13 | 14 | COLORS = [(0, 45, 74, 224), (85, 32, 98, 224), (93, 69, 12, 224), 15 | (49, 18, 55, 224), (46, 67, 18, 224), (30, 74, 93, 224)] 16 | 17 | help = 'Base-Keypoint-RCNN-FPN' 18 | help += ',keypoint_rcnn_R_101_FPN_3x' 19 | help += ',keypoint_rcnn_R_50_FPN_1x' 20 | help += ',keypoint_rcnn_R_50_FPN_3x' 21 | help += ',keypoint_rcnn_X_101_32x8d_FPN_3x' 22 | 23 | 24 | parser = argparse.ArgumentParser() 25 | parser.add_argument('--model', type=str, default = 'keypoint_rcnn_R_50_FPN_1x', help = help) 26 | parser.add_argument('--file', type=str, default = '') 27 | parser.add_argument('--size', type=str, default = '640X480', help = 'image inference size ex:320X240') 28 | 29 | opt = parser.parse_args() 30 | 31 | W, H = opt.size.split('X') 32 | if opt.file == '': 33 | url = 'http://images.cocodataset.org/val2017/000000439715.jpg' 34 | img = Image.open(requests.get(url, stream=True).raw).resize((int(W),int(H))) 35 | im = np.asarray(img, dtype="uint8") 36 | height, width, channels = im.shape 37 | if channels == 3: 38 | im = cv2.cvtColor(im, cv2.COLOR_RGB2BGR) 39 | else: 40 | im = cv2.cvtColor(im, cv2.COLOR_RGBA2BGR) 41 | 42 | else: 43 | im = cv2.imread(opt.file, cv2.IMREAD_COLOR) 44 | height, width, channels = im.shape 45 | 46 | 47 | print('image W:%d H:%d'%(width, height)) 48 | 49 | network_model = 'COCO-Keypoints/' + opt.model + '.yaml' 50 | 51 | 52 | cfg = get_cfg() 53 | # add project-specific config (e.g., TensorMask) here if you're not running a model in detectron2's core library 54 | cfg.merge_from_file(model_zoo.get_config_file(network_model)) 55 | cfg.MODEL.ROI_HEADS.SCORE_THRESH_TEST = 0.5 # set threshold for this model 56 | # Find a model from detectron2's model zoo. You can use the https://dl.fbaipublicfiles... url as well 57 | cfg.MODEL.WEIGHTS = model_zoo.get_checkpoint_url(network_model) 58 | predictor = DefaultPredictor(cfg) 59 | 60 | 61 | for i in range (2): 62 | fps_time = time.perf_counter() 63 | outputs = predictor(im) 64 | fps = 1.0 / (time.perf_counter() - fps_time) 65 | if i == 1: 66 | print('===== output =====') 67 | print(outputs) 68 | print("Net FPS: %f" % (fps)) 69 | v = Visualizer(im[:, :, ::-1], MetadataCatalog.get(cfg.DATASETS.TRAIN[0]), scale=1.2) 70 | out = v.draw_instance_predictions(outputs["instances"].to("cpu")) 71 | 72 | cv2.imwrite("detectron2_poseestimation_%s_result.jpg"%(opt.model), out.get_image()[:, :, ::-1]) 73 | cv2.imwrite("./source_image.jpg", im) 74 | 75 | 76 | -------------------------------------------------------------------------------- /Detectron2 Segmentation Models/metadata.py: -------------------------------------------------------------------------------- 1 | from detectron2 import model_zoo 2 | from detectron2.data import MetadataCatalog 3 | from detectron2.config import get_cfg 4 | 5 | network_model = 'COCO-InstanceSegmentation/mask_rcnn_R_50_FPN_3x.yaml' 6 | 7 | cfg = get_cfg() 8 | # add project-specific config (e.g., TensorMask) here if you're not running a model in detectron2's core library 9 | cfg.merge_from_file(model_zoo.get_config_file(network_model)) 10 | cfg.MODEL.ROI_HEADS.SCORE_THRESH_TEST = 0.5 # set threshold for this model 11 | # Find a model from detectron2's model zoo. You can use the https://dl.fbaipublicfiles... url as well 12 | cfg.MODEL.WEIGHTS = model_zoo.get_checkpoint_url(network_model) 13 | 14 | cls = MetadataCatalog.get(cfg.DATASETS.TRAIN[0]).thing_classes 15 | print('NetworkModel[%s] category:%d'%(network_model, len(cls))) 16 | print(cls) 17 | 18 | 19 | 20 | network_model = 'Cityscapes/mask_rcnn_R_50_FPN.yaml' 21 | cfg = get_cfg() 22 | # add project-specific config (e.g., TensorMask) here if you're not running a model in detectron2's core library 23 | cfg.merge_from_file(model_zoo.get_config_file(network_model)) 24 | cfg.MODEL.ROI_HEADS.SCORE_THRESH_TEST = 0.5 # set threshold for this model 25 | # Find a model from detectron2's model zoo. You can use the https://dl.fbaipublicfiles... url as well 26 | cfg.MODEL.WEIGHTS = model_zoo.get_checkpoint_url(network_model) 27 | 28 | cls = MetadataCatalog.get(cfg.DATASETS.TRAIN[0]).thing_classes 29 | print('NetworkModel[%s] category:%d'%(network_model, len(cls))) 30 | print(cls) 31 | 32 | network_model = 'LVIS-InstanceSegmentation/mask_rcnn_R_50_FPN_1x.yaml' 33 | cfg = get_cfg() 34 | # add project-specific config (e.g., TensorMask) here if you're not running a model in detectron2's core library 35 | cfg.merge_from_file(model_zoo.get_config_file(network_model)) 36 | cfg.MODEL.ROI_HEADS.SCORE_THRESH_TEST = 0.5 # set threshold for this model 37 | # Find a model from detectron2's model zoo. You can use the https://dl.fbaipublicfiles... url as well 38 | cfg.MODEL.WEIGHTS = model_zoo.get_checkpoint_url(network_model) 39 | 40 | cls = MetadataCatalog.get(cfg.DATASETS.TRAIN[0]).thing_classes 41 | print('NetworkModel[%s] category:%d'%(network_model, len(cls))) 42 | #Too many calsses to print 43 | #print(cls) 44 | 45 | -------------------------------------------------------------------------------- /Detectron2 Segmentation Models/test_detectron2.py: -------------------------------------------------------------------------------- 1 | from detectron2 import model_zoo 2 | from detectron2.engine import DefaultPredictor 3 | from detectron2.config import get_cfg 4 | from detectron2.utils.visualizer import Visualizer 5 | from detectron2.data import MetadataCatalog 6 | import cv2 7 | import numpy as np 8 | import requests, sys, time, os 9 | from PIL import Image 10 | 11 | url = 'http://images.cocodataset.org/val2017/000000439715.jpg' 12 | 13 | img = Image.open(requests.get(url, stream=True).raw) 14 | im = np.asarray(img, dtype="uint8") 15 | height, width, channels = im.shape 16 | if channels == 3: 17 | im = cv2.cvtColor(im, cv2.COLOR_RGB2BGR) 18 | else: 19 | im = cv2.cvtColor(im, cv2.COLOR_RGBA2BGR) 20 | 21 | print('image W:%d H:%d'%(width, height)) 22 | 23 | cfg = get_cfg() 24 | # add project-specific config (e.g., TensorMask) here if you're not running a model in detectron2's core library 25 | cfg.merge_from_file(model_zoo.get_config_file("COCO-InstanceSegmentation/mask_rcnn_R_50_FPN_3x.yaml")) 26 | cfg.MODEL.ROI_HEADS.SCORE_THRESH_TEST = 0.5 # set threshold for this model 27 | # Find a model from detectron2's model zoo. You can use the https://dl.fbaipublicfiles... url as well 28 | cfg.MODEL.WEIGHTS = model_zoo.get_checkpoint_url("COCO-InstanceSegmentation/mask_rcnn_R_50_FPN_3x.yaml") 29 | predictor = DefaultPredictor(cfg) 30 | 31 | 32 | for i in range (5): 33 | fps_time = time.perf_counter() 34 | outputs = predictor(im) 35 | 36 | fps = 1.0 / (time.perf_counter() - fps_time) 37 | print("Net FPS: %f" % (fps)) 38 | 39 | #print(outputs["instances"].pred_classes) 40 | #print(outputs["instances"].pred_boxes) 41 | 42 | 43 | v = Visualizer(im[:, :, ::-1], MetadataCatalog.get(cfg.DATASETS.TRAIN[0]), scale=1.2) 44 | out = v.draw_instance_predictions(outputs["instances"].to("cpu")) 45 | 46 | cv2.imwrite("detectron2_result.jpg", out.get_image()[:, :, ::-1]) 47 | cv2.imwrite("./source_image.jpg", im) 48 | -------------------------------------------------------------------------------- /Hello AI World/detectNet/01.mp4: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raspberry-pi-maker/NVIDIA-Jetson/30a5596aa0d9a6a960f2fef4d084eb42a94a2b66/Hello AI World/detectNet/01.mp4 -------------------------------------------------------------------------------- /Hello AI World/detectNet/sbear.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raspberry-pi-maker/NVIDIA-Jetson/30a5596aa0d9a6a960f2fef4d084eb42a94a2b66/Hello AI World/detectNet/sbear.png -------------------------------------------------------------------------------- /Installing Mediapipe(CPU Mode) on Raspberry Pi/face.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raspberry-pi-maker/NVIDIA-Jetson/30a5596aa0d9a6a960f2fef4d084eb42a94a2b66/Installing Mediapipe(CPU Mode) on Raspberry Pi/face.png -------------------------------------------------------------------------------- /Installing Mediapipe(CPU Mode) on Raspberry Pi/mp_face_mesh.py: -------------------------------------------------------------------------------- 1 | #https://dev.classmethod.jp/articles/mediapipe-extract-data-from-multi-hand-tracking/ 2 | import cv2 3 | import sys, os 4 | import mediapipe as mp 5 | mp_drawing = mp.solutions.drawing_utils 6 | mp_face_mesh = mp.solutions.face_mesh 7 | 8 | # For static images: 9 | file = '/usr/local/src/example/body.jpg' 10 | file = '/usr/local/src/example/face.png' 11 | drawing_spec = mp_drawing.DrawingSpec(thickness=1, circle_radius=1) 12 | os.chdir('/usr/local/src/mediapipe') 13 | with mp_face_mesh.FaceMesh( 14 | static_image_mode=True, 15 | max_num_faces=1, 16 | min_detection_confidence=0.5) as face_mesh: 17 | 18 | image = cv2.imread(file) 19 | # Convert the BGR image to RGB before processing. 20 | results = face_mesh.process(cv2.cvtColor(image, cv2.COLOR_BGR2RGB)) 21 | 22 | # Print and draw face mesh landmarks on the image. 23 | if not results.multi_face_landmarks: 24 | print('No face_landmarks') 25 | sys.exit(0) 26 | annotated_image = image.copy() 27 | for face_landmarks in results.multi_face_landmarks: 28 | #print(' face_landmarks:', face_landmarks) 29 | mp_drawing.draw_landmarks( 30 | image=annotated_image, 31 | landmark_list=face_landmarks, 32 | connections=mp_face_mesh.FACE_CONNECTIONS, 33 | landmark_drawing_spec=drawing_spec, 34 | connection_drawing_spec=drawing_spec) 35 | #print('%d facemesh_landmarks'%len(face_landmarks.landmark)) 36 | cv2.imwrite('/usr/local/src/example/facemesh_image.png', annotated_image) -------------------------------------------------------------------------------- /Installing Mediapipe(CPU Mode) on Raspberry Pi/mp_video_perf.py: -------------------------------------------------------------------------------- 1 | #https://dev.classmethod.jp/articles/mediapipe-extract-data-from-multi-hand-tracking/ 2 | import cv2 3 | import sys, time, os 4 | import mediapipe as mp 5 | mp_drawing = mp.solutions.drawing_utils 6 | mp_face_mesh = mp.solutions.face_mesh 7 | 8 | # For static images: 9 | 10 | drawing_spec = mp_drawing.DrawingSpec(thickness=1, circle_radius=1) 11 | face_mesh = mp_face_mesh.FaceMesh(static_image_mode=True, max_num_faces=1, min_detection_confidence=0.5) 12 | 13 | def get_face_mesh(image): 14 | results = face_mesh.process(cv2.cvtColor(image, cv2.COLOR_BGR2RGB)) 15 | 16 | # Print and draw face mesh landmarks on the image. 17 | if not results.multi_face_landmarks: 18 | return image 19 | annotated_image = image.copy() 20 | for face_landmarks in results.multi_face_landmarks: 21 | #print(' face_landmarks:', face_landmarks) 22 | mp_drawing.draw_landmarks( 23 | image=annotated_image, 24 | landmark_list=face_landmarks, 25 | connections=mp_face_mesh.FACE_CONNECTIONS, 26 | landmark_drawing_spec=drawing_spec, 27 | connection_drawing_spec=drawing_spec) 28 | #print('%d facemesh_landmarks'%len(face_landmarks.landmark)) 29 | return annotated_image 30 | 31 | os.chdir('/usr/local/src/mediapipe') 32 | font = cv2.FONT_HERSHEY_SIMPLEX 33 | cap = cv2.VideoCapture(0) 34 | if (cap.isOpened() == False): 35 | print("Unable to read camera feed") 36 | 37 | cap.set(cv2.CAP_PROP_FRAME_WIDTH, 640) 38 | cap.set(cv2.CAP_PROP_FRAME_HEIGHT, 480) 39 | while cap.isOpened(): 40 | s = time.time() 41 | ret, img = cap.read() 42 | if ret == False: 43 | print('WebCAM Read Error') 44 | sys.exit(0) 45 | 46 | annotated = get_face_mesh(img) 47 | e = time.time() 48 | fps = 1 / (e - s) 49 | cv2.putText(annotated, 'FPS:%5.2f'%(fps), (10,50), font, fontScale = 1, color = (0,255,0), thickness = 1) 50 | cv2.imshow('webcam', annotated) 51 | key = cv2.waitKey(1) 52 | if key == 27: #ESC 53 | break 54 | 55 | cap.release() 56 | -------------------------------------------------------------------------------- /OpenCV camera control on Raspberry Pi BullsEye OS/preview.py: -------------------------------------------------------------------------------- 1 | import cv2 2 | import sys 3 | 4 | cap = cv2.VideoCapture(0) 5 | if cap.isOpened() == False: 6 | print('camera open Failed') 7 | sys.exit(0) 8 | 9 | cap.set(cv2.CAP_PROP_FRAME_WIDTH,640); 10 | cap.set(cv2.CAP_PROP_FRAME_HEIGHT,480); 11 | 12 | while True: 13 | 14 | succes, img = cap.read() 15 | if succes == False: 16 | print('camera read Failed') 17 | sys.exit(0) 18 | k = cv2.waitKey(1) 19 | if k == ord('q'): 20 | break 21 | cv2.imshow('Img',img) 22 | cap.release() 23 | cv2.destroyAllWindows() -------------------------------------------------------------------------------- /OpenCV camera control on Raspberry Pi BullsEye OS/preview_gstreamer.py: -------------------------------------------------------------------------------- 1 | import cv2 2 | import numpy as np 3 | import sys 4 | connstr = 'libcamerasrc ! video/x-raw, width=640, height=480, framerate=30/1 ! videoconvert ! videoscale ! clockoverlay time-format="%D %H:%M:%S" ! appsink' 5 | cap = cv2.VideoCapture(connstr, cv2.CAP_GSTREAMER) 6 | if cap.isOpened() == False: 7 | print('camera open Failed') 8 | sys.exit(0) 9 | 10 | 11 | while True: 12 | 13 | succes, img = cap.read() 14 | if succes == False: 15 | print('camera read Failed') 16 | sys.exit(0) 17 | 18 | k = cv2.waitKey(1) 19 | if k == ord('q'): 20 | break 21 | 22 | cv2.imshow('Img',img) 23 | 24 | cap.release() 25 | cv2.destroyAllWindows() -------------------------------------------------------------------------------- /OpenPose 1.7 Programming on Jetson Series using CommandLine tools/image/blackping2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raspberry-pi-maker/NVIDIA-Jetson/30a5596aa0d9a6a960f2fef4d084eb42a94a2b66/OpenPose 1.7 Programming on Jetson Series using CommandLine tools/image/blackping2.jpg -------------------------------------------------------------------------------- /OpenPose 1.7 Programming on Jetson Series using CommandLine tools/image/blackpink.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raspberry-pi-maker/NVIDIA-Jetson/30a5596aa0d9a6a960f2fef4d084eb42a94a2b66/OpenPose 1.7 Programming on Jetson Series using CommandLine tools/image/blackpink.png -------------------------------------------------------------------------------- /OpenPose 1.7 Programming on Jetson Series using CommandLine tools/study/op_control.py: -------------------------------------------------------------------------------- 1 | import subprocess, os, sys, time 2 | 3 | exec = '/usr/local/src/openpose-1.7.0/build/examples/openpose/openpose.bin' 4 | working_dir = '/usr/local/src/openpose-1.7.0/' 5 | image_dir_info = "/usr/local/src/image" 6 | write_images_info = "/usr/local/src/output" 7 | write_json_info = "/usr/local/src/output" 8 | net_resolution_info = "320x224" 9 | 10 | params = [] 11 | params.append(exec) 12 | params.append("--image_dir") 13 | params.append(image_dir_info) 14 | params.append("--write_images") 15 | params.append(write_images_info) 16 | params.append("--write_json") 17 | params.append(write_json_info) 18 | params.append("--net_resolution") 19 | params.append(net_resolution_info) 20 | #no display will speed up the processing time. 21 | params.append("--display") 22 | params.append("0") 23 | 24 | #chdir is necessary. If not set, searching model path may fail 25 | os.chdir(working_dir) 26 | s = time.time() 27 | process = subprocess.Popen(params, stdout=subprocess.PIPE) 28 | output, err = process.communicate() 29 | exit_code = process.wait() 30 | e = time.time() 31 | output_str = output.decode('utf-8') 32 | print("Python Logging popen exit code :%d"%exit_code) 33 | print("Python Logging popen return :%s"%output_str) 34 | print("Python Logging Total Processing time:%6.2f"%(e - s)) 35 | 36 | -------------------------------------------------------------------------------- /OpenPose 1.7 Python Programming on Jetson Series/01_1_body_from_image.py: -------------------------------------------------------------------------------- 1 | # Customized for NVidia Jetson Series by spyjetson 2 | # From Python 3 | # It requires OpenCV installed for Python 4 | import sys 5 | import cv2 6 | import os 7 | from sys import platform 8 | import argparse 9 | from openpose import pyopenpose as op 10 | 11 | 12 | try: 13 | # Flags 14 | parser = argparse.ArgumentParser() 15 | parser.add_argument("--image_path", default="/usr/local/src/openpose-1.7.0/examples/media/COCO_val2014_000000000294.jpg", help="Process an image. Read all standard formats (jpg, png, bmp, etc.).") 16 | args = parser.parse_known_args() 17 | 18 | # Custom Params (refer to include/openpose/flags.hpp for more parameters) 19 | params = dict() 20 | params["model_folder"] = "/usr/local/src/openpose-1.7.0/models/" 21 | params["net_resolution"] = "320x256" #COCO_val2014_000000000192.jpg image is landscape mode, so 320x256 is a good choice 22 | # Add others in path? 23 | for i in range(0, len(args[1])): 24 | curr_item = args[1][i] 25 | if i != len(args[1])-1: next_item = args[1][i+1] 26 | else: next_item = "1" 27 | if "--" in curr_item and "--" in next_item: 28 | key = curr_item.replace('-','') 29 | if key not in params: params[key] = "1" 30 | elif "--" in curr_item and "--" not in next_item: 31 | key = curr_item.replace('-','') 32 | if key not in params: params[key] = next_item 33 | 34 | # Starting OpenPose 35 | opWrapper = op.WrapperPython() 36 | opWrapper.configure(params) 37 | opWrapper.start() 38 | 39 | # Process Image 40 | datum = op.Datum() 41 | imageToProcess = cv2.imread(args[0].image_path) 42 | datum.cvInputData = imageToProcess 43 | opWrapper.emplaceAndPop(op.VectorDatum([datum])) 44 | newImage = datum.cvOutputData[:, :, :] 45 | human_count = len(datum.poseKeypoints) 46 | 47 | font = cv2.FONT_HERSHEY_SIMPLEX 48 | for human in range(human_count): 49 | for j in range(25): 50 | if datum.poseKeypoints[human][j][2] > 0.01: 51 | cv2.putText(newImage, str(j), ( int(datum.poseKeypoints[human][j][0]) + 10, int(datum.poseKeypoints[human][j][1])), font, 0.5, (0,255,0), 2) 52 | print(datum.poseKeypoints[human]) 53 | 54 | # Display Image 55 | for human in range(human_count): 56 | print(datum.poseKeypoints[human]) 57 | print("Total %d human detected"%human_count) 58 | cv2.imshow("OpenPose 1.7.0 - Tutorial Python API", newImage) 59 | k = 0 60 | while k != 27: 61 | k = cv2.waitKey(0) & 0xFF 62 | except Exception as e: 63 | print(e) 64 | sys.exit(-1) 65 | -------------------------------------------------------------------------------- /OpenPose 1.7 Python Programming on Jetson Series/01_2_body_from_video.py: -------------------------------------------------------------------------------- 1 | # Customized for NVidia Jetson Series by spyjetson 2 | # From Python 3 | # It requires OpenCV installed for Python 4 | import sys 5 | import cv2 6 | import os, time 7 | from sys import platform 8 | import argparse 9 | from openpose import pyopenpose as op 10 | from datetime import datetime 11 | 12 | try: 13 | # Flags 14 | parser = argparse.ArgumentParser() 15 | parser.add_argument("--video_path", default="/usr/local/src/openpose-1.7.0/examples/media/video.avi", help="Process an video. ") 16 | args = parser.parse_known_args() 17 | 18 | # Custom Params (refer to include/openpose/flags.hpp for more parameters) 19 | params = dict() 20 | params["model_folder"] = "/usr/local/src/openpose-1.7.0/models/" 21 | params["net_resolution"] = "320x-1" 22 | # Add others in path? 23 | for i in range(0, len(args[1])): 24 | curr_item = args[1][i] 25 | if i != len(args[1])-1: next_item = args[1][i+1] 26 | else: next_item = "1" 27 | if "--" in curr_item and "--" in next_item: 28 | key = curr_item.replace('-','') 29 | if key not in params: params[key] = "1" 30 | elif "--" in curr_item and "--" not in next_item: 31 | key = curr_item.replace('-','') 32 | if key not in params: params[key] = next_item 33 | 34 | # Starting OpenPose 35 | opWrapper = op.WrapperPython() 36 | opWrapper.configure(params) 37 | opWrapper.start() 38 | 39 | # Process video 40 | cap = cv2.VideoCapture(args[0].video_path) 41 | color = (0,0,255) #BGR 42 | thickness = -1 #draw inner space of circle 43 | font = cv2.FONT_HERSHEY_SIMPLEX 44 | while True: 45 | s = datetime.now() 46 | ret,img = cap.read() 47 | if ret == False: 48 | break 49 | datum = op.Datum() 50 | datum.cvInputData = img 51 | opWrapper.emplaceAndPop(op.VectorDatum([datum])) 52 | human_count = len(datum.poseKeypoints) 53 | # Display Image 54 | 55 | for human in range(human_count): 56 | for j in range(25): 57 | if datum.poseKeypoints[human][j][2] > 0.01: 58 | center = (int(datum.poseKeypoints[human][j][0]) , int(datum.poseKeypoints[human][j][1])) 59 | cv2.circle(img, center, 3, color, thickness) 60 | e = datetime.now() 61 | delta = e - s 62 | sec = delta.total_seconds() 63 | 64 | cv2.putText(img,'FPS[%5.2f] %d person detected'%(1/( sec),human_count),(20,30), font, 1,(255,255,255),1,cv2.LINE_AA) 65 | cv2.imshow("OpenPose 1.7.0 - Tutorial Python API", img) 66 | cv2.waitKey(1) 67 | 68 | except Exception as e: 69 | print(e) 70 | sys.exit(-1) 71 | 72 | cap.release() 73 | cv2.destroyAllWindows() 74 | 75 | -------------------------------------------------------------------------------- /OpenPose 1.7 Python Programming on Jetson Series/01_body_from_image.py: -------------------------------------------------------------------------------- 1 | # Customized for NVidia Jetson Series by spyjetson 2 | # From Python 3 | # It requires OpenCV installed for Python 4 | import sys 5 | import cv2 6 | import os 7 | from sys import platform 8 | import argparse 9 | from openpose import pyopenpose as op 10 | 11 | 12 | try: 13 | # Flags 14 | parser = argparse.ArgumentParser() 15 | parser.add_argument("--image_path", default="/usr/local/src/openpose-1.7.0/examples/media/COCO_val2014_000000000192.jpg", help="Process an image. Read all standard formats (jpg, png, bmp, etc.).") 16 | args = parser.parse_known_args() 17 | 18 | # Custom Params (refer to include/openpose/flags.hpp for more parameters) 19 | params = dict() 20 | params["model_folder"] = "/usr/local/src/openpose-1.7.0/models/" 21 | params["net_resolution"] = "320x256" #COCO_val2014_000000000192.jpg image is landscape mode, so 320x256 is a good choice 22 | # Add others in path? 23 | for i in range(0, len(args[1])): 24 | curr_item = args[1][i] 25 | if i != len(args[1])-1: next_item = args[1][i+1] 26 | else: next_item = "1" 27 | if "--" in curr_item and "--" in next_item: 28 | key = curr_item.replace('-','') 29 | if key not in params: params[key] = "1" 30 | elif "--" in curr_item and "--" not in next_item: 31 | key = curr_item.replace('-','') 32 | if key not in params: params[key] = next_item 33 | 34 | # Starting OpenPose 35 | opWrapper = op.WrapperPython() 36 | opWrapper.configure(params) 37 | opWrapper.start() 38 | 39 | # Process Image 40 | datum = op.Datum() 41 | imageToProcess = cv2.imread(args[0].image_path) 42 | datum.cvInputData = imageToProcess 43 | opWrapper.emplaceAndPop(op.VectorDatum([datum])) 44 | human_count = len(datum.poseKeypoints) 45 | # Display Image 46 | for human in range(human_count): 47 | print(datum.poseKeypoints[human]) 48 | print("Total %d human detected"%human_count) 49 | cv2.imshow("OpenPose 1.7.0 - Tutorial Python API", datum.cvOutputData) 50 | k = 0 51 | while k != 27: 52 | k = cv2.waitKey(0) & 0xFF 53 | except Exception as e: 54 | print(e) 55 | sys.exit(-1) 56 | -------------------------------------------------------------------------------- /OpenPose 1.7 Python Programming on Jetson Series/06_face_from_image.py: -------------------------------------------------------------------------------- 1 | # Customized for NVidia Jetson Series by spyjetson 2 | # From Python 3 | # It requires OpenCV installed for Python 4 | import sys 5 | import cv2 6 | import os 7 | from sys import platform 8 | import argparse 9 | import time 10 | from openpose import pyopenpose as op 11 | 12 | try: 13 | # Flags 14 | parser = argparse.ArgumentParser() 15 | parser.add_argument("--image_path", default="/usr/local/src/openpose-1.7.0/examples/media/COCO_val2014_000000000241.jpg", help="Process an image. Read all standard formats (jpg, png, bmp, etc.).") 16 | args = parser.parse_known_args() 17 | 18 | # Custom Params (refer to include/openpose/flags.hpp for more parameters) 19 | params = dict() 20 | params["model_folder"] = "/usr/local/src/openpose-1.7.0/models/" 21 | params["face"] = True 22 | params["face_detector"] = 2 23 | params["face_net_resolution"] = "256x256" # Multiples of 16 and squared default: "368x368" 24 | params["body"] = 0 25 | 26 | # Add others in path? 27 | for i in range(0, len(args[1])): 28 | curr_item = args[1][i] 29 | if i != len(args[1])-1: next_item = args[1][i+1] 30 | else: next_item = "1" 31 | if "--" in curr_item and "--" in next_item: 32 | key = curr_item.replace('-','') 33 | if key not in params: params[key] = "1" 34 | elif "--" in curr_item and "--" not in next_item: 35 | key = curr_item.replace('-','') 36 | if key not in params: params[key] = next_item 37 | 38 | # Construct it from system arguments 39 | # op.init_argv(args[1]) 40 | # oppython = op.OpenposePython() 41 | 42 | # Starting OpenPose 43 | opWrapper = op.WrapperPython() 44 | opWrapper.configure(params) 45 | opWrapper.start() 46 | 47 | # Read image and face rectangle locations 48 | # If you use face_detector 2 and body 0 options, then use must provide the face regions 49 | imageToProcess = cv2.imread(args[0].image_path) 50 | faceRectangles = [ 51 | op.Rectangle(330.119385, 277.532715, 48.717274, 48.717274), 52 | op.Rectangle(24.036991, 267.918793, 65.175171, 65.175171), 53 | op.Rectangle(151.803436, 32.477852, 108.295761, 108.295761), 54 | ] 55 | 56 | # Create new datum 57 | datum = op.Datum() 58 | datum.cvInputData = imageToProcess 59 | datum.faceRectangles = faceRectangles 60 | 61 | # Process and display image 62 | opWrapper.emplaceAndPop(op.VectorDatum([datum])) 63 | print("Face keypoints: \n" + str(datum.faceKeypoints)) 64 | cv2.imshow("OpenPose 1.7.0 - Tutorial Python API", datum.cvOutputData) 65 | cv2.waitKey(0) 66 | except Exception as e: 67 | print(e) 68 | sys.exit(-1) 69 | -------------------------------------------------------------------------------- /OpenPose 1.7 Python Programming on Jetson Series/08_heatmaps_from_image.py: -------------------------------------------------------------------------------- 1 | # Customized for NVidia Jetson Series by spyjetson 2 | # From Python 3 | # It requires OpenCV installed for Python 4 | import sys 5 | import cv2 6 | import os 7 | from sys import platform 8 | import argparse 9 | from openpose import pyopenpose as op 10 | 11 | try: 12 | # Flags 13 | parser = argparse.ArgumentParser() 14 | parser.add_argument("--image_path", default="/usr/local/src/openpose-1.7.0/examples/media/COCO_val2014_000000000192.jpg", help="Process an image. Read all standard formats (jpg, png, bmp, etc.).") 15 | args = parser.parse_known_args() 16 | 17 | # Custom Params (refer to include/openpose/flags.hpp for more parameters) 18 | params = dict() 19 | params["model_folder"] = "/usr/local/src/openpose-1.7.0/models/" 20 | params["heatmaps_add_parts"] = True 21 | params["heatmaps_add_bkg"] = True 22 | params["heatmaps_add_PAFs"] = True 23 | params["heatmaps_scale"] = 2 24 | 25 | # Add others in path? 26 | for i in range(0, len(args[1])): 27 | curr_item = args[1][i] 28 | if i != len(args[1])-1: next_item = args[1][i+1] 29 | else: next_item = "1" 30 | if "--" in curr_item and "--" in next_item: 31 | key = curr_item.replace('-','') 32 | if key not in params: params[key] = "1" 33 | elif "--" in curr_item and "--" not in next_item: 34 | key = curr_item.replace('-','') 35 | if key not in params: params[key] = next_item 36 | 37 | # Construct it from system arguments 38 | # op.init_argv(args[1]) 39 | # oppython = op.OpenposePython() 40 | 41 | # Starting OpenPose 42 | opWrapper = op.WrapperPython() 43 | opWrapper.configure(params) 44 | opWrapper.start() 45 | 46 | # Process Image 47 | datum = op.Datum() 48 | imageToProcess = cv2.imread(args[0].image_path) 49 | datum.cvInputData = imageToProcess 50 | opWrapper.emplaceAndPop(op.VectorDatum([datum])) 51 | 52 | # Process outputs 53 | outputImageF = (datum.inputNetData[0].copy())[0,:,:,:] + 0.5 54 | outputImageF = cv2.merge([outputImageF[0,:,:], outputImageF[1,:,:], outputImageF[2,:,:]]) 55 | outputImageF = (outputImageF*255.).astype(dtype='uint8') 56 | heatmaps = datum.poseHeatMaps.copy() 57 | heatmaps = (heatmaps).astype(dtype='uint8') 58 | 59 | # Display Image 60 | counter = 0 61 | while 1: 62 | num_maps = heatmaps.shape[0] 63 | heatmap = heatmaps[counter, :, :].copy() 64 | heatmap = cv2.applyColorMap(heatmap, cv2.COLORMAP_JET) 65 | combined = cv2.addWeighted(outputImageF, 0.5, heatmap, 0.5, 0) 66 | cv2.imshow("OpenPose 1.7.0 - Tutorial Python API", combined) 67 | key = cv2.waitKey(-1) 68 | if key == 27: 69 | break 70 | counter += 1 71 | counter = counter % num_maps 72 | except Exception as e: 73 | print(e) 74 | sys.exit(-1) 75 | -------------------------------------------------------------------------------- /OpenPose 1.7 Python Programming on Jetson Series/09_keypoints_from_heatmaps.py: -------------------------------------------------------------------------------- 1 | # Customized for NVidia Jetson Series by spyjetson 2 | # Unity not tested 3 | # From Python 4 | # It requires OpenCV installed for Python 5 | import sys 6 | import cv2 7 | import os 8 | from sys import platform 9 | import argparse 10 | import numpy as np 11 | from openpose import pyopenpose as op 12 | 13 | try: 14 | # Flags 15 | parser = argparse.ArgumentParser() 16 | parser.add_argument("--image_path", default="/usr/local/src/openpose-1.7.0/examples/media/COCO_val2014_000000000294.jpg", help="Process an image. Read all standard formats (jpg, png, bmp, etc.).") 17 | args = parser.parse_known_args() 18 | 19 | # Load image 20 | imageToProcess = cv2.imread(args[0].image_path) 21 | 22 | def get_sample_heatmaps(): 23 | # These parameters are globally set. You need to unset variables set here if you have a new OpenPose object. See * 24 | params = dict() 25 | params["model_folder"] = "/usr/local/src/openpose-1.7.0/models/" 26 | params["heatmaps_add_parts"] = True 27 | params["heatmaps_add_bkg"] = True 28 | params["heatmaps_add_PAFs"] = True 29 | params["heatmaps_scale"] = 3 30 | params["upsampling_ratio"] = 1 31 | params["body"] = 1 32 | 33 | # Starting OpenPose 34 | opWrapper = op.WrapperPython() 35 | opWrapper.configure(params) 36 | opWrapper.start() 37 | 38 | # Process Image and get heatmap 39 | datum = op.Datum() 40 | imageToProcess = cv2.imread(args[0].image_path) 41 | datum.cvInputData = imageToProcess 42 | opWrapper.emplaceAndPop([datum]) 43 | poseHeatMaps = datum.poseHeatMaps.copy() 44 | opWrapper.stop() 45 | 46 | return poseHeatMaps 47 | 48 | # Get Heatmap 49 | poseHeatMaps = get_sample_heatmaps() 50 | 51 | # Starting OpenPose 52 | params = dict() 53 | params["model_folder"] = "../../../models/" 54 | params["body"] = 2 # Disable OP Network 55 | params["upsampling_ratio"] = 0 # * Unset this variable 56 | opWrapper = op.WrapperPython() 57 | opWrapper.configure(params) 58 | opWrapper.start() 59 | 60 | # Pass Heatmap and Run OP 61 | datum = op.Datum() 62 | datum.cvInputData = imageToProcess 63 | datum.poseNetOutput = poseHeatMaps 64 | opWrapper.emplaceAndPop(op.VectorDatum([datum])) 65 | 66 | # Display Image 67 | print("Body keypoints: \n" + str(datum.poseKeypoints)) 68 | cv2.imshow("OpenPose 1.7.0 - Tutorial Python API", datum.cvOutputData) 69 | cv2.waitKey(0) 70 | except Exception as e: 71 | print(e) 72 | sys.exit(-1) 73 | -------------------------------------------------------------------------------- /OpenPose 1.7 Python Programming on Jetson Series/12_asynchronous_custom_output.py: -------------------------------------------------------------------------------- 1 | # Customized for NVidia Jetson Series by spyjetson 2 | # From Python 3 | # It requires OpenCV installed for Python 4 | import sys 5 | import cv2 6 | import os, time 7 | from sys import platform 8 | import argparse 9 | from openpose import pyopenpose as op 10 | 11 | 12 | def display(datums): 13 | datum = datums[0] 14 | cv2.imshow("OpenPose 1.7.0 - Tutorial Python API", datum.cvOutputData) 15 | key = cv2.waitKey(1) 16 | return (key == 27) 17 | 18 | 19 | def printKeypoints(datums): 20 | datum = datums[0] 21 | print("Body keypoints: \n" + str(datum.poseKeypoints)) 22 | print("Face keypoints: \n" + str(datum.faceKeypoints)) 23 | print("Left hand keypoints: \n" + str(datum.handKeypoints[0])) 24 | print("Right hand keypoints: \n" + str(datum.handKeypoints[1])) 25 | 26 | 27 | try: 28 | # Flags 29 | parser = argparse.ArgumentParser() 30 | parser.add_argument("--no_display", action="store_true", help="Disable display.") 31 | args = parser.parse_known_args() 32 | 33 | # Custom Params (refer to include/openpose/flags.hpp for more parameters) 34 | params = dict() 35 | params["model_folder"] = "/usr/local/src/openpose-1.7.0/models/" 36 | params["net_resolution"] = "320x256" 37 | 38 | # Add others in path? 39 | for i in range(0, len(args[1])): 40 | curr_item = args[1][i] 41 | if i != len(args[1])-1: next_item = args[1][i+1] 42 | else: next_item = "1" 43 | if "--" in curr_item and "--" in next_item: 44 | key = curr_item.replace('-','') 45 | if key not in params: params[key] = "1" 46 | elif "--" in curr_item and "--" not in next_item: 47 | key = curr_item.replace('-','') 48 | if key not in params: params[key] = next_item 49 | 50 | # Construct it from system arguments 51 | # op.init_argv(args[1]) 52 | # oppython = op.OpenposePython() 53 | 54 | # Starting OpenPose 55 | opWrapper = op.WrapperPython(op.ThreadManagerMode.AsynchronousOut) 56 | opWrapper.configure(params) 57 | opWrapper.start() 58 | 59 | # Main loop 60 | userWantsToExit = False 61 | while not userWantsToExit: 62 | # Pop frame 63 | s = time.time() 64 | datumProcessed = op.VectorDatum() 65 | if opWrapper.waitAndPop(datumProcessed): 66 | if not args[0].no_display: 67 | # Display image 68 | userWantsToExit = display(datumProcessed) 69 | printKeypoints(datumProcessed) 70 | else: 71 | break 72 | 73 | e = time.time() 74 | print('FPS:%5.2f'%(1 / (e - s))) 75 | except Exception as e: 76 | print(e) 77 | sys.exit(-1) 78 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Repo for NVIDIA Jetson series blog 2 | 3 | This repo contains the source codes of [MyBlog](https://spyjetson.blogspot.com/) -------------------------------------------------------------------------------- /Running OpenPose models directly from OpenCV/image/blackpink/blackping2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raspberry-pi-maker/NVIDIA-Jetson/30a5596aa0d9a6a960f2fef4d084eb42a94a2b66/Running OpenPose models directly from OpenCV/image/blackpink/blackping2.jpg -------------------------------------------------------------------------------- /Running OpenPose models directly from OpenCV/image/blackpink/blackpink.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raspberry-pi-maker/NVIDIA-Jetson/30a5596aa0d9a6a960f2fef4d084eb42a94a2b66/Running OpenPose models directly from OpenCV/image/blackpink/blackpink.png -------------------------------------------------------------------------------- /Running OpenPose models directly from OpenCV/image/chaplin.mp4: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raspberry-pi-maker/NVIDIA-Jetson/30a5596aa0d9a6a960f2fef4d084eb42a94a2b66/Running OpenPose models directly from OpenCV/image/chaplin.mp4 -------------------------------------------------------------------------------- /Running OpenPose models directly from OpenCV/image/walking.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raspberry-pi-maker/NVIDIA-Jetson/30a5596aa0d9a6a960f2fef4d084eb42a94a2b66/Running OpenPose models directly from OpenCV/image/walking.jpg -------------------------------------------------------------------------------- /Running OpenPose models directly from OpenCV/original.py: -------------------------------------------------------------------------------- 1 | import cv2 2 | from openpose import pyopenpose as op 3 | 4 | params = dict() 5 | params["model_folder"] = "/usr/local/src/openpose-1.7.0/models/" 6 | params["net_resolution"] = "320x256" #inference resolution 7 | 8 | opWrapper = op.WrapperPython() 9 | opWrapper.configure(params) 10 | opWrapper.start() 11 | 12 | 13 | datum = op.Datum() 14 | #imageToProcess = cv2.imread('/usr/local/src/image/blackpink/blackpink.png') 15 | imageToProcess = cv2.imread('/usr/local/src/image/face.jpg') 16 | datum.cvInputData = imageToProcess 17 | opWrapper.emplaceAndPop(op.VectorDatum([datum])) 18 | newImage = datum.cvOutputData[:, :, :] 19 | cv2.imwrite("/tmp/result.jpg", newImage) 20 | -------------------------------------------------------------------------------- /XavierNX-OpenPose/video.py: -------------------------------------------------------------------------------- 1 | import sys 2 | import time 3 | import math 4 | import cv2 5 | import numpy as np 6 | from openpose import pyopenpose as op 7 | #import pyopenpose as op 8 | import argparse 9 | 10 | parser = argparse.ArgumentParser(description="OpenPose Example") 11 | parser.add_argument("--video", type=str, required = True, help="video file name") 12 | parser.add_argument("--res", type=str, default = "640x480", help="video file resolution") 13 | args = parser.parse_args() 14 | res = args.res.split('x') 15 | res[0], res[1] = int(res[0]), int(res[1]) 16 | 17 | 18 | if __name__ == '__main__': 19 | fps_time = 0 20 | 21 | params = dict() 22 | params["model_folder"] = "/home/spypiggy/src/openpose/models/" 23 | params["net_resolution"] = args.res 24 | 25 | # Starting OpenPose 26 | opWrapper = op.WrapperPython() 27 | opWrapper.configure(params) 28 | opWrapper.start() 29 | 30 | 31 | print("OpenPose start") 32 | cap = cv2.VideoCapture(args.video) 33 | 34 | ret_val, img = cap.read() 35 | fourcc = cv2.VideoWriter_fourcc('m', 'p', '4', 'v') 36 | #out_video = cv2.VideoWriter('/tmp/output.mp4', fourcc, cap.get(cv2.CAP_PROP_FPS), (640, 480)) 37 | out_video = cv2.VideoWriter('/tmp/output.mp4', fourcc, cap.get(cv2.CAP_PROP_FPS), (res[0], res[1])) 38 | 39 | count = 0 40 | t_netfps_time = 0 41 | t_fps_time = 0 42 | if cap is None: 43 | print("Video[%s] Open Error"%(args.video)) 44 | sys.exit(0) 45 | while cap.isOpened(): 46 | ret_val, dst = cap.read() 47 | if ret_val == False: 48 | print("Frame read End") 49 | break 50 | dst = cv2.resize(dst, dsize=(res[0], res[1]), interpolation=cv2.INTER_AREA) 51 | 52 | datum = op.Datum() 53 | datum.cvInputData = dst 54 | net_fps = time.time() 55 | opWrapper.emplaceAndPop([datum]) 56 | fps = 1.0 / (time.time() - fps_time) 57 | netfps = 1.0 / (time.time() - net_fps) 58 | t_netfps_time += netfps 59 | t_fps_time += fps 60 | 61 | fps_time = time.time() 62 | newImage = datum.cvOutputData[:, :, :] 63 | cv2.putText(newImage , "FPS: %f" % (fps), (20, 40), cv2.FONT_HERSHEY_SIMPLEX, 1, (0, 255, 0), 2) 64 | out_video.write(newImage) 65 | 66 | print("captured fps[%f] net_fps[%f]"%(fps, netfps)) 67 | #cv2.imshow("OpenPose 1.5.1 - Tutorial Python API", newImage) 68 | count += 1 69 | 70 | print("==== Summary ====") 71 | print("Inference Size : %s"%(args.res)) 72 | if count: 73 | print("avg fps[%f] avg net_fps[%f]"%(t_fps_time / count, t_netfps_time / count)) 74 | 75 | cv2.destroyAllWindows() 76 | out_video.release() 77 | cap.release() -------------------------------------------------------------------------------- /XavierNX-PoseEstimation using tensorflow(ResNet)/update_code/demo/singleperson.py: -------------------------------------------------------------------------------- 1 | import os 2 | import sys 3 | 4 | sys.path.append(os.path.dirname(__file__) + "/../") 5 | 6 | #from scipy.misc import imread 7 | from PIL import Image, ImageDraw, ImageFont 8 | import time 9 | from util.config import load_config 10 | from nnet import predict 11 | from util import visualize 12 | from dataset.pose_dataset import data_to_input 13 | 14 | 15 | def draw_mpii_points(image, pose): 16 | fontname = '/usr/share/fonts/opentype/noto/NotoSansCJK-Regular.ttc' 17 | fnt = ImageFont.truetype(fontname, 15) 18 | draw = ImageDraw.Draw(image) 19 | radius = 3 20 | clr = (0,255,0) 21 | for i in range(len(pose)): 22 | p = pose[i] 23 | cx = p[0] 24 | cy = p[1] 25 | accuracy = p[2] 26 | draw.ellipse((cx - radius, cy - radius, cx + radius, cy + radius), outline = clr, width=3) 27 | draw.text((cx + 10, cy), "%d"%i, font=fnt, fill=(255,255,255)) 28 | 29 | #draw 30 | draw.line([tuple(pose[0][:2]), tuple(pose[1][:2]), tuple(pose[2][:2]), tuple(pose[3][:2]), tuple(pose[4][:2]), tuple(pose[5][:2]) ],width = 2, fill=(255,255,0)) 31 | draw.line([tuple(pose[6][:2]), tuple(pose[7][:2]), tuple(pose[8][:2]), tuple(pose[9][:2]), tuple(pose[10][:2]), tuple(pose[11][:2]) ],width = 2, fill=(255,255,0)) 32 | draw.line([tuple(pose[12][:2]), tuple(pose[13][:2])],width = 2, fill=(255,255,0)) 33 | draw.line([tuple(pose[12][:2]), tuple(pose[8][:2]), tuple(pose[9][:2]), tuple(pose[12][:2])],width = 2, fill=(255,255,0)) 34 | draw.line([tuple(pose[8][:2]), tuple(pose[2][:2])],width = 2, fill=(255,255,0)) 35 | draw.line([tuple(pose[9][:2]), tuple(pose[3][:2])],width = 2, fill=(255,255,0)) 36 | 37 | image.save('./mpii_result.png') 38 | 39 | 40 | cfg = load_config("demo/pose_cfg.yaml") 41 | 42 | # Load and setup CNN part detector 43 | sess, inputs, outputs = predict.setup_pose_prediction(cfg) 44 | 45 | # Read image from file 46 | file_name = "demo/image.png" 47 | #image = imread(file_name, mode='RGB') 48 | image = Image.open(file_name).convert('RGB') 49 | 50 | image_batch = data_to_input(image) 51 | 52 | start = time.time() 53 | # Compute prediction with the CNN 54 | outputs_np = sess.run(outputs, feed_dict={inputs: image_batch}) 55 | scmap, locref, _ = predict.extract_cnn_output(outputs_np, cfg) 56 | # Extract maximum scoring location from the heatmap, assume 1 person 57 | pose = predict.argmax_pose_predict(scmap, locref, cfg.stride) 58 | end = time.time() 59 | print('===== Net FPS :%f ====='%( 1 / (end - start))) 60 | print(pose) 61 | draw_mpii_points(image, pose) 62 | end = time.time() 63 | print('===== FPS :%f ====='%( 1 / (end - start))) 64 | 65 | 66 | 67 | 68 | # Visualise 69 | #visualize.show_heatmaps(cfg, image, scmap, pose) 70 | #visualize.waitforbuttonpress() 71 | -------------------------------------------------------------------------------- /XavierNX-YOLOv8/WUzgd7C1pWA.mp4: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raspberry-pi-maker/NVIDIA-Jetson/30a5596aa0d9a6a960f2fef4d084eb42a94a2b66/XavierNX-YOLOv8/WUzgd7C1pWA.mp4 -------------------------------------------------------------------------------- /XavierNX-YOLOv8/bytetrack/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raspberry-pi-maker/NVIDIA-Jetson/30a5596aa0d9a6a960f2fef4d084eb42a94a2b66/XavierNX-YOLOv8/bytetrack/__init__.py -------------------------------------------------------------------------------- /XavierNX-YOLOv8/bytetrack/__pycache__/__init__.cpython-38.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raspberry-pi-maker/NVIDIA-Jetson/30a5596aa0d9a6a960f2fef4d084eb42a94a2b66/XavierNX-YOLOv8/bytetrack/__pycache__/__init__.cpython-38.pyc -------------------------------------------------------------------------------- /XavierNX-YOLOv8/bytetrack/__pycache__/basetrack.cpython-38.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raspberry-pi-maker/NVIDIA-Jetson/30a5596aa0d9a6a960f2fef4d084eb42a94a2b66/XavierNX-YOLOv8/bytetrack/__pycache__/basetrack.cpython-38.pyc -------------------------------------------------------------------------------- /XavierNX-YOLOv8/bytetrack/__pycache__/byte_tracker.cpython-38.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raspberry-pi-maker/NVIDIA-Jetson/30a5596aa0d9a6a960f2fef4d084eb42a94a2b66/XavierNX-YOLOv8/bytetrack/__pycache__/byte_tracker.cpython-38.pyc -------------------------------------------------------------------------------- /XavierNX-YOLOv8/bytetrack/__pycache__/kalman_filter.cpython-38.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raspberry-pi-maker/NVIDIA-Jetson/30a5596aa0d9a6a960f2fef4d084eb42a94a2b66/XavierNX-YOLOv8/bytetrack/__pycache__/kalman_filter.cpython-38.pyc -------------------------------------------------------------------------------- /XavierNX-YOLOv8/bytetrack/__pycache__/matching.cpython-38.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raspberry-pi-maker/NVIDIA-Jetson/30a5596aa0d9a6a960f2fef4d084eb42a94a2b66/XavierNX-YOLOv8/bytetrack/__pycache__/matching.cpython-38.pyc -------------------------------------------------------------------------------- /XavierNX-YOLOv8/bytetrack/basetrack.py: -------------------------------------------------------------------------------- 1 | import numpy as np 2 | from collections import OrderedDict 3 | 4 | 5 | class TrackState(object): 6 | New = 0 7 | Tracked = 1 8 | Lost = 2 9 | Removed = 3 10 | 11 | 12 | class BaseTrack(object): 13 | _count = 0 14 | 15 | track_id = 0 16 | is_activated = False 17 | state = TrackState.New 18 | 19 | history = OrderedDict() 20 | features = [] 21 | curr_feature = None 22 | score = 0 23 | start_frame = 0 24 | frame_id = 0 25 | time_since_update = 0 26 | 27 | # multi-camera 28 | location = (np.inf, np.inf) 29 | 30 | @property 31 | def end_frame(self): 32 | return self.frame_id 33 | 34 | @staticmethod 35 | def next_id(): 36 | BaseTrack._count += 1 37 | return BaseTrack._count 38 | 39 | def activate(self, *args): 40 | raise NotImplementedError 41 | 42 | def predict(self): 43 | raise NotImplementedError 44 | 45 | def update(self, *args, **kwargs): 46 | raise NotImplementedError 47 | 48 | def mark_lost(self): 49 | self.state = TrackState.Lost 50 | 51 | def mark_removed(self): 52 | self.state = TrackState.Removed 53 | -------------------------------------------------------------------------------- /XavierNX-YOLOv8/bytetrack/config/bytetrack.yaml: -------------------------------------------------------------------------------- 1 | track_thresh: 0.6 # tracking confidence threshold 2 | track_buffer: 30 # the frames for keep lost tracks 3 | match_thresh: 0.8 # matching threshold for tracking 4 | frame_rate: 30 # FPS 5 | conf_thres: 0.5122620708221085 6 | -------------------------------------------------------------------------------- /XavierNX-YOLOv8/config.py: -------------------------------------------------------------------------------- 1 | import random 2 | 3 | import numpy as np 4 | 5 | random.seed(0) 6 | 7 | # detection model classes 8 | CLASSES = ('person', 'bicycle', 'car', 'motorcycle', 'airplane', 'bus', 9 | 'train', 'truck', 'boat', 'traffic light', 'fire hydrant', 10 | 'stop sign', 'parking meter', 'bench', 'bird', 'cat', 'dog', 11 | 'horse', 'sheep', 'cow', 'elephant', 'bear', 'zebra', 'giraffe', 12 | 'backpack', 'umbrella', 'handbag', 'tie', 'suitcase', 'frisbee', 13 | 'skis', 'snowboard', 'sports ball', 'kite', 'baseball bat', 14 | 'baseball glove', 'skateboard', 'surfboard', 'tennis racket', 15 | 'bottle', 'wine glass', 'cup', 'fork', 'knife', 'spoon', 'bowl', 16 | 'banana', 'apple', 'sandwich', 'orange', 'broccoli', 'carrot', 17 | 'hot dog', 'pizza', 'donut', 'cake', 'chair', 'couch', 18 | 'potted plant', 'bed', 'dining table', 'toilet', 'tv', 'laptop', 19 | 'mouse', 'remote', 'keyboard', 'cell phone', 'microwave', 'oven', 20 | 'toaster', 'sink', 'refrigerator', 'book', 'clock', 'vase', 21 | 'scissors', 'teddy bear', 'hair drier', 'toothbrush') 22 | 23 | # colors for per classes 24 | COLORS = { 25 | cls: [random.randint(0, 255) for _ in range(3)] 26 | for i, cls in enumerate(CLASSES) 27 | } 28 | 29 | # colors for segment masks 30 | MASK_COLORS = np.array([(255, 56, 56), (255, 157, 151), (255, 112, 31), 31 | (255, 178, 29), (207, 210, 49), (72, 249, 10), 32 | (146, 204, 23), (61, 219, 134), (26, 147, 52), 33 | (0, 212, 187), (44, 153, 168), (0, 194, 255), 34 | (52, 69, 147), (100, 115, 255), (0, 24, 236), 35 | (132, 56, 255), (82, 0, 133), (203, 56, 255), 36 | (255, 149, 200), (255, 55, 199)], 37 | dtype=np.float32) / 255. 38 | 39 | # alpha for segment masks 40 | ALPHA = 0.5 41 | -------------------------------------------------------------------------------- /XavierNX-YOLOv8/highway_traffic.mp4: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raspberry-pi-maker/NVIDIA-Jetson/30a5596aa0d9a6a960f2fef4d084eb42a94a2b66/XavierNX-YOLOv8/highway_traffic.mp4 -------------------------------------------------------------------------------- /XavierNX-YOLOv8/models/__init__.py: -------------------------------------------------------------------------------- 1 | from .engine import EngineBuilder, TRTModule, TRTProfilerV0, TRTProfilerV1 # isort:skip # noqa: E501 2 | import warnings 3 | 4 | import torch 5 | 6 | warnings.filterwarnings(action='ignore', category=torch.jit.TracerWarning) 7 | warnings.filterwarnings(action='ignore', category=torch.jit.ScriptWarning) 8 | warnings.filterwarnings(action='ignore', category=UserWarning) 9 | warnings.filterwarnings(action='ignore', category=FutureWarning) 10 | warnings.filterwarnings(action='ignore', category=DeprecationWarning) 11 | __all__ = ['EngineBuilder', 'TRTModule', 'TRTProfilerV0', 'TRTProfilerV1'] 12 | -------------------------------------------------------------------------------- /XavierNX-YOLOv8/models/__pycache__/__init__.cpython-38.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raspberry-pi-maker/NVIDIA-Jetson/30a5596aa0d9a6a960f2fef4d084eb42a94a2b66/XavierNX-YOLOv8/models/__pycache__/__init__.cpython-38.pyc -------------------------------------------------------------------------------- /XavierNX-YOLOv8/models/__pycache__/common.cpython-38.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raspberry-pi-maker/NVIDIA-Jetson/30a5596aa0d9a6a960f2fef4d084eb42a94a2b66/XavierNX-YOLOv8/models/__pycache__/common.cpython-38.pyc -------------------------------------------------------------------------------- /XavierNX-YOLOv8/models/__pycache__/engine.cpython-38.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raspberry-pi-maker/NVIDIA-Jetson/30a5596aa0d9a6a960f2fef4d084eb42a94a2b66/XavierNX-YOLOv8/models/__pycache__/engine.cpython-38.pyc -------------------------------------------------------------------------------- /XavierNX-YOLOv8/models/__pycache__/torch_utils.cpython-38.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raspberry-pi-maker/NVIDIA-Jetson/30a5596aa0d9a6a960f2fef4d084eb42a94a2b66/XavierNX-YOLOv8/models/__pycache__/torch_utils.cpython-38.pyc -------------------------------------------------------------------------------- /XavierNX-YOLOv8/models/__pycache__/utils.cpython-38.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raspberry-pi-maker/NVIDIA-Jetson/30a5596aa0d9a6a960f2fef4d084eb42a94a2b66/XavierNX-YOLOv8/models/__pycache__/utils.cpython-38.pyc -------------------------------------------------------------------------------- /XavierNX-YOLOv8/models/torch_utils.py: -------------------------------------------------------------------------------- 1 | from typing import List, Tuple, Union 2 | 3 | import torch 4 | import torch.nn.functional as F 5 | from torch import Tensor 6 | from torchvision.ops import batched_nms 7 | 8 | 9 | def seg_postprocess( 10 | data: Tuple[Tensor], 11 | shape: Union[Tuple, List], 12 | conf_thres: float = 0.25, 13 | iou_thres: float = 0.65) \ 14 | -> Tuple[Tensor, Tensor, Tensor, Tensor]: 15 | assert len(data) == 2 16 | h, w = shape[0] // 4, shape[1] // 4 # 4x downsampling 17 | outputs, proto = (i[0] for i in data) 18 | bboxes, scores, labels, maskconf = outputs.split([4, 1, 1, 32], 1) 19 | scores, labels = scores.squeeze(), labels.squeeze() 20 | idx = scores > conf_thres 21 | bboxes, scores, labels, maskconf = \ 22 | bboxes[idx], scores[idx], labels[idx], maskconf[idx] 23 | idx = batched_nms(bboxes, scores, labels, iou_thres) 24 | bboxes, scores, labels, maskconf = \ 25 | bboxes[idx], scores[idx], labels[idx].int(), maskconf[idx] 26 | masks = (maskconf @ proto).sigmoid().view(-1, h, w) 27 | masks = crop_mask(masks, bboxes / 4.) 28 | masks = F.interpolate(masks[None], 29 | shape, 30 | mode='bilinear', 31 | align_corners=False)[0] 32 | masks = masks.gt_(0.5)[..., None] 33 | return bboxes, scores, labels, masks 34 | 35 | 36 | def det_postprocess(data: Tuple[Tensor, Tensor, Tensor, Tensor]): 37 | #print("Length:", len(data)) 38 | #print("Data:", data[0][0]) 39 | assert len(data) == 4 40 | num_dets, bboxes, scores, labels = (i[0] for i in data) 41 | nums = num_dets.item() 42 | bboxes = bboxes[:nums] 43 | scores = scores[:nums] 44 | labels = labels[:nums] 45 | return bboxes, scores, labels 46 | 47 | 48 | def crop_mask(masks: Tensor, bboxes: Tensor) -> Tensor: 49 | n, h, w = masks.shape 50 | x1, y1, x2, y2 = torch.chunk(bboxes[:, :, None], 4, 1) # x1 shape(1,1,n) 51 | r = torch.arange(w, device=masks.device, 52 | dtype=x1.dtype)[None, None, :] # rows shape(1,w,1) 53 | c = torch.arange(h, device=masks.device, 54 | dtype=x1.dtype)[None, :, None] # cols shape(h,1,1) 55 | 56 | return masks * ((r >= x1) * (r < x2) * (c >= y1) * (c < y2)) 57 | -------------------------------------------------------------------------------- /XavierNX-YOLOv8/sample.mp4: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raspberry-pi-maker/NVIDIA-Jetson/30a5596aa0d9a6a960f2fef4d084eb42a94a2b66/XavierNX-YOLOv8/sample.mp4 -------------------------------------------------------------------------------- /XavierNX-YOLOv8/sample_detect.py: -------------------------------------------------------------------------------- 1 | from ultralytics import YOLO 2 | 3 | # Load a model 4 | model = YOLO("yolov8n.pt") # load an official model 5 | # Predict with the model 6 | results = model("https://ultralytics.com/images/bus.jpg") # predict on an image 7 | 8 | count = len(results) 9 | 10 | for result in results: 11 | for box in result.boxes.data: 12 | print("x1:%f y1:%f x2[%f] y2[%f] Conf[%f] Label[%f]"%(box[0], box[1], box[2], box[3], box[4], box[5])) 13 | -------------------------------------------------------------------------------- /XavierNX-YOLOv8/sample_detect2.py: -------------------------------------------------------------------------------- 1 | from ultralytics import YOLO 2 | import cv2 3 | 4 | colors = [(255,0 , 0), (0,255,0), (0,0,255)] 5 | font = cv2.FONT_HERSHEY_SIMPLEX 6 | def draw(img, boxes): 7 | index = 0 8 | for box in boxes.data: 9 | p1 = (int(box[0].item()), int(box[1].item())) 10 | p2 = (int(box[2].item()), int(box[3].item())) 11 | img = cv2.rectangle(img, p1, p2, colors[index % len(colors)], 3) 12 | text = label_map[int(box[5].item())] + " %4.2f"%(box[4].item()) 13 | cv2.putText(img, text, (p1[0], p1[1] - 10), font, fontScale = 1, color = colors[index % len(colors)], thickness = 2) 14 | index += 1 15 | cv2.imwrite("./result.jpg", img) 16 | # cv2.imshow("draw", img) 17 | # cv2.waitKey(0) 18 | # cv2.destroyAllWindows() 19 | 20 | 21 | # Load a model 22 | model = YOLO("yolov8n.pt") # load an official model 23 | label_map = model.names 24 | # Predict with the model 25 | results = model("https://ultralytics.com/images/bus.jpg") # predict on an image 26 | 27 | count = len(results) 28 | 29 | for result in results: 30 | draw(result.orig_img, result.boxes) 31 | -------------------------------------------------------------------------------- /XavierNX-YOLOv8/sample_detect3.py: -------------------------------------------------------------------------------- 1 | from ultralytics import YOLO 2 | import cv2 3 | 4 | colors = [(255,0 , 0), (0,255,0), (0,0,255)] 5 | font = cv2.FONT_HERSHEY_SIMPLEX 6 | def draw(img, boxes): 7 | index = 0 8 | for box in boxes.data: 9 | p1 = (int(box[0].item()), int(box[1].item())) 10 | p2 = (int(box[2].item()), int(box[3].item())) 11 | img = cv2.rectangle(img, p1, p2, colors[index % len(colors)], 3) 12 | text = label_map[int(box[5].item())] + " %4.2f"%(box[4].item()) 13 | cv2.putText(img, text, (p1[0], p1[1] - 10), font, fontScale = 1, color = colors[index % len(colors)], thickness = 2) 14 | index += 1 15 | cv2.imwrite("./result2.jpg", img) 16 | # cv2.imshow("draw", img) 17 | # cv2.waitKey(0) 18 | # cv2.destroyAllWindows() 19 | 20 | 21 | # Load a model 22 | model = YOLO("yolov8n.pt") # load an official model 23 | label_map = model.names 24 | 25 | img = cv2.imread("./bus.jpg", cv2.IMREAD_COLOR) 26 | results = model(img) # predict on an image 27 | 28 | for result in results: 29 | draw(result.orig_img, result.boxes) 30 | -------------------------------------------------------------------------------- /XavierNX-YOLOv8/sample_track.py: -------------------------------------------------------------------------------- 1 | import argparse 2 | from ultralytics import YOLO 3 | 4 | def main(): 5 | parser = argparse.ArgumentParser() 6 | parser.add_argument('--track', type=str, default="botsort.yaml" ) #botsort.yaml or bytetrack.yaml 7 | args = parser.parse_args() 8 | model = YOLO("yolov8m.pt") 9 | model.to('cuda') 10 | 11 | for result in model.track(source="./sample.mp4", show=True, stream=True, agnostic_nms=True, tracker=args.track): 12 | pass 13 | 14 | if __name__ == "__main__": 15 | main() -------------------------------------------------------------------------------- /XavierNX-YOLOv8/sample_track2.py: -------------------------------------------------------------------------------- 1 | import cv2 2 | import argparse 3 | from ultralytics import YOLO 4 | import numpy as np 5 | 6 | 7 | def main(): 8 | parser = argparse.ArgumentParser() 9 | parser.add_argument('--track', type=str, default="botsort.yaml" ) #botsort.yaml or bytetrack.yaml 10 | args = parser.parse_args() 11 | model = YOLO("yolov8m.pt") 12 | model.to('cuda') 13 | 14 | colors = [(255,255 , 0), (0,255,0), (0,0,255)] 15 | font = cv2.FONT_HERSHEY_SIMPLEX 16 | label_map = model.names 17 | 18 | for result in model.track(source="./sample.mp4", show=False, stream=True, agnostic_nms=True, tracker=args.track): 19 | 20 | frame = result.orig_img 21 | 22 | for box, conf, cls in zip(result.boxes.data, result.boxes.conf, result.boxes.cls): 23 | index = 0 24 | p1 = (int(box[0].item()), int(box[1].item())) 25 | p2 = (int(box[2].item()), int(box[3].item())) 26 | id = int(box[4].item()) 27 | cv2.rectangle(frame, p1, p2, colors[int(cls.item() % len(colors))], 2) 28 | text = "#" + str(id) + "-"+ label_map[int(cls.item())] + " %4.2f"%(conf.item()) 29 | cv2.putText(frame, text, (p1[0], p1[1] - 10), font, fontScale = 1, color = colors[int(cls.item() % len(colors))], thickness = 2) 30 | index += 1 31 | 32 | cv2.imshow("yolov8", frame) 33 | 34 | if (cv2.waitKey(1) == 27): 35 | break 36 | 37 | 38 | if __name__ == "__main__": 39 | main() -------------------------------------------------------------------------------- /XavierNX-YOLOv8/video_detect.py: -------------------------------------------------------------------------------- 1 | from ultralytics import YOLO 2 | import cv2 3 | import time, sys 4 | import torchvision 5 | import torchvision.transforms as T 6 | 7 | colors = [(255,0 , 0), (0,255,0), (0,0,255)] 8 | font = cv2.FONT_HERSHEY_SIMPLEX 9 | def draw(img, boxes): 10 | index = 0 11 | for box in boxes.data: 12 | p1 = (int(box[0].item()), int(box[1].item())) 13 | p2 = (int(box[2].item()), int(box[3].item())) 14 | img = cv2.rectangle(img, p1, p2, colors[index % len(colors)], 3) 15 | text = label_map[int(box[5].item())] + " %4.2f"%(box[4].item()) 16 | cv2.putText(img, text, (p1[0], p1[1] - 10), font, fontScale = 1, color = colors[index % len(colors)], thickness = 2) 17 | index += 1 18 | cv2.imshow("draw", img) 19 | cv2.waitKey(1) 20 | 21 | 22 | # Load a model 23 | model = YOLO("yolov8n.pt") # load an official model 24 | label_map = model.names 25 | 26 | f = 0 27 | net_total = 0.0 28 | total = 0.0 29 | reader = torchvision.io.VideoReader("./WUzgd7C1pWA.mp4", "video") 30 | first = True 31 | for frame in reader: 32 | s = time.time() 33 | img = T.ToPILImage()(frame["data"]) 34 | results = model(img) # predict on an image 35 | net_e = time.time() 36 | 37 | for result in results: 38 | draw(result.orig_img, result.boxes) 39 | e = time.time() 40 | if(first == False): 41 | net_total += (net_e - s) 42 | total += (e - s) 43 | f += 1 44 | first = False 45 | 46 | fps = f / total 47 | net_fps = f / net_total 48 | 49 | print("FPS:%4.2f"%fps) 50 | print("Net FPS:%4.2f"%net_fps) 51 | cv2.destroyAllWindows() 52 | -------------------------------------------------------------------------------- /XavierNX-YOLOv8/video_detect2.py: -------------------------------------------------------------------------------- 1 | from ultralytics import YOLO 2 | import cv2 3 | import time, sys 4 | import torchvision 5 | import torchvision.transforms as T 6 | 7 | colors = [(255,0 , 0), (0,255,0), (0,0,255)] 8 | font = cv2.FONT_HERSHEY_SIMPLEX 9 | def draw(img, boxes): 10 | index = 0 11 | for box in boxes.data: 12 | p1 = (int(box[0].item()), int(box[1].item())) 13 | p2 = (int(box[2].item()), int(box[3].item())) 14 | img = cv2.rectangle(img, p1, p2, colors[index % len(colors)], 3) 15 | text = label_map[int(box[5].item())] + " %4.2f"%(box[4].item()) 16 | cv2.putText(img, text, (p1[0], p1[1] - 10), font, fontScale = 1, color = colors[index % len(colors)], thickness = 2) 17 | index += 1 18 | cv2.imshow("draw", img) 19 | cv2.waitKey(1) 20 | 21 | 22 | # Load a model 23 | model = YOLO("yolov8n.pt") # load an official model 24 | label_map = model.names 25 | 26 | f = 0 27 | net_total = 0.0 28 | total = 0.0 29 | reader = torchvision.io.VideoReader("./WUzgd7C1pWA.mp4", "video") 30 | first = True 31 | 32 | frame = next(reader) 33 | while frame: 34 | s = time.time() 35 | img = T.ToPILImage()(frame["data"]) 36 | results = model(img) # predict on an image 37 | net_e = time.time() 38 | 39 | for result in results: 40 | draw(result.orig_img, result.boxes) 41 | e = time.time() 42 | if(first == False): 43 | net_total += (net_e - s) 44 | total += (e - s) 45 | f += 1 46 | first = False 47 | try: 48 | frame = next(reader) 49 | except StopIteration: 50 | break 51 | fps = f / total 52 | net_fps = f / net_total 53 | 54 | print("FPS:%4.2f"%fps) 55 | print("Net FPS:%4.2f"%net_fps) 56 | 57 | -------------------------------------------------------------------------------- /XavierNX-YOLOv8/video_detect_cv.py: -------------------------------------------------------------------------------- 1 | from ultralytics import YOLO 2 | import cv2 3 | import time, sys 4 | import torchvision 5 | import torchvision.transforms as T 6 | 7 | colors = [(255,0 , 0), (0,255,0), (0,0,255)] 8 | font = cv2.FONT_HERSHEY_SIMPLEX 9 | 10 | def draw(img, boxes): 11 | index = 0 12 | for box in boxes.data: 13 | p1 = (int(box[0].item()), int(box[1].item())) 14 | p2 = (int(box[2].item()), int(box[3].item())) 15 | img = cv2.rectangle(img, p1, p2, colors[index % len(colors)], 3) 16 | text = label_map[int(box[5].item())] + " %4.2f"%(box[4].item()) 17 | cv2.putText(img, text, (p1[0], p1[1] - 10), font, fontScale = 1, color = colors[index % len(colors)], thickness = 2) 18 | index += 1 19 | # cv2.imshow("draw", img) 20 | # cv2.waitKey(1) 21 | out_video.write(img) 22 | 23 | 24 | # Load a model 25 | model = YOLO("yolov8l.pt") # load an official model 26 | label_map = model.names 27 | 28 | f = 0 29 | net_total = 0.0 30 | total = 0.0 31 | 32 | cap = cv2.VideoCapture("./WUzgd7C1pWA.mp4") 33 | # Skip First frame 34 | ret, img = cap.read() 35 | if ret == False: 36 | print('Video File Read Error') 37 | sys.exit(0) 38 | 39 | results = model(img) # predict on an image 40 | h, w, c = img.shape 41 | print('Video Frame shape H:%d, W:%d, Channel:%d'%(h, w, c)) 42 | 43 | fourcc = cv2.VideoWriter_fourcc('m', 'p', '4', 'v') 44 | out_video = cv2.VideoWriter('./cv_result.mp4', fourcc, cap.get(cv2.CAP_PROP_FPS), (w, h)) 45 | 46 | 47 | while cap.isOpened(): 48 | s = time.time() 49 | ret, img = cap.read() 50 | if ret == False: 51 | break 52 | 53 | results = model(img) # predict on an image 54 | net_e = time.time() 55 | for result in results: 56 | draw(result.orig_img, result.boxes) 57 | e = time.time() 58 | net_total += (net_e - s) 59 | total += (e - s) 60 | f += 1 61 | 62 | 63 | fps = f / total 64 | net_fps = f / net_total 65 | 66 | print("Total processed frames:%d"%f) 67 | print("FPS:%4.2f"%fps) 68 | print("Net FPS:%4.2f"%net_fps) 69 | cv2.destroyAllWindows() 70 | cap.release() 71 | out_video.release() 72 | -------------------------------------------------------------------------------- /XavierNX-YOLOv8/video_detect_cv2.py: -------------------------------------------------------------------------------- 1 | from ultralytics import YOLO 2 | import cv2 3 | import time, sys 4 | import torchvision 5 | import torchvision.transforms as T 6 | 7 | colors = [(255,0 , 0), (0,255,0), (0,0,255)] 8 | font = cv2.FONT_HERSHEY_SIMPLEX 9 | fourcc = cv2.VideoWriter_fourcc('m', 'p', '4', 'v') 10 | 11 | def draw(img, boxes): 12 | index = 0 13 | for box in boxes.data: 14 | p1 = (int(box[0].item()), int(box[1].item())) 15 | p2 = (int(box[2].item()), int(box[3].item())) 16 | img = cv2.rectangle(img, p1, p2, colors[index % len(colors)], 3) 17 | text = label_map[int(box[5].item())] + " %4.2f"%(box[4].item()) 18 | cv2.putText(img, text, (p1[0], p1[1] - 10), font, fontScale = 1, color = colors[index % len(colors)], thickness = 2) 19 | index += 1 20 | # cv2.imshow("draw", img) 21 | # cv2.waitKey(1) 22 | 23 | 24 | # Load a model 25 | model = YOLO("yolov8s.pt") # load an official model 26 | label_map = model.names 27 | 28 | f = 0 29 | net_total = 0.0 30 | total = 0.0 31 | 32 | cap = cv2.VideoCapture("./highway_traffic.mp4") 33 | # Skip First frame 34 | ret, img = cap.read() 35 | if ret == False: 36 | print('Video File Read Error') 37 | sys.exit(0) 38 | 39 | h, w, c = img.shape 40 | print('Video Frame shape H:%d, W:%d, Channel:%d'%(h, w, c)) 41 | 42 | fourcc = cv2.VideoWriter_fourcc('m', 'p', '4', 'v') 43 | out_video = cv2.VideoWriter('./cv_result.mp4', fourcc, cap.get(cv2.CAP_PROP_FPS), (w, h)) 44 | results = model(img) # predict on an image 45 | 46 | while cap.isOpened(): 47 | s = time.time() 48 | ret, img = cap.read() 49 | if ret == False: 50 | break 51 | 52 | net_s = time.time() 53 | results = model(img) # predict on an image 54 | net_e = time.time() 55 | for result in results: 56 | draw(result.orig_img, result.boxes) 57 | e = time.time() 58 | net_total += (net_e - net_s) 59 | total += (e - s) 60 | f += 1 61 | out_video.write(result.orig_img) 62 | 63 | 64 | fps = f / total 65 | net_fps = f / net_total 66 | 67 | print("Total processed frames:%d"%f) 68 | print("FPS:%4.2f"%fps) 69 | print("Net FPS:%4.2f"%net_fps) 70 | cv2.destroyAllWindows() 71 | cap.release() 72 | out_video.release() 73 | -------------------------------------------------------------------------------- /XavierNX-YOLOv8/video_detect_torch.py: -------------------------------------------------------------------------------- 1 | from ultralytics import YOLO 2 | import cv2 3 | import time, sys 4 | import torchvision 5 | import torchvision.transforms as T 6 | 7 | colors = [(255,0 , 0), (0,255,0), (0,0,255)] 8 | font = cv2.FONT_HERSHEY_SIMPLEX 9 | fourcc = cv2.VideoWriter_fourcc('m', 'p', '4', 'v') 10 | 11 | def draw(img, boxes): 12 | index = 0 13 | for box in boxes.data: 14 | p1 = (int(box[0].item()), int(box[1].item())) 15 | p2 = (int(box[2].item()), int(box[3].item())) 16 | img = cv2.rectangle(img, p1, p2, colors[index % len(colors)], 3) 17 | text = label_map[int(box[5].item())] + " %4.2f"%(box[4].item()) 18 | cv2.putText(img, text, (p1[0], p1[1] - 10), font, fontScale = 1, color = colors[index % len(colors)], thickness = 2) 19 | index += 1 20 | # cv2.imshow("draw", img) 21 | # cv2.waitKey(1) 22 | out_video.write(img) 23 | 24 | 25 | # Load a model 26 | model = YOLO("yolov8l.pt") # load an official model 27 | label_map = model.names 28 | 29 | f = 0 30 | net_total = 0.0 31 | total = 0.0 32 | reader = torchvision.io.VideoReader("./WUzgd7C1pWA.mp4", "video") 33 | meta = reader.get_metadata() 34 | fps = meta["video"]['fps'][0] 35 | frame = next(reader) 36 | img = T.ToPILImage()(frame["data"]) 37 | results = model(img) # predict on an image 38 | 39 | shape = frame['data'].shape # pytorch image tensor shape is C H W 40 | size = (frame['data'].shape[2], frame['data'].shape[1]) 41 | out_video = cv2.VideoWriter('./torch_result.mp4', fourcc, fps, size) 42 | 43 | 44 | while frame: 45 | s = time.time() 46 | try: 47 | frame = next(reader) 48 | except StopIteration: 49 | break 50 | img = T.ToPILImage()(frame["data"]) 51 | results = model(img) # predict on an image 52 | net_e = time.time() 53 | 54 | for result in results: 55 | draw(result.orig_img, result.boxes) 56 | e = time.time() 57 | net_total += (net_e - s) 58 | total += (e - s) 59 | f += 1 60 | 61 | 62 | fps = f / total 63 | net_fps = f / net_total 64 | 65 | print("Total processed frames:%d"%f) 66 | print("FPS:%4.2f"%fps) 67 | print("Net FPS:%4.2f"%net_fps) 68 | cv2.destroyAllWindows() 69 | out_video.release() 70 | -------------------------------------------------------------------------------- /conversion Tensorflow model to TensorRT/pb_viewer.py: -------------------------------------------------------------------------------- 1 | import argparse 2 | import tensorflow as tf 3 | 4 | parser = argparse.ArgumentParser(description='tf-model-conversion to TensorRT') 5 | parser.add_argument('--model_dir', type=str, required=True) 6 | parser.add_argument('--log_dir', type=str, required=True) 7 | args = parser.parse_args() 8 | 9 | 10 | with tf.Session() as sess: 11 | model_filename = args.model_dir 12 | with tf.gfile.GFile(model_filename, 'rb') as f: 13 | graph_def = tf.GraphDef() 14 | graph_def.ParseFromString(f.read()) 15 | g_in = tf.import_graph_def(graph_def) 16 | LOGDIR=args.log_dir 17 | train_writer = tf.summary.FileWriter(LOGDIR) 18 | train_writer.add_graph(sess.graph) 19 | train_writer.flush() 20 | train_writer.close() -------------------------------------------------------------------------------- /face_recognition/digital_makeup.py: -------------------------------------------------------------------------------- 1 | from PIL import Image, ImageDraw 2 | import face_recognition 3 | 4 | # Load the jpg file into a numpy array 5 | image = face_recognition.load_image_file("./img/known/biden.jpg") 6 | 7 | # Find all facial features in all the faces in the image 8 | face_landmarks_list = face_recognition.face_landmarks(image) 9 | 10 | pil_image = Image.fromarray(image) 11 | for face_landmarks in face_landmarks_list: 12 | d = ImageDraw.Draw(pil_image, 'RGBA') 13 | 14 | # Make the eyebrows into a nightmare 15 | d.polygon(face_landmarks['left_eyebrow'], fill=(68, 54, 39, 128)) 16 | d.polygon(face_landmarks['right_eyebrow'], fill=(68, 54, 39, 128)) 17 | d.line(face_landmarks['left_eyebrow'], fill=(68, 54, 39, 150), width=5) 18 | d.line(face_landmarks['right_eyebrow'], fill=(68, 54, 39, 150), width=5) 19 | 20 | # Gloss the lips 21 | d.polygon(face_landmarks['top_lip'], fill=(150, 0, 0, 128)) 22 | d.polygon(face_landmarks['bottom_lip'], fill=(150, 0, 0, 128)) 23 | d.line(face_landmarks['top_lip'], fill=(150, 0, 0, 64), width=8) 24 | d.line(face_landmarks['bottom_lip'], fill=(150, 0, 0, 64), width=8) 25 | 26 | # Sparkle the eyes 27 | d.polygon(face_landmarks['left_eye'], fill=(255, 255, 255, 30)) 28 | d.polygon(face_landmarks['right_eye'], fill=(255, 255, 255, 30)) 29 | 30 | # Apply some eyeliner 31 | d.line(face_landmarks['left_eye'] + [face_landmarks['left_eye'][0]], fill=(0, 0, 0, 110), width=6) 32 | d.line(face_landmarks['right_eye'] + [face_landmarks['right_eye'][0]], fill=(0, 0, 0, 110), width=6) 33 | 34 | pil_image.show() -------------------------------------------------------------------------------- /face_recognition/facematch2.py: -------------------------------------------------------------------------------- 1 | import argparse 2 | import time 3 | import face_recognition 4 | 5 | parser = argparse.ArgumentParser(description='face match run') 6 | parser.add_argument('--known', type=str, default='./img/known/Bill Gates.jpg') 7 | parser.add_argument('--unknown', type=str, default='./img/unknown/bill-gates-4.jpg') 8 | args = parser.parse_args() 9 | 10 | s_time = time.perf_counter() 11 | image_of_known = face_recognition.load_image_file(args.known) 12 | known_face_encoding = face_recognition.face_encodings(image_of_known)[0] 13 | 14 | unknown_image = face_recognition.load_image_file(args.unknown) 15 | unknown_face_encoding = face_recognition.face_encodings(unknown_image)[0] 16 | 17 | # Compare faces 18 | results = face_recognition.compare_faces([known_face_encoding], unknown_face_encoding, tolerance=0.7) 19 | e_time = time.perf_counter() 20 | 21 | if results[0]: 22 | print('[%s] [%s] are the same person'%(args.known, args.unknown)) 23 | else: 24 | print('[%s] [%s] are NOT the same person'%(args.known, args.unknown)) 25 | 26 | print('Elapsed Time:%5.2f seconds'%(e_time - s_time)) -------------------------------------------------------------------------------- /face_recognition/findfaces2.py: -------------------------------------------------------------------------------- 1 | import argparse 2 | import time 3 | from PIL import Image, ImageDraw 4 | import face_recognition 5 | 6 | s_time = time.time() 7 | parser = argparse.ArgumentParser(description='face match run') 8 | parser.add_argument('--image', type=str, default='./img/groups/team2.jpg') 9 | args = parser.parse_args() 10 | 11 | image = face_recognition.load_image_file(args.image) 12 | face_locations = face_recognition.face_locations(image) 13 | 14 | pil_image = Image.fromarray(image) 15 | img = ImageDraw.Draw(pil_image) 16 | 17 | # Array of coords of each face 18 | # print(face_locations) 19 | for face_location in face_locations: 20 | top, right, bottom, left = face_location 21 | img.rectangle([(left, top),(right, bottom)], fill=None, outline='green') 22 | 23 | print(f'There are {len(face_locations)} people in this image') 24 | pil_image.save('findface_result.jpg') 25 | e_time = time.time() 26 | elapsed = e_time - s_time 27 | print('Elapsed Time:%f seconds'%(elapsed)) 28 | -------------------------------------------------------------------------------- /face_recognition/identify2.py: -------------------------------------------------------------------------------- 1 | import argparse 2 | import time 3 | import face_recognition 4 | from PIL import Image, ImageDraw 5 | 6 | parser = argparse.ArgumentParser(description='face match run') 7 | parser.add_argument('--group', type=str, default='./img/groups/bill-steve-elon.jpg') 8 | args = parser.parse_args() 9 | 10 | image_of_bill = face_recognition.load_image_file('./img/known/Bill Gates.jpg') 11 | bill_face_encoding = face_recognition.face_encodings(image_of_bill)[0] 12 | 13 | image_of_steve = face_recognition.load_image_file('./img/known/Steve Jobs.jpg') 14 | steve_face_encoding = face_recognition.face_encodings(image_of_steve)[0] 15 | 16 | image_of_elon = face_recognition.load_image_file('./img/known/Elon Musk.jpg') 17 | elon_face_encoding = face_recognition.face_encodings(image_of_elon)[0] 18 | 19 | # Create arrays of encodings and names 20 | known_face_encodings = [ 21 | bill_face_encoding, 22 | steve_face_encoding, 23 | elon_face_encoding 24 | ] 25 | 26 | known_face_names = [ 27 | "Bill Gates", 28 | "Steve Jobs", 29 | "Elon Musk" 30 | ] 31 | 32 | # Load test image to find faces in 33 | test_image = face_recognition.load_image_file(args.group) 34 | 35 | # Find faces in test image 36 | face_locations = face_recognition.face_locations(test_image) 37 | face_encodings = face_recognition.face_encodings(test_image, face_locations) 38 | # Convert to PIL format 39 | pil_image = Image.fromarray(test_image) 40 | 41 | # Create a ImageDraw instance 42 | draw = ImageDraw.Draw(pil_image) 43 | 44 | # Loop through faces in test image 45 | for(top, right, bottom, left), face_encoding in zip(face_locations, face_encodings): 46 | matches = face_recognition.compare_faces(known_face_encodings, face_encoding) 47 | 48 | name = "Unknown Person" 49 | 50 | # If match 51 | if True in matches: 52 | first_match_index = matches.index(True) 53 | name = known_face_names[first_match_index] 54 | 55 | # Draw box 56 | draw.rectangle(((left, top), (right, bottom)), outline=(255,255,0)) 57 | 58 | # Draw label 59 | text_width, text_height = draw.textsize(name) 60 | draw.rectangle(((left,bottom - text_height - 10), (right, bottom)), fill=(255,255,0), outline=(255,255,0)) 61 | draw.text((left + 6, bottom - text_height - 5), name, fill=(0,0,0)) 62 | 63 | del draw 64 | 65 | # Display image 66 | pil_image.show() 67 | 68 | # Save image 69 | pil_image.save('identify.jpg') -------------------------------------------------------------------------------- /face_recognition/img/groups/bill-steve-elon-keanu.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raspberry-pi-maker/NVIDIA-Jetson/30a5596aa0d9a6a960f2fef4d084eb42a94a2b66/face_recognition/img/groups/bill-steve-elon-keanu.jpg -------------------------------------------------------------------------------- /face_recognition/img/known/Elon Musk.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raspberry-pi-maker/NVIDIA-Jetson/30a5596aa0d9a6a960f2fef4d084eb42a94a2b66/face_recognition/img/known/Elon Musk.jpg -------------------------------------------------------------------------------- /face_recognition/img/known/biden.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raspberry-pi-maker/NVIDIA-Jetson/30a5596aa0d9a6a960f2fef4d084eb42a94a2b66/face_recognition/img/known/biden.jpg -------------------------------------------------------------------------------- /face_recognition/img/known/spypiggy.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raspberry-pi-maker/NVIDIA-Jetson/30a5596aa0d9a6a960f2fef4d084eb42a94a2b66/face_recognition/img/known/spypiggy.jpg -------------------------------------------------------------------------------- /object_detection/pb_viewer.py: -------------------------------------------------------------------------------- 1 | import argparse 2 | import tensorflow.contrib.tensorrt as trt 3 | import tensorflow as tf 4 | 5 | parser = argparse.ArgumentParser(description='tf-model-conversion to TensorRT') 6 | parser.add_argument('--model_dir', type=str, required=True) 7 | parser.add_argument('--log_dir', type=str, required=True) 8 | args = parser.parse_args() 9 | 10 | 11 | with tf.Session() as sess: 12 | model_filename = args.model_dir 13 | with tf.gfile.GFile(model_filename, 'rb') as f: 14 | graph_def = tf.GraphDef() 15 | graph_def.ParseFromString(f.read()) 16 | g_in = tf.import_graph_def(graph_def) 17 | LOGDIR=args.log_dir 18 | train_writer = tf.summary.FileWriter(LOGDIR) 19 | train_writer.add_graph(sess.graph) 20 | train_writer.flush() 21 | train_writer.close() 22 | -------------------------------------------------------------------------------- /openpose-TX2/run_cam_tx2.py: -------------------------------------------------------------------------------- 1 | import logging 2 | import sys 3 | import time 4 | import math 5 | import cv2 6 | import numpy as np 7 | from openpose import pyopenpose as op 8 | 9 | if __name__ == '__main__': 10 | fps_time = 0 11 | 12 | params = dict() 13 | params["model_folder"] = "../../models/" 14 | 15 | # Starting OpenPose 16 | opWrapper = op.WrapperPython() 17 | opWrapper.configure(params) 18 | opWrapper.start() 19 | 20 | 21 | print("OpenPose start") 22 | cap = cv2.VideoCapture("nvarguscamerasrc ! video/x-raw(memory:NVMM), width=(int)640, height=(int)480,format=(string)NV12, framerate=(fraction)24/1 ! nvvidconv flip-method=0 ! video/x-raw, format=(string)BGRx ! videoconvert ! video/x-raw, format=(string)BGR ! appsink") 23 | #cap.set(cv2.CAP_PROP_FRAME_WIDTH, 640) 24 | #cap.set(cv2.CAP_PROP_FRAME_HEIGHT, 480) 25 | 26 | ret_val, img = cap.read() 27 | fourcc = cv2.VideoWriter_fourcc('m', 'p', '4', 'v') 28 | out_video = cv2.VideoWriter('/tmp/output.mp4', fourcc, cap.get(cv2.CAP_PROP_FPS), (640, 480)) 29 | 30 | count = 0 31 | 32 | if cap is None: 33 | print("Camera Open Error") 34 | sys.exit(0) 35 | while cap.isOpened() and count < 30: 36 | ret_val, dst = cap.read() 37 | if ret_val == False: 38 | print("Camera read Error") 39 | break 40 | #dst = cv2.resize(image, dsize=(320, 240), interpolation=cv2.INTER_AREA) 41 | #cv2.imshow("OpenPose 1.5.1 - Tutorial Python API", dst) 42 | #continue 43 | 44 | datum = op.Datum() 45 | datum.cvInputData = dst 46 | opWrapper.emplaceAndPop([datum]) 47 | fps = 1.0 / (time.time() - fps_time) 48 | fps_time = time.time() 49 | newImage = datum.cvOutputData[:, :, :] 50 | cv2.putText(newImage , "FPS: %f" % (fps), (20, 40), cv2.FONT_HERSHEY_SIMPLEX, 1, (0, 255, 0), 2) 51 | out_video.write(newImage) 52 | 53 | print("captured fps %f"%(fps)) 54 | cv2.imshow("OpenPose 1.5.1 - Tutorial Python API", newImage) 55 | count += 1 56 | 57 | 58 | cv2.destroyAllWindows() 59 | out_video.release() 60 | cap.release() 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | -------------------------------------------------------------------------------- /openpose-TX2/run_webcam_tx2.py: -------------------------------------------------------------------------------- 1 | import logging 2 | import sys 3 | import time 4 | import math 5 | import cv2 6 | import numpy as np 7 | from openpose import pyopenpose as op 8 | 9 | if __name__ == '__main__': 10 | fps_time = 0 11 | 12 | params = dict() 13 | params["model_folder"] = "../../models/" 14 | 15 | # Starting OpenPose 16 | opWrapper = op.WrapperPython() 17 | opWrapper.configure(params) 18 | opWrapper.start() 19 | 20 | 21 | print("OpenPose start") 22 | stream = "nvarguscamerasrc ! video/x-raw(memory:NVMM), width=(int)640, height=(int)480,format=(string)NV12, framerate=(fraction)30/1 ! nvvidconv flip-method=0 ! video/x-raw, format=(string)BGRx ! videoconvert ! video/x-raw, format=(string)BGR ! appsink" 23 | cap = cv2.VideoCapture(stream, cv2.CAP_GSTREAMER) 24 | # cap.set(cv2.CAP_PROP_FRAME_WIDTH, 640) 25 | # cap.set(cv2.CAP_PROP_FRAME_HEIGHT, 480) 26 | 27 | ret_val, img = cap.read() 28 | fourcc = cv2.VideoWriter_fourcc('m', 'p', '4', 'v') 29 | out_video = cv2.VideoWriter('/tmp/output.mp4', fourcc, cap.get(cv2.CAP_PROP_FPS), (640, 480)) 30 | 31 | count = 0 32 | 33 | if cap is None: 34 | print("Camera Open Error") 35 | sys.exit(0) 36 | while cap.isOpened() and count < 30: 37 | ret_val, dst = cap.read() 38 | if ret_val == False: 39 | print("Camera read Error") 40 | break 41 | #dst = cv2.resize(image, dsize=(320, 240), interpolation=cv2.INTER_AREA) 42 | #cv2.imshow("OpenPose 1.5.1 - Tutorial Python API", dst) 43 | #continue 44 | 45 | datum = op.Datum() 46 | datum.cvInputData = dst 47 | opWrapper.emplaceAndPop([datum]) 48 | fps = 1.0 / (time.time() - fps_time) 49 | fps_time = time.time() 50 | newImage = datum.cvOutputData[:, :, :] 51 | cv2.putText(newImage , "FPS: %f" % (fps), (20, 40), cv2.FONT_HERSHEY_SIMPLEX, 1, (0, 255, 0), 2) 52 | out_video.write(newImage) 53 | 54 | print("captured fps %f"%(fps)) 55 | cv2.imshow("OpenPose 1.5.1 - Tutorial Python API", newImage) 56 | count += 1 57 | 58 | 59 | cv2.destroyAllWindows() 60 | out_video.release() 61 | cap.release() 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | -------------------------------------------------------------------------------- /openpose/README.md: -------------------------------------------------------------------------------- 1 | # Repo for NVIDIA Jetson series blog 2 | See the following url for detailed description
3 | https://spyjetson.blogspot.com/2019/10/jetsonnano-human-pose-estimation-using.html

4 | 5 | Copy these codes to your openpose installation directory/examples/tutorial_api_python. 6 | You might see these sample python files in that directory.
7 | 01_body_from_image.py
8 | 02_whole_body_from_image.py
9 | 04_keypoints_from_images.py
10 | 05_keypoints_from_images_multi_gpu.py
11 | 06_face_from_image.py
12 | 07_hand_from_image.py
13 | 08_heatmaps_from_image.py
14 | 09_keypoints_from_heatmaps.py
15 | CMakeLists.txt
-------------------------------------------------------------------------------- /openpose/run_webcam.py: -------------------------------------------------------------------------------- 1 | import logging 2 | import sys 3 | import time 4 | import math 5 | import cv2 6 | import numpy as np 7 | from openpose import pyopenpose as op 8 | 9 | if __name__ == '__main__': 10 | fps_time = 0 11 | 12 | params = dict() 13 | params["model_folder"] = "../../models/" 14 | 15 | # Starting OpenPose 16 | opWrapper = op.WrapperPython() 17 | opWrapper.configure(params) 18 | opWrapper.start() 19 | 20 | 21 | print("OpenPose start") 22 | cap = cv2.VideoCapture(0) 23 | if cap is None: 24 | print("Camera Open Error") 25 | sys.exit(0) 26 | 27 | cap.set(cv2.CAP_PROP_FRAME_WIDTH, 640) 28 | cap.set(cv2.CAP_PROP_FRAME_HEIGHT, 480) 29 | 30 | ret_val, img = cap.read() 31 | fourcc = cv2.VideoWriter_fourcc('m', 'p', '4', 'v') 32 | out_video = cv2.VideoWriter('/tmp/output.mp4', fourcc, cap.get(cv2.CAP_PROP_FPS), (640, 480)) 33 | 34 | count = 0 35 | 36 | 37 | while cap.isOpened() and count < 30: 38 | ret_val, dst = cap.read() 39 | if ret_val == False: 40 | print("Camera read Error") 41 | break 42 | #dst = cv2.resize(image, dsize=(320, 240), interpolation=cv2.INTER_AREA) 43 | #cv2.imshow("OpenPose 1.5.1 - Tutorial Python API", dst) 44 | #continue 45 | 46 | datum = op.Datum() 47 | datum.cvInputData = dst 48 | opWrapper.emplaceAndPop([datum]) 49 | fps = 1.0 / (time.time() - fps_time) 50 | fps_time = time.time() 51 | newImage = datum.cvOutputData[:, :, :] 52 | cv2.putText(newImage , "FPS: %f" % (fps), (20, 40), cv2.FONT_HERSHEY_SIMPLEX, 1, (0, 255, 0), 2) 53 | out_video.write(newImage) 54 | 55 | print("captured fps %f"%(fps)) 56 | cv2.imshow("OpenPose 1.5.1 - Tutorial Python API", newImage) 57 | count += 1 58 | 59 | 60 | cv2.destroyAllWindows() 61 | out_video.release() 62 | cap.release() 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | -------------------------------------------------------------------------------- /raspberryPi-EdgeTPU-TensorflowLite/pose_camera_cv.py: -------------------------------------------------------------------------------- 1 | import argparse 2 | import time 3 | import math 4 | import cv2 5 | import numpy as np 6 | from pose_engine import PoseEngine 7 | 8 | 9 | def main(): 10 | parser = argparse.ArgumentParser(description='PoseNet') 11 | parser.add_argument('--model', type=str, default='mobilenet') 12 | args = parser.parse_args() 13 | 14 | if args.model == 'mobilenet': 15 | model = 'models/mobilenet/posenet_mobilenet_v1_075_353_481_quant_decoder_edgetpu.tflite' 16 | else: 17 | model = 'models/resnet/posenet_resnet_50_416_288_16_quant_edgetpu_decoder.tflite' 18 | 19 | engine = PoseEngine(model) 20 | input_shape = engine.get_input_tensor_shape() 21 | inference_size = (input_shape[2], input_shape[1]) 22 | print(inference_size) 23 | cap = cv2.VideoCapture(0) 24 | fourcc = cv2.VideoWriter_fourcc('m', 'p', '4', 'v') 25 | out_video = cv2.VideoWriter('./output.mp4', fourcc, cap.get(cv2.CAP_PROP_FPS), inference_size) 26 | 27 | cap.set(cv2.CAP_PROP_FRAME_WIDTH, 640) 28 | cap.set(cv2.CAP_PROP_FRAME_HEIGHT, 480) 29 | if cap is None: 30 | print("Camera Open Error") 31 | sys.exit(0) 32 | 33 | count = 0 34 | total_ftp = 0.0 35 | fps_cnt = 0 36 | while cap.isOpened() and count < 60: 37 | ret_val, img = cap.read() 38 | if ret_val == False: 39 | print("Camera read Error") 40 | break 41 | print('frame read') 42 | img = cv2.resize(img, inference_size) 43 | rgb = cv2.cvtColor(img, cv2.COLOR_BGR2RGB) 44 | s_time = time.time() 45 | poses, inference_time = engine.DetectPosesInImage(rgb) 46 | fps = 1.0 / (time.time() - s_time) 47 | total_ftp += fps 48 | fps_cnt += 1 49 | for pose in poses: 50 | print('\nPose Score: %f FPS:%f'%(pose.score, fps)) 51 | if pose.score < 0.3: continue 52 | for label, keypoint in pose.keypoints.items(): 53 | print(' %-20s x=%-4d y=%-4d score=%.1f' %(label, keypoint.yx[1], keypoint.yx[0], keypoint.score)) 54 | p1 = (keypoint.yx[1], keypoint.yx[0]) 55 | p2 = (keypoint.yx[1] + 5, keypoint.yx[0] + 5) 56 | cv2.circle(img, (keypoint.yx[1], keypoint.yx[0]), 2, (0,255,0), -1) 57 | 58 | out_video.write(img) 59 | count += 1 60 | if fps_cnt > 0: 61 | print('Model[%s] Avg FPS: %f'%(args.model, total_ftp / fps_cnt)) 62 | cv2.destroyAllWindows() 63 | cap.release() 64 | out_video.release() 65 | 66 | if __name__ == '__main__': 67 | main() 68 | 69 | 70 | -------------------------------------------------------------------------------- /raspberryPi-EdgeTPU-TensorflowLite/simple_pose2.py: -------------------------------------------------------------------------------- 1 | # Copyright 2019 Google LLC 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # https://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | import os 16 | import numpy as np 17 | from PIL import Image, ImageDraw 18 | from pose_engine import PoseEngine 19 | import argparse 20 | 21 | parser = argparse.ArgumentParser(description='PoseNet') 22 | parser.add_argument('--model', type=str, default='mobilenet') 23 | args = parser.parse_args() 24 | 25 | os.system('wget https://upload.wikimedia.org/wikipedia/commons/thumb/3/38/' 26 | 'Hindu_marriage_ceremony_offering.jpg/' 27 | '640px-Hindu_marriage_ceremony_offering.jpg -O couple.jpg') 28 | pil_image = Image.open('couple.jpg') 29 | 30 | if(args.model == 'mobilenet'): 31 | pil_image.resize((641, 481), Image.NEAREST) 32 | engine = PoseEngine('models/mobilenet/posenet_mobilenet_v1_075_481_641_quant_decoder_edgetpu.tflite') 33 | else: 34 | pil_image.resize((640, 480), Image.NEAREST) 35 | engine = PoseEngine('models/resnet/posenet_resnet_50_640_480_16_quant_edgetpu_decoder.tflite') 36 | 37 | poses, inference_time = engine.DetectPosesInImage(np.uint8(pil_image)) 38 | print('Inference time: %.fms' % inference_time) 39 | 40 | output = pil_image.copy() 41 | draw = ImageDraw.Draw(output) 42 | for pose in poses: 43 | if pose.score < 0.4: continue 44 | print('\nPose Score: ', pose.score) 45 | for label, keypoint in pose.keypoints.items(): 46 | print(' %-20s x=%-4d y=%-4d score=%.1f' % 47 | (label, keypoint.yx[1], keypoint.yx[0], keypoint.score)) 48 | p1 = (keypoint.yx[1], keypoint.yx[0]) 49 | p2 = (keypoint.yx[1] + 5, keypoint.yx[0] + 5) 50 | draw.ellipse([p1, p2], fill=(0,255,0,255)) 51 | draw.text((keypoint.yx[1] + 10,keypoint.yx[0] - 10), label, fill=(0,255,0,128)) 52 | 53 | output.save('./couple_' + args.model + '.jpg') -------------------------------------------------------------------------------- /test_images/airplane_0.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raspberry-pi-maker/NVIDIA-Jetson/30a5596aa0d9a6a960f2fef4d084eb42a94a2b66/test_images/airplane_0.jpg -------------------------------------------------------------------------------- /test_images/airplane_1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raspberry-pi-maker/NVIDIA-Jetson/30a5596aa0d9a6a960f2fef4d084eb42a94a2b66/test_images/airplane_1.jpg -------------------------------------------------------------------------------- /test_images/banana_0.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raspberry-pi-maker/NVIDIA-Jetson/30a5596aa0d9a6a960f2fef4d084eb42a94a2b66/test_images/banana_0.jpg -------------------------------------------------------------------------------- /test_images/bird_0.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raspberry-pi-maker/NVIDIA-Jetson/30a5596aa0d9a6a960f2fef4d084eb42a94a2b66/test_images/bird_0.jpg -------------------------------------------------------------------------------- /test_images/bird_1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raspberry-pi-maker/NVIDIA-Jetson/30a5596aa0d9a6a960f2fef4d084eb42a94a2b66/test_images/bird_1.jpg -------------------------------------------------------------------------------- /test_images/bird_2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raspberry-pi-maker/NVIDIA-Jetson/30a5596aa0d9a6a960f2fef4d084eb42a94a2b66/test_images/bird_2.jpg -------------------------------------------------------------------------------- /test_images/black_bear.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raspberry-pi-maker/NVIDIA-Jetson/30a5596aa0d9a6a960f2fef4d084eb42a94a2b66/test_images/black_bear.jpg -------------------------------------------------------------------------------- /test_images/bottle_0.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raspberry-pi-maker/NVIDIA-Jetson/30a5596aa0d9a6a960f2fef4d084eb42a94a2b66/test_images/bottle_0.jpg -------------------------------------------------------------------------------- /test_images/cat_1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raspberry-pi-maker/NVIDIA-Jetson/30a5596aa0d9a6a960f2fef4d084eb42a94a2b66/test_images/cat_1.jpg -------------------------------------------------------------------------------- /test_images/city_1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raspberry-pi-maker/NVIDIA-Jetson/30a5596aa0d9a6a960f2fef4d084eb42a94a2b66/test_images/city_1.jpg -------------------------------------------------------------------------------- /test_images/coral.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raspberry-pi-maker/NVIDIA-Jetson/30a5596aa0d9a6a960f2fef4d084eb42a94a2b66/test_images/coral.jpg -------------------------------------------------------------------------------- /test_images/desk.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raspberry-pi-maker/NVIDIA-Jetson/30a5596aa0d9a6a960f2fef4d084eb42a94a2b66/test_images/desk.jpg -------------------------------------------------------------------------------- /test_images/dog_0.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raspberry-pi-maker/NVIDIA-Jetson/30a5596aa0d9a6a960f2fef4d084eb42a94a2b66/test_images/dog_0.jpg -------------------------------------------------------------------------------- /test_images/dog_1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raspberry-pi-maker/NVIDIA-Jetson/30a5596aa0d9a6a960f2fef4d084eb42a94a2b66/test_images/dog_1.jpg -------------------------------------------------------------------------------- /test_images/dog_2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raspberry-pi-maker/NVIDIA-Jetson/30a5596aa0d9a6a960f2fef4d084eb42a94a2b66/test_images/dog_2.jpg -------------------------------------------------------------------------------- /test_images/dog_3.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raspberry-pi-maker/NVIDIA-Jetson/30a5596aa0d9a6a960f2fef4d084eb42a94a2b66/test_images/dog_3.jpg -------------------------------------------------------------------------------- /test_images/dog_5.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raspberry-pi-maker/NVIDIA-Jetson/30a5596aa0d9a6a960f2fef4d084eb42a94a2b66/test_images/dog_5.jpg -------------------------------------------------------------------------------- /test_images/granny_smith_0.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raspberry-pi-maker/NVIDIA-Jetson/30a5596aa0d9a6a960f2fef4d084eb42a94a2b66/test_images/granny_smith_0.jpg -------------------------------------------------------------------------------- /test_images/horse_0.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raspberry-pi-maker/NVIDIA-Jetson/30a5596aa0d9a6a960f2fef4d084eb42a94a2b66/test_images/horse_0.jpg -------------------------------------------------------------------------------- /test_images/horse_1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raspberry-pi-maker/NVIDIA-Jetson/30a5596aa0d9a6a960f2fef4d084eb42a94a2b66/test_images/horse_1.jpg -------------------------------------------------------------------------------- /test_images/horse_2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raspberry-pi-maker/NVIDIA-Jetson/30a5596aa0d9a6a960f2fef4d084eb42a94a2b66/test_images/horse_2.jpg -------------------------------------------------------------------------------- /test_images/humans_0.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raspberry-pi-maker/NVIDIA-Jetson/30a5596aa0d9a6a960f2fef4d084eb42a94a2b66/test_images/humans_0.jpg -------------------------------------------------------------------------------- /test_images/humans_1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raspberry-pi-maker/NVIDIA-Jetson/30a5596aa0d9a6a960f2fef4d084eb42a94a2b66/test_images/humans_1.jpg -------------------------------------------------------------------------------- /test_images/humans_2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raspberry-pi-maker/NVIDIA-Jetson/30a5596aa0d9a6a960f2fef4d084eb42a94a2b66/test_images/humans_2.jpg -------------------------------------------------------------------------------- /test_images/humans_3.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raspberry-pi-maker/NVIDIA-Jetson/30a5596aa0d9a6a960f2fef4d084eb42a94a2b66/test_images/humans_3.jpg -------------------------------------------------------------------------------- /test_images/humans_4.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raspberry-pi-maker/NVIDIA-Jetson/30a5596aa0d9a6a960f2fef4d084eb42a94a2b66/test_images/humans_4.jpg -------------------------------------------------------------------------------- /test_images/humans_5.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raspberry-pi-maker/NVIDIA-Jetson/30a5596aa0d9a6a960f2fef4d084eb42a94a2b66/test_images/humans_5.jpg -------------------------------------------------------------------------------- /test_images/humans_6.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raspberry-pi-maker/NVIDIA-Jetson/30a5596aa0d9a6a960f2fef4d084eb42a94a2b66/test_images/humans_6.jpg -------------------------------------------------------------------------------- /test_images/humans_7.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raspberry-pi-maker/NVIDIA-Jetson/30a5596aa0d9a6a960f2fef4d084eb42a94a2b66/test_images/humans_7.jpg -------------------------------------------------------------------------------- /test_images/humans_8.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raspberry-pi-maker/NVIDIA-Jetson/30a5596aa0d9a6a960f2fef4d084eb42a94a2b66/test_images/humans_8.jpg -------------------------------------------------------------------------------- /test_images/humans_9.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raspberry-pi-maker/NVIDIA-Jetson/30a5596aa0d9a6a960f2fef4d084eb42a94a2b66/test_images/humans_9.jpg -------------------------------------------------------------------------------- /test_images/object_0.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raspberry-pi-maker/NVIDIA-Jetson/30a5596aa0d9a6a960f2fef4d084eb42a94a2b66/test_images/object_0.jpg -------------------------------------------------------------------------------- /test_images/object_2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raspberry-pi-maker/NVIDIA-Jetson/30a5596aa0d9a6a960f2fef4d084eb42a94a2b66/test_images/object_2.jpg -------------------------------------------------------------------------------- /test_images/object_3.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raspberry-pi-maker/NVIDIA-Jetson/30a5596aa0d9a6a960f2fef4d084eb42a94a2b66/test_images/object_3.jpg -------------------------------------------------------------------------------- /test_images/object_4.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raspberry-pi-maker/NVIDIA-Jetson/30a5596aa0d9a6a960f2fef4d084eb42a94a2b66/test_images/object_4.jpg -------------------------------------------------------------------------------- /test_images/object_5.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raspberry-pi-maker/NVIDIA-Jetson/30a5596aa0d9a6a960f2fef4d084eb42a94a2b66/test_images/object_5.jpg -------------------------------------------------------------------------------- /test_images/object_6.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raspberry-pi-maker/NVIDIA-Jetson/30a5596aa0d9a6a960f2fef4d084eb42a94a2b66/test_images/object_6.jpg -------------------------------------------------------------------------------- /test_images/object_7.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raspberry-pi-maker/NVIDIA-Jetson/30a5596aa0d9a6a960f2fef4d084eb42a94a2b66/test_images/object_7.jpg -------------------------------------------------------------------------------- /test_images/object_8.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raspberry-pi-maker/NVIDIA-Jetson/30a5596aa0d9a6a960f2fef4d084eb42a94a2b66/test_images/object_8.jpg -------------------------------------------------------------------------------- /test_images/peds_0.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raspberry-pi-maker/NVIDIA-Jetson/30a5596aa0d9a6a960f2fef4d084eb42a94a2b66/test_images/peds_0.jpg -------------------------------------------------------------------------------- /test_images/peds_1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raspberry-pi-maker/NVIDIA-Jetson/30a5596aa0d9a6a960f2fef4d084eb42a94a2b66/test_images/peds_1.jpg -------------------------------------------------------------------------------- /test_images/peds_2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raspberry-pi-maker/NVIDIA-Jetson/30a5596aa0d9a6a960f2fef4d084eb42a94a2b66/test_images/peds_2.jpg -------------------------------------------------------------------------------- /test_images/peds_3.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raspberry-pi-maker/NVIDIA-Jetson/30a5596aa0d9a6a960f2fef4d084eb42a94a2b66/test_images/peds_3.jpg -------------------------------------------------------------------------------- /test_images/polar_bear.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raspberry-pi-maker/NVIDIA-Jetson/30a5596aa0d9a6a960f2fef4d084eb42a94a2b66/test_images/polar_bear.jpg -------------------------------------------------------------------------------- /test_images/red_apple_0.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raspberry-pi-maker/NVIDIA-Jetson/30a5596aa0d9a6a960f2fef4d084eb42a94a2b66/test_images/red_apple_0.jpg -------------------------------------------------------------------------------- /test_images/room_0.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raspberry-pi-maker/NVIDIA-Jetson/30a5596aa0d9a6a960f2fef4d084eb42a94a2b66/test_images/room_0.jpg -------------------------------------------------------------------------------- /test_images/room_1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raspberry-pi-maker/NVIDIA-Jetson/30a5596aa0d9a6a960f2fef4d084eb42a94a2b66/test_images/room_1.jpg -------------------------------------------------------------------------------- /test_images/room_2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raspberry-pi-maker/NVIDIA-Jetson/30a5596aa0d9a6a960f2fef4d084eb42a94a2b66/test_images/room_2.jpg -------------------------------------------------------------------------------- /test_images/room_3.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raspberry-pi-maker/NVIDIA-Jetson/30a5596aa0d9a6a960f2fef4d084eb42a94a2b66/test_images/room_3.jpg -------------------------------------------------------------------------------- /test_images/room_5.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raspberry-pi-maker/NVIDIA-Jetson/30a5596aa0d9a6a960f2fef4d084eb42a94a2b66/test_images/room_5.jpg -------------------------------------------------------------------------------- /test_images/room_6.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raspberry-pi-maker/NVIDIA-Jetson/30a5596aa0d9a6a960f2fef4d084eb42a94a2b66/test_images/room_6.jpg -------------------------------------------------------------------------------- /test_images/stingray.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raspberry-pi-maker/NVIDIA-Jetson/30a5596aa0d9a6a960f2fef4d084eb42a94a2b66/test_images/stingray.jpg -------------------------------------------------------------------------------- /tf-pose-estimation/README.md: -------------------------------------------------------------------------------- 1 | # Repo for NVIDIA Jetson series blog 2 | See the following url for detailed description
3 | https://spyjetson.blogspot.com/2019/09/jetsonnano-human-pose-estimation-using.html

4 | Copy these codes to your tf-pose-estimation installation directory. Perhaps you can see the original codes (run.py, run_checkpoint.py, ...) in that directory. -------------------------------------------------------------------------------- /tf-pose-estimation/images/hong.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raspberry-pi-maker/NVIDIA-Jetson/30a5596aa0d9a6a960f2fef4d084eb42a94a2b66/tf-pose-estimation/images/hong.jpg -------------------------------------------------------------------------------- /tf-pose-estimation/tf_model_2_rt.py: -------------------------------------------------------------------------------- 1 | import argparse 2 | import sys, os 3 | import time 4 | import tensorflow as tf 5 | import tensorflow.contrib.tensorrt as trt 6 | 7 | 8 | def get_frozen_graph(graph_file): 9 | """Read Frozen Graph file from disk.""" 10 | with tf.gfile.FastGFile(graph_file, "rb") as f: 11 | graph_def = tf.GraphDef() 12 | graph_def.ParseFromString(f.read()) 13 | return graph_def 14 | 15 | 16 | parser = argparse.ArgumentParser(description='tf network model conversion to tensorrt') 17 | parser.add_argument('--model', type=str, default='mobilenet_v2_small', 18 | help='cmu / mobilenet_thin / mobilenet_v2_large / mobilenet_v2_small') 19 | args = parser.parse_args() 20 | 21 | model_dir = 'models/graph/' 22 | frozen_name = model_dir + args.model + '/graph_opt.pb' 23 | frozen_graph = get_frozen_graph(frozen_name) 24 | print('=======Frozen Name:%s======='%(frozen_name)); 25 | # convert (optimize) frozen model to TensorRT model 26 | your_outputs = ["Openpose/concat_stage7"] 27 | 28 | start = time.time() 29 | trt_graph = trt.create_inference_graph( 30 | input_graph_def=frozen_graph,# frozen model 31 | outputs=your_outputs, 32 | is_dynamic_op=True, 33 | minimum_segment_size=3, 34 | maximum_cached_engines=int(1e3), 35 | max_batch_size=1,# specify your max batch size 36 | max_workspace_size_bytes=2*(10**9),# specify the max workspace 37 | precision_mode="FP16") # precision, can be "FP32" (32 floating point precision) or "FP16" 38 | 39 | elapsed = time.time() - start 40 | print('Tensorflow model => TensorRT model takes : %f'%(elapsed)); 41 | 42 | #write the TensorRT model to be used later for inference 43 | rt_name = model_dir + args.model + '/graph_opt_rt.pb' 44 | with tf.gfile.FastGFile(rt_name , 'wb') as f: 45 | f.write(trt_graph.SerializeToString()) 46 | 47 | -------------------------------------------------------------------------------- /tf-pose-estimation/tf_pose/README.md: -------------------------------------------------------------------------------- 1 | estimator.py : modified for TensorRT ready made model support 2 | -------------------------------------------------------------------------------- /torchvision_walkthrough/imgs/COCO_294.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raspberry-pi-maker/NVIDIA-Jetson/30a5596aa0d9a6a960f2fef4d084eb42a94a2b66/torchvision_walkthrough/imgs/COCO_294.jpg -------------------------------------------------------------------------------- /torchvision_walkthrough/imgs/apink1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raspberry-pi-maker/NVIDIA-Jetson/30a5596aa0d9a6a960f2fef4d084eb42a94a2b66/torchvision_walkthrough/imgs/apink1.jpg -------------------------------------------------------------------------------- /torchvision_walkthrough/keypoints.py: -------------------------------------------------------------------------------- 1 | import torch 2 | import torchvision 3 | from torchvision import models 4 | import torchvision.transforms as T 5 | 6 | import numpy as np 7 | from PIL import Image 8 | import matplotlib.pyplot as plt 9 | from matplotlib.path import Path 10 | import matplotlib.patches as patches 11 | 12 | IMG_SIZE = 480 13 | THRESHOLD = 0.95 14 | 15 | if True == torch.cuda.is_available(): 16 | print('pytorch:%s GPU support'% torch.__version__) 17 | else: 18 | print('pytorch:%s GPU Not support'% torch.__version__) 19 | 20 | print('torchvision', torchvision.__version__) 21 | 22 | model = models.detection.keypointrcnn_resnet50_fpn(pretrained=True).eval() 23 | #img = Image.open('imgs/07.jpg') 24 | img = Image.open('imgs/apink1.jpg') 25 | img = img.resize((IMG_SIZE, int(img.height * IMG_SIZE / img.width))) 26 | 27 | plt.figure(figsize=(16, 16)) 28 | plt.imshow(img) 29 | 30 | 31 | trf = T.Compose([ 32 | T.ToTensor() 33 | ]) 34 | 35 | input_img = trf(img) 36 | 37 | print(input_img.shape) 38 | out = model([input_img])[0] 39 | 40 | print(out.keys()) 41 | 42 | 43 | codes = [ 44 | Path.MOVETO, 45 | Path.LINETO, 46 | Path.LINETO 47 | ] 48 | 49 | fig, ax = plt.subplots(1, figsize=(16, 16)) 50 | ax.imshow(img) 51 | 52 | for box, score, keypoints in zip(out['boxes'], out['scores'], out['keypoints']): 53 | score = score.detach().numpy() 54 | 55 | if score < THRESHOLD: 56 | continue 57 | 58 | box = box.detach().numpy() 59 | keypoints = keypoints.detach().numpy()[:, :2] 60 | 61 | rect = patches.Rectangle((box[0], box[1]), box[2]-box[0], box[3]-box[1], linewidth=2, edgecolor='b', facecolor='none') 62 | ax.add_patch(rect) 63 | 64 | # 17 keypoints 65 | for k in keypoints: 66 | circle = patches.Circle((k[0], k[1]), radius=2, facecolor='r') 67 | ax.add_patch(circle) 68 | 69 | # draw path 70 | # left arm 71 | path = Path(keypoints[5:10:2], codes) 72 | line = patches.PathPatch(path, linewidth=2, facecolor='none', edgecolor='r') 73 | ax.add_patch(line) 74 | 75 | # right arm 76 | path = Path(keypoints[6:11:2], codes) 77 | line = patches.PathPatch(path, linewidth=2, facecolor='none', edgecolor='r') 78 | ax.add_patch(line) 79 | 80 | # left leg 81 | path = Path(keypoints[11:16:2], codes) 82 | line = patches.PathPatch(path, linewidth=2, facecolor='none', edgecolor='r') 83 | ax.add_patch(line) 84 | 85 | # right leg 86 | path = Path(keypoints[12:17:2], codes) 87 | line = patches.PathPatch(path, linewidth=2, facecolor='none', edgecolor='r') 88 | ax.add_patch(line) 89 | 90 | plt.savefig('result.jpg') 91 | 92 | -------------------------------------------------------------------------------- /useful_scripts/install_opencv4.1.1_Nano.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # Copyright (c) 2018, NVIDIA CORPORATION. All rights reserved. 4 | # 5 | # NVIDIA Corporation and its licensors retain all intellectual property 6 | # and proprietary rights in and to this software, related documentation 7 | # and any modifications thereto. Any use, reproduction, disclosure or 8 | # distribution of this software and related documentation without an express 9 | # license agreement from NVIDIA Corporation is strictly prohibited. 10 | # spyjetson(https://spyjetson.blogspot.com/) modified 11 | 12 | if [ "$#" -ne 1 ]; then 13 | echo "Usage: $0 " 14 | exit 15 | fi 16 | folder="$1" 17 | user="nvidia" 18 | passwd="nvidia" 19 | 20 | echo "** Remove OpenCV3.3 first" 21 | sudo apt-get purge *libopencv* 22 | 23 | echo "** Install requirement" 24 | sudo apt-get update 25 | sudo apt-get install -y build-essential cmake git libgtk2.0-dev pkg-config libavcodec-dev libavformat-dev libswscale-dev 26 | sudo apt-get install -y libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev 27 | sudo apt-get install -y python2.7-dev python3.6-dev python-dev python-numpy python3-numpy 28 | sudo apt-get install -y libtbb2 libtbb-dev libjpeg-dev libpng-dev libtiff-dev libjasper-dev libdc1394-22-dev 29 | sudo apt-get install -y libv4l-dev v4l-utils qv4l2 v4l2ucp 30 | sudo apt-get install -y curl 31 | sudo apt-get update 32 | 33 | echo "** Download opencv-4.1.1" 34 | cd $folder 35 | curl -L https://github.com/opencv/opencv/archive/4.1.1.zip -o opencv-4.1.1.zip 36 | curl -L https://github.com/opencv/opencv_contrib/archive/4.1.1.zip -o opencv_contrib-4.1.1.zip 37 | unzip opencv-4.1.1.zip 38 | unzip opencv_contrib-4.1.1.zip 39 | cd opencv-4.1.1/ 40 | 41 | echo "** Building..." 42 | mkdir release 43 | cd release/ 44 | cmake -D WITH_CUDA=ON -D ENABLE_PRECOMPILED_HEADERS=OFF -D CUDA_ARCH_BIN="5.3" -D CUDA_ARCH_PTX="" -D OPENCV_EXTRA_MODULES_PATH=../../opencv_contrib-4.1.1/modules -D WITH_GSTREAMER=ON -D WITH_LIBV4L=ON -D BUILD_opencv_python2=ON -D BUILD_opencv_python3=ON -D BUILD_TESTS=OFF -D BUILD_PERF_TESTS=OFF -D BUILD_EXAMPLES=OFF -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local .. 45 | make -j3 46 | sudo make install 47 | 48 | echo "** Install opencv-4.1.1 successfully" 49 | echo "** Bye :)" 50 | -------------------------------------------------------------------------------- /useful_scripts/install_opencv4.1.1_TX2.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # Copyright (c) 2018, NVIDIA CORPORATION. All rights reserved. 4 | # 5 | # NVIDIA Corporation and its licensors retain all intellectual property 6 | # and proprietary rights in and to this software, related documentation 7 | # and any modifications thereto. Any use, reproduction, disclosure or 8 | # distribution of this software and related documentation without an express 9 | # license agreement from NVIDIA Corporation is strictly prohibited. 10 | # spyjetson(https://spyjetson.blogspot.com/) modified 11 | 12 | if [ "$#" -ne 1 ]; then 13 | echo "Usage: $0 " 14 | exit 15 | fi 16 | folder="$1" 17 | user="nvidia" 18 | passwd="nvidia" 19 | 20 | echo "** Remove OpenCV3.3 first" 21 | sudo apt-get purge *libopencv* 22 | 23 | echo "** Install requirement" 24 | sudo apt-get update 25 | sudo apt-get install -y build-essential cmake git libgtk2.0-dev pkg-config libavcodec-dev libavformat-dev libswscale-dev 26 | sudo apt-get install -y libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev 27 | sudo apt-get install -y python2.7-dev python3.6-dev python-dev python-numpy python3-numpy 28 | sudo apt-get install -y libtbb2 libtbb-dev libjpeg-dev libpng-dev libtiff-dev libjasper-dev libdc1394-22-dev 29 | sudo apt-get install -y libv4l-dev v4l-utils qv4l2 v4l2ucp 30 | sudo apt-get install -y curl qt5-default 31 | sudo apt-get update 32 | 33 | echo "** Download opencv-4.1.1" 34 | cd $folder 35 | curl -L https://github.com/opencv/opencv/archive/4.1.1.zip -o opencv-4.1.1.zip 36 | curl -L https://github.com/opencv/opencv_contrib/archive/4.1.1.zip -o opencv_contrib-4.1.1.zip 37 | unzip opencv-4.1.1.zip 38 | unzip opencv_contrib-4.1.1.zip 39 | cd opencv-4.1.1/ 40 | 41 | echo "** Building..." 42 | mkdir release 43 | cd release/ 44 | #cmake -D WITH_CUDA=ON -D ENABLE_PRECOMPILED_HEADERS=OFF -D CUDA_ARCH_BIN="5.3" -D CUDA_ARCH_PTX="" -D OPENCV_EXTRA_MODULES_PATH=../../opencv_contrib-4.1.1/modules -D WITH_GSTREAMER=ON -D WITH_LIBV4L=ON -D BUILD_opencv_python2=ON -D BUILD_opencv_python3=ON -D BUILD_TESTS=OFF -D BUILD_PERF_TESTS=OFF -D BUILD_EXAMPLES=OFF -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local .. 45 | cmake -D WITH_CUDA=ON -D ENABLE_PRECOMPILED_HEADERS=OFF -D CUDA_ARCH_BIN="6.2" -D CUDA_ARCH_PTX="" -D ENABLE_FAST_MATH=ON -D CUDA_FAST_MATH=ON -D WITH_CUBLAS=ON -D OPENCV_EXTRA_MODULES_PATH=../../opencv_contrib-4.1.1/modules -D WITH_GSTREAMER=ON -D WITH_LIBV4L=ON -D BUILD_opencv_python2=ON -D BUILD_opencv_python3=ON -D BUILD_TESTS=OFF -D BUILD_PERF_TESTS=OFF -D BUILD_EXAMPLES=OFF -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local -D WITH_GTK=OFF -D WITH_QT=ON .. 46 | 47 | make -j3 48 | sudo make install 49 | 50 | echo "** Install opencv-4.1.1 successfully" 51 | echo "** Bye :)" 52 | -------------------------------------------------------------------------------- /useful_scripts/install_opencv4.7_NX.sh: -------------------------------------------------------------------------------- 1 | # part of the script to be modified 2 | # 1. opencv version to install. The current version is 4.7.0 3 | # 2. python version of anaconda virtual environment. The current version is 3.8 4 | # 3. CUDA_ARCH_BIN. The Current value is "7.2" for Xavier NX 5 | 6 | 7 | echo "OpenCV 4.7 Installation script for Jetson Xavier NX (Jetpack 5.1)" 8 | 9 | if [ "$#" -ne 1 ]; then 10 | echo "Usage: $0 " 11 | exit 12 | fi 13 | folder="$1" 14 | 15 | #You don't have to remove pre-installed OpenCV 4.5 16 | #echo "** Remove Old OpenCV first" 17 | #sudo apt-get purge *libopencv* 18 | 19 | echo "** Install requirement" 20 | sudo apt-get update 21 | sudo apt-get install -y build-essential cmake git libgtk2.0-dev pkg-config libavcodec-dev libavformat-dev libswscale-dev 22 | sudo apt-get install -y libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev 23 | sudo apt-get install -y libtbb2 libtbb-dev libjpeg-dev libpng-dev libtiff-dev libjasper-dev libdc1394-22-dev 24 | sudo apt-get install -y libopenblas-dev libatlas-base-dev libblas-dev 25 | sudo apt-get install -y libeigen3-dev libhdf5-dev libgflags-dev 26 | sudo apt-get install -y libv4l-dev v4l-utils qv4l2 v4l2ucp 27 | sudo apt-get update 28 | conda install -y numpy 29 | 30 | echo "** Download opencv-4.7.0" 31 | cd $folder 32 | wget https://github.com/opencv/opencv/archive/4.7.0.zip 33 | wget -O opencv_contrib.zip https://github.com/opencv/opencv_contrib/archive/4.7.0.zip 34 | 35 | unzip 4.7.0.zip 36 | unzip opencv_contrib.zip 37 | cd opencv-4.7.0/ 38 | 39 | echo "** Building..." 40 | mkdir release 41 | cd release 42 | cmake \ 43 | -D ENABLE_PRECOMPILED_HEADERS=0 \ 44 | -D CUDA_ARCH_BIN="7.2" \ 45 | -D CUDA_ARCH_PTX="" \ 46 | -D OPENCV_EXTRA_MODULES_PATH=../../opencv_contrib-4.7.0/modules \ 47 | -D WITH_OPENCL=0 \ 48 | -D WITH_CUDA=1 \ 49 | -D OPENCV_DNN_CUDA=1 \ 50 | -D EIGEN_INCLUDE_PATH=/usr/include/eigen3 \ 51 | -D WITH_EIGEN=1 \ 52 | -D WITH_CUBLAS=1 \ 53 | -D WITH_FFMPEG=1 \ 54 | -D WITH_GSTREAMER=1 \ 55 | -D WITH_V4L=1 \ 56 | -D WITH_LIBV4L=1 \ 57 | -D BUILD_opencv_python2=0 \ 58 | -D BUILD_opencv_python3=1 \ 59 | -D BUILD_TESTS=0 \ 60 | -D BUILD_PERF_TESTS=0 \ 61 | -D BUILD_EXAMPLES=0 \ 62 | -D OPENCV_GENERATE_PKGCONFIG=1 \ 63 | -D CMAKE_BUILD_TYPE=RELEASE \ 64 | -D CMAKE_INSTALL_PREFIX=$CONDA_PREFIX \ 65 | -D PYTHON3_LIBRARY=$CONDA_PREFIX/lib/python3.8 \ 66 | -D PYTHON3_INCLUDE_DIR=$CONDA_PREFIX/include/python3.8 \ 67 | -D PYTHON3_EXECUTABLE=$CONDA_PREFIX/bin/python \ 68 | -D PYTHON3_PACKAGES_PATH=$CONDA_PREFIX/lib/python3.8/site-packages \ 69 | .. 70 | 71 | make -j6 72 | sudo make install 73 | 74 | echo "** Install opencv-4.7.0 successfully" 75 | echo "** Bye :)" -------------------------------------------------------------------------------- /useful_scripts/install_protobuf.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -e 4 | 5 | folder=${HOME}/src 6 | mkdir -p $folder 7 | 8 | echo "** Download protobuf-3.15.8 sources" 9 | cd $folder 10 | if [ ! -f protobuf-python-3.15.8.zip ]; then 11 | wget https://github.com/protocolbuffers/protobuf/releases/download/v3.15.8/protobuf-python-3.15.8.zip 12 | fi 13 | if [ ! -f protoc-3.15.8-linux-aarch_64.zip ]; then 14 | wget https://github.com/protocolbuffers/protobuf/releases/download/v3.15.8/protoc-3.15.8-linux-aarch_64.zip 15 | fi 16 | 17 | echo "** Install protoc" 18 | unzip protobuf-python-3.15.8.zip 19 | unzip protoc-3.15.8-linux-aarch_64.zip -d protoc-3.15.8 20 | sudo cp protoc-3.15.8/bin/protoc /usr/local/bin/protoc 21 | 22 | echo "** Build and install protobuf-3.15.8 libraries" 23 | export PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=cpp 24 | cd protobuf-3.15.8/ 25 | ./autogen.sh 26 | ./configure --prefix=/usr/local 27 | make 28 | make check 29 | sudo make install 30 | sudo ldconfig 31 | 32 | echo "** Update python3 protobuf module" 33 | # remove previous installation of python3 protobuf module 34 | sudo pip3 uninstall -y protobuf 35 | sudo pip3 install Cython 36 | cd python/ 37 | # force compilation with c++11 standard 38 | sed -i '205s/if v:/if True:/' setup.py 39 | python3 setup.py build --cpp_implementation 40 | python3 setup.py test --cpp_implementation 41 | sudo python3 setup.py install --cpp_implementation 42 | 43 | echo "** Build protobuf-3.15.8 successfully" -------------------------------------------------------------------------------- /useful_scripts/opencv4.4_jetson_nano.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # Copyright (c) 2018, NVIDIA CORPORATION. All rights reserved. 4 | # 5 | # NVIDIA Corporation and its licensors retain all intellectual property 6 | # and proprietary rights in and to this software, related documentation 7 | # and any modifications thereto. Any use, reproduction, disclosure or 8 | # distribution of this software and related documentation without an express 9 | # license agreement from NVIDIA Corporation is strictly prohibited. 10 | # spyjetson(https://spyjetson.blogspot.com/) modified 11 | 12 | if [ "$#" -ne 1 ]; then 13 | echo "Usage: $0 " 14 | exit 15 | fi 16 | folder="$1" 17 | user="nvidia" 18 | passwd="nvidia" 19 | 20 | echo "** Remove OpenCV4.1 first" 21 | sudo apt-get purge *libopencv* 22 | 23 | echo "** Install requirement" 24 | sudo apt-get update 25 | sudo apt-get install -y build-essential cmake git libgtk2.0-dev pkg-config libavcodec-dev libavformat-dev libswscale-dev 26 | sudo apt-get install -y libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev 27 | sudo apt-get install -y python2.7-dev python3.6-dev python-dev python-numpy python3-numpy 28 | sudo apt-get install -y libtbb2 libtbb-dev libjpeg-dev libpng-dev libtiff-dev libjasper-dev libdc1394-22-dev 29 | sudo apt-get install -y libv4l-dev v4l-utils qv4l2 v4l2ucp 30 | sudo apt-get install -y curl 31 | sudo apt-get update 32 | 33 | echo "** Download opencv-4.4.0" 34 | cd $folder 35 | curl -L https://github.com/opencv/opencv/archive/4.4.0.zip -o opencv-4.4.0.zip 36 | curl -L https://github.com/opencv/opencv_contrib/archive/4.4.0.zip -o opencv_contrib-4.4.0.zip 37 | unzip opencv-4.4.0.zip 38 | unzip opencv_contrib-4.4.0.zip 39 | cd opencv-4.4.0/ 40 | 41 | echo "** Building..." 42 | mkdir release 43 | cd release/ 44 | cmake -D WITH_CUDA=ON -D ENABLE_PRECOMPILED_HEADERS=OFF -D CUDA_ARCH_BIN="5.3" -D CUDA_ARCH_PTX="" -D OPENCV_EXTRA_MODULES_PATH=../../opencv_contrib-4.4.0/modules -D WITH_GSTREAMER=ON -D WITH_LIBV4L=ON -D BUILD_opencv_python2=ON -D BUILD_opencv_python3=ON -D BUILD_TESTS=OFF -D BUILD_PERF_TESTS=OFF -D BUILD_EXAMPLES=OFF -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local .. 45 | make -j4 46 | sudo make install 47 | 48 | echo "** Install opencv-4.4.0 successfully" 49 | echo "** Bye :)" -------------------------------------------------------------------------------- /useful_scripts/opencv4.4_jetson_tx2.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # Copyright (c) 2018, NVIDIA CORPORATION. All rights reserved. 4 | # 5 | # NVIDIA Corporation and its licensors retain all intellectual property 6 | # and proprietary rights in and to this software, related documentation 7 | # and any modifications thereto. Any use, reproduction, disclosure or 8 | # distribution of this software and related documentation without an express 9 | # license agreement from NVIDIA Corporation is strictly prohibited. 10 | # spyjetson(https://spyjetson.blogspot.com/) modified 11 | 12 | if [ "$#" -ne 1 ]; then 13 | echo "Usage: $0 " 14 | exit 15 | fi 16 | folder="$1" 17 | user="nvidia" 18 | passwd="nvidia" 19 | 20 | echo "** Remove OpenCV4.1 first" 21 | sudo apt-get purge *libopencv* 22 | 23 | echo "** Install requirement" 24 | sudo apt-get update 25 | sudo apt-get install -y build-essential cmake git libgtk2.0-dev pkg-config libavcodec-dev libavformat-dev libswscale-dev 26 | sudo apt-get install -y libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev 27 | sudo apt-get install -y python2.7-dev python3.6-dev python-dev python-numpy python3-numpy 28 | sudo apt-get install -y libtbb2 libtbb-dev libjpeg-dev libpng-dev libtiff-dev libjasper-dev libdc1394-22-dev 29 | sudo apt-get install -y libv4l-dev v4l-utils qv4l2 v4l2ucp 30 | sudo apt-get install -y curl 31 | sudo apt-get update 32 | 33 | echo "** Download opencv-4.4.0" 34 | cd $folder 35 | curl -L https://github.com/opencv/opencv/archive/4.4.0.zip -o opencv-4.4.0.zip 36 | curl -L https://github.com/opencv/opencv_contrib/archive/4.4.0.zip -o opencv_contrib-4.4.0.zip 37 | unzip opencv-4.4.0.zip 38 | unzip opencv_contrib-4.4.0.zip 39 | cd opencv-4.4.0/ 40 | 41 | echo "** Building..." 42 | mkdir release 43 | cd release/ 44 | cmake -D WITH_CUDA=ON -D ENABLE_PRECOMPILED_HEADERS=OFF -D CUDA_ARCH_BIN="6.2" -D CUDA_ARCH_PTX="" -D OPENCV_EXTRA_MODULES_PATH=../../opencv_contrib-4.4.0/modules -D WITH_GSTREAMER=ON -D WITH_LIBV4L=ON -D BUILD_opencv_python2=ON -D BUILD_opencv_python3=ON -D BUILD_TESTS=OFF -D BUILD_PERF_TESTS=OFF -D BUILD_EXAMPLES=OFF -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local .. 45 | make -j4 46 | sudo make install 47 | 48 | echo "** Install opencv-4.4.0 successfully" 49 | echo "** Bye :)" -------------------------------------------------------------------------------- /useful_scripts/opencv4.4_xavier_nx.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # Copyright (c) 2018, NVIDIA CORPORATION. All rights reserved. 4 | # 5 | # NVIDIA Corporation and its licensors retain all intellectual property 6 | # and proprietary rights in and to this software, related documentation 7 | # and any modifications thereto. Any use, reproduction, disclosure or 8 | # distribution of this software and related documentation without an express 9 | # license agreement from NVIDIA Corporation is strictly prohibited. 10 | # spyjetson(https://spyjetson.blogspot.com/) modified 11 | 12 | if [ "$#" -ne 1 ]; then 13 | echo "Usage: $0 " 14 | exit 15 | fi 16 | folder="$1" 17 | user="nvidia" 18 | passwd="nvidia" 19 | 20 | echo "** Remove OpenCV4.1 first" 21 | sudo apt-get purge *libopencv* 22 | 23 | echo "** Install requirement" 24 | sudo apt-get update 25 | sudo apt-get install -y build-essential cmake git libgtk2.0-dev pkg-config libavcodec-dev libavformat-dev libswscale-dev 26 | sudo apt-get install -y libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev 27 | sudo apt-get install -y python2.7-dev python3.6-dev python-dev python-numpy python3-numpy 28 | sudo apt-get install -y libtbb2 libtbb-dev libjpeg-dev libpng-dev libtiff-dev libjasper-dev libdc1394-22-dev 29 | sudo apt-get install -y libv4l-dev v4l-utils qv4l2 v4l2ucp 30 | sudo apt-get install -y curl 31 | sudo apt-get update 32 | 33 | echo "** Download opencv-4.4.0" 34 | cd $folder 35 | curl -L https://github.com/opencv/opencv/archive/4.4.0.zip -o opencv-4.4.0.zip 36 | curl -L https://github.com/opencv/opencv_contrib/archive/4.4.0.zip -o opencv_contrib-4.4.0.zip 37 | unzip opencv-4.4.0.zip 38 | unzip opencv_contrib-4.4.0.zip 39 | cd opencv-4.4.0/ 40 | 41 | echo "** Building..." 42 | mkdir release 43 | cd release/ 44 | cmake -D WITH_CUDA=ON -D ENABLE_PRECOMPILED_HEADERS=OFF -D CUDA_ARCH_BIN="7.2" -D CUDA_ARCH_PTX="" -D OPENCV_EXTRA_MODULES_PATH=../../opencv_contrib-4.4.0/modules -D WITH_GSTREAMER=ON -D WITH_LIBV4L=ON -D BUILD_opencv_python2=ON -D BUILD_opencv_python3=ON -D BUILD_TESTS=OFF -D BUILD_PERF_TESTS=OFF -D BUILD_EXAMPLES=OFF -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local .. 45 | make -j6 46 | sudo make install 47 | 48 | echo "** Install opencv-4.4.0 successfully" 49 | echo "** Bye :)" -------------------------------------------------------------------------------- /useful_scripts/opencv4.5_jetson_nano.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # Copyright (c) 2018, NVIDIA CORPORATION. All rights reserved. 4 | # 5 | # NVIDIA Corporation and its licensors retain all intellectual property 6 | # and proprietary rights in and to this software, related documentation 7 | # and any modifications thereto. Any use, reproduction, disclosure or 8 | # distribution of this software and related documentation without an express 9 | # license agreement from NVIDIA Corporation is strictly prohibited. 10 | # spyjetson(https://spyjetson.blogspot.com/) modified 11 | 12 | if [ "$#" -ne 1 ]; then 13 | echo "Usage: $0 " 14 | exit 15 | fi 16 | folder="$1" 17 | user="nvidia" 18 | passwd="nvidia" 19 | 20 | echo "** Remove OpenCV4.1 first" 21 | sudo apt-get purge *libopencv* 22 | 23 | echo "** Install requirement" 24 | sudo apt-get update 25 | sudo apt-get install -y build-essential cmake git libgtk2.0-dev pkg-config libavcodec-dev libavformat-dev libswscale-dev 26 | sudo apt-get install -y libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev 27 | sudo apt-get install -y python2.7-dev python3-dev python-dev python-numpy python3-numpy 28 | sudo apt-get install -y libtbb2 libtbb-dev libjpeg-dev libpng-dev libtiff-dev libjasper-dev libdc1394-22-dev 29 | sudo apt-get install -y libv4l-dev v4l-utils qv4l2 v4l2ucp 30 | sudo apt-get install -y curl 31 | sudo apt-get update 32 | 33 | echo "** Download opencv-4.5.1" 34 | cd $folder 35 | curl -L https://github.com/opencv/opencv/archive/4.5.1.zip -o opencv-4.5.1.zip 36 | curl -L https://github.com/opencv/opencv_contrib/archive/4.5.1.zip -o opencv_contrib-4.5.1.zip 37 | unzip opencv-4.5.1.zip 38 | unzip opencv_contrib-4.5.1.zip 39 | cd opencv-4.5.1/ 40 | 41 | echo "** Building..." 42 | mkdir release 43 | cd release/ 44 | cmake -D WITH_CUDA=ON -D ENABLE_PRECOMPILED_HEADERS=OFF -D CUDA_ARCH_BIN="5.3" -D CUDA_ARCH_PTX="" -D OPENCV_EXTRA_MODULES_PATH=../../opencv_contrib-4.5.1/modules -D WITH_GSTREAMER=ON -D WITH_LIBV4L=ON -D BUILD_opencv_python2=ON -D BUILD_opencv_python3=ON -D BUILD_TESTS=OFF -D BUILD_PERF_TESTS=OFF -D BUILD_EXAMPLES=OFF -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local .. 45 | make -j4 46 | sudo make install 47 | 48 | echo "** Install opencv-4.5.1 successfully" 49 | echo "** Bye :)" -------------------------------------------------------------------------------- /useful_scripts/opencv4.5_jetson_tx2.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # Copyright (c) 2018, NVIDIA CORPORATION. All rights reserved. 4 | # 5 | # NVIDIA Corporation and its licensors retain all intellectual property 6 | # and proprietary rights in and to this software, related documentation 7 | # and any modifications thereto. Any use, reproduction, disclosure or 8 | # distribution of this software and related documentation without an express 9 | # license agreement from NVIDIA Corporation is strictly prohibited. 10 | # spyjetson(https://spyjetson.blogspot.com/) modified 11 | 12 | if [ "$#" -ne 1 ]; then 13 | echo "Usage: $0 " 14 | exit 15 | fi 16 | folder="$1" 17 | user="nvidia" 18 | passwd="nvidia" 19 | 20 | echo "** Remove OpenCV4.1 first" 21 | sudo apt-get purge *libopencv* 22 | 23 | echo "** Install requirement" 24 | sudo apt-get update 25 | sudo apt-get install -y build-essential cmake git libgtk2.0-dev pkg-config libavcodec-dev libavformat-dev libswscale-dev 26 | sudo apt-get install -y libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev 27 | sudo apt-get install -y python2.7-dev python3.6-dev python-dev python-numpy python3-numpy 28 | sudo apt-get install -y libtbb2 libtbb-dev libjpeg-dev libpng-dev libtiff-dev libjasper-dev libdc1394-22-dev 29 | sudo apt-get install -y libv4l-dev v4l-utils qv4l2 v4l2ucp 30 | sudo apt-get install -y curl 31 | sudo apt-get update 32 | 33 | echo "** Download opencv-4.5.1" 34 | cd $folder 35 | curl -L https://github.com/opencv/opencv/archive/4.5.1.zip -o opencv-4.5.1.zip 36 | curl -L https://github.com/opencv/opencv_contrib/archive/4.5.1.zip -o opencv_contrib-4.5.1.zip 37 | unzip opencv-4.5.1.zip 38 | unzip opencv_contrib-4.5.1.zip 39 | cd opencv-4.5.1/ 40 | 41 | echo "** Building..." 42 | mkdir release 43 | cd release/ 44 | cmake -D WITH_CUDA=ON -D ENABLE_PRECOMPILED_HEADERS=OFF -D CUDA_ARCH_BIN="6.2" -D CUDA_ARCH_PTX="" -D OPENCV_EXTRA_MODULES_PATH=../../opencv_contrib-4.5.1/modules -D WITH_GSTREAMER=ON -D WITH_LIBV4L=ON -D BUILD_opencv_python2=ON -D BUILD_opencv_python3=ON -D BUILD_TESTS=OFF -D BUILD_PERF_TESTS=OFF -D BUILD_EXAMPLES=OFF -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local .. 45 | make -j4 46 | sudo make install 47 | 48 | echo "** Install opencv-4.5.1 successfully" 49 | echo "** Bye :)" -------------------------------------------------------------------------------- /useful_scripts/opencv4.5_xavier_nx.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # Copyright (c) 2018, NVIDIA CORPORATION. All rights reserved. 4 | # 5 | # NVIDIA Corporation and its licensors retain all intellectual property 6 | # and proprietary rights in and to this software, related documentation 7 | # and any modifications thereto. Any use, reproduction, disclosure or 8 | # distribution of this software and related documentation without an express 9 | # license agreement from NVIDIA Corporation is strictly prohibited. 10 | # spyjetson(https://spyjetson.blogspot.com/) modified 11 | 12 | if [ "$#" -ne 1 ]; then 13 | echo "Usage: $0 " 14 | exit 15 | fi 16 | folder="$1" 17 | user="nvidia" 18 | passwd="nvidia" 19 | 20 | echo "** Remove OpenCV4.1 first" 21 | sudo apt-get purge *libopencv* 22 | 23 | echo "** Install requirement" 24 | sudo apt-get update 25 | sudo apt-get install -y build-essential cmake git libgtk2.0-dev pkg-config libavcodec-dev libavformat-dev libswscale-dev 26 | sudo apt-get install -y libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev 27 | sudo apt-get install -y python2.7-dev python3.6-dev python-dev python-numpy python3-numpy 28 | sudo apt-get install -y libtbb2 libtbb-dev libjpeg-dev libpng-dev libtiff-dev libjasper-dev libdc1394-22-dev 29 | sudo apt-get install -y libv4l-dev v4l-utils qv4l2 v4l2ucp 30 | sudo apt-get install -y curl 31 | sudo apt-get update 32 | 33 | echo "** Download opencv-4.5.1" 34 | cd $folder 35 | curl -L https://github.com/opencv/opencv/archive/4.5.1.zip -o opencv-4.5.1.zip 36 | curl -L https://github.com/opencv/opencv_contrib/archive/4.5.1.zip -o opencv_contrib-4.5.1.zip 37 | unzip opencv-4.5.1.zip 38 | unzip opencv_contrib-4.5.1.zip 39 | cd opencv-4.5.1/ 40 | 41 | echo "** Building..." 42 | mkdir release 43 | cd release/ 44 | cmake -D WITH_CUDA=ON -D ENABLE_PRECOMPILED_HEADERS=OFF -D CUDA_ARCH_BIN="7.2" -D CUDA_ARCH_PTX="" -D OPENCV_EXTRA_MODULES_PATH=../../opencv_contrib-4.5.1/modules -D WITH_GSTREAMER=ON -D WITH_LIBV4L=ON -D BUILD_opencv_python2=ON -D BUILD_opencv_python3=ON -D BUILD_TESTS=OFF -D BUILD_PERF_TESTS=OFF -D BUILD_EXAMPLES=OFF -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local .. 45 | make -j6 46 | sudo make install 47 | 48 | echo "** Install opencv-4.5.1 successfully" 49 | echo "** Bye :)" -------------------------------------------------------------------------------- /webcam/webcam_capability.py: -------------------------------------------------------------------------------- 1 | import cv2 2 | import sys 3 | 4 | resolutions = [(1920, 1080), (1280,720), (1184,656),(1188,658),(1024,768), (640, 480), (800,600), (320,240), (320,176), (176,144), (160,120)] 5 | 6 | 7 | print('Webcam resolution test start\n') 8 | 9 | for resolution in resolutions: 10 | cap = cv2.VideoCapture(0, cv2.CAP_VFW) 11 | if (cap.isOpened() == False): 12 | print("Unable to read camera feed") 13 | break 14 | ret1 = cap.set(cv2.CAP_PROP_FRAME_WIDTH, resolution[0]) 15 | ret2 = cap.set(cv2.CAP_PROP_FRAME_HEIGHT, resolution[1]) 16 | if(ret1 == True and ret2 == True): 17 | print('resolution [%d, %d] support success'%(resolution[0], resolution[1])) 18 | ret, img = cap.read() 19 | h, w, c = img.shape 20 | print('Video Frame shape W:%d, H:%d, Channel:%d\n'%(w, h, c)) 21 | else: 22 | print('resolution [%d, %d] does not support '%(resolution[0], resolution[1])) 23 | cap.release() 24 | --------------------------------------------------------------------------------