object_detect相关命令
标清 -vsync 1 -async 1 -y -re -i /data/test.ts -discontinuity_exit -channel_num 1 -snapshots 1 -telnet_port 1700 -filter_complex split=outputs=1:[proxy0];[proxy0]pad=aspect=:keep_aspect=1[pad],[pad]scale=720:576[out0] -rtpflags +latm -vcodec rawvideo -r 25 -map [out0]:v:0 -max_muxing_queue_size 1024 -codec:a:0 pcm_s16le -ar:a:0 48000 -map 0:a:0 -f decklink_sdi -card_type decklink -video_mode PAL 1 -loglevel verbose -stats 720p25 -vsync 1 -async 1 -y -re -i /data/test.ts -discontinuity_exit -channel_num 1 -snapshots 1 -telnet_port 1700 -filter_complex split=outputs=1:[proxy0];[proxy0]pad=aspect=:keep_aspect=1[pad],[pad]scale=1280:720[out0] -rtpflags +latm -vcodec rawvideo -r 25 -map [out0]:v:0 -max_muxing_queue_size 1024 -codec:a:0 pcm_s16le -ar:a:0 48000 -map 0:a:0 -f decklink_sdi -card_type decklink -video_mode 720p25 1 -loglevel verbose -stats 720p50 -vsync 1 -async 1 -y -re -i /data/test.ts -discontinuity_exit -channel_num 1 -snapshots 1 -telnet_port 1700 -filter_complex split=outputs=1:[proxy0];[proxy0]pad=aspect=:keep_aspect=1[pad],[pad]scale=1280:720[out0] -rtpflags +latm -vcodec rawvideo -r 50 -map [out0]:v:0 -max_muxing_queue_size 1024 -codec:a:0 pcm_s16le -ar:a:0 48000 -map 0:a:0 -f decklink_sdi -card_type decklink -video_mode 720p50 1 -loglevel verbose -stats 1080p25 -vsync 1 -async 1 -y -re -i /data/test.ts -discontinuity_exit -channel_num 1 -snapshots 1 -telnet_port 1700 -filter_complex split=outputs=1:[proxy0];[proxy0]pad=aspect=:keep_aspect=1[pad],[pad]scale=1920:1080[out0] -rtpflags +latm -vcodec rawvideo -r 25 -map [out0]:v:0 -max_muxing_queue_size 1024 -codec:a:0 pcm_s16le -ar:a:0 48000 -map 0:a:0 -f decklink_sdi -card_type decklink -video_mode 1080p25 1 -loglevel verbose -stats 1080p50 -vsync 1 -async 1 -y -re -i /data/test.ts -discontinuity_exit -channel_num 1 -snapshots 1 -telnet_port 1700 -filter_complex split=outputs=1:[proxy0];[proxy0]pad=aspect=:keep_aspect=1[pad],[pad]scale=1920:1080[out0] -rtpflags +latm -vcodec rawvideo -r 50 -map [out0]:v:0 -max_muxing_queue_size 1024 -codec:a:0 pcm_s16le -ar:a:0 48000 -map 0:a:0 -f decklink_sdi -card_type decklink -video_mode 1080p50 1 -loglevel verbose -stats scp lvyunxiang@192.168.1.7://work/lvyunxiang/t800020200318/T8000/ingest_source/decklink/api/libdecklink.so /lib64 sh yckj_model_train.sh /root/my_object_detection_api/models-master/research/object_detection/test_images/train/ /root/my_object_detection_api/models-master/research/object_detection/test_images/test/ lvyunxiangxxxx /root/output 30000 bzip2-devel python3 generate_tfrecord.py --csv_input=/root/my_object_detection_api/models-master/research/object_detection/test_images/train/lvyunxiangxxxx_train.csv --output_path=/root/my_object_detection_api/models-master/research/object_detection/test_images/train/lvyunxiangrrrrtrain.record --model_name mayun --image_dir=/root/my_object_detection_api/models-master/research/object_detection/test_images/train/ g++ test_opencv.cpp -I/root/opencv-4.2.0/install/include/opencv4/ -L/root/opencv-4.2.0/install/lib64 -lopencv_highgui -lopencv_imgcodecs -lopencv_core -lopencv_video -lopencv_imgproc -lopencv_imgcodecs -lopencv_objdetect -lopencv_ml -lopencv_calib3d -lopencv_dnn -lopencv_features2d -lopencv_flann -lopencv_videoio -lopencv_photo -o test_opencv -std=c++11 export LD_LIBRARY_PATH=/home/lib_object_detect/:/root/opencv-4.2.0/install/lib64/:/usr/local/x265_10bit/lib/:/usr/local/lib sh yckj_model_train.sh /home/my_object_detect/cctv_train_image/ /home/my_object_detect/cctv_test_image/ cctv /home/my_object_detect/cctv_output_dir/ 50000 /home/my_object_detect/cctv_train_temp_dir ffmpeg -i /home/dafu.ts -vf object_detect=model_path=/home/cctv_output_dir/frozen_inference_graph.pb:pbtxt_path=/home/cctv_output_dir/cctv.pbtxt:object_name_path=/root/opencv_src/opencv-4.2.0/samples/data/dnn/object_detection_classes_coco.txt -vcodec libx265 -acodec copy -f mepgts test_object_detect.ts sh yckj_model_train.sh /home/my_object_detect/mayun_train_image /home/my_object_detect/mayun_test_image/ mayun /home/my_object_detect/mayun_output_dir/ 50000 /home/my_object_detect/mayun_train_temp_dir /home/ffmpeg-4.2.2/ffmpeg -y -i /home/dafu.ts -vobject_detect=model_path=/home/cctv_output_dir/frozen_inference_graph.pb:pbtxt_path=/home/cctv_output_dir/cctv.pbtxt:object_name_path=/root/opencv_src/opencv-4.2.0/samples/data/dnn/object_detection_classes_coco.txt -vcodec libx264 -acodec copy -loglevel info -f mpegts test_object_detect.ts short dest; char src[]={'2','7','1','0'} memcpy(dest,src[0],1) memcpy((void*)(dest+1),(void*)src[1],1) print("%d",dest); g++ opencv_detect4.cpp -I/root/opencv-4.2.0/install/include/opencv4/ -L/root/opencv-4.2.0/install/lib64 -lopencv_highgui -lopencv_imgcodecs -lopencv_core -lopencv_video -lopencv_imgproc -lopencv_imgcodecs -lopencv_objdetect -lopencv_ml -lopencv_calib3d -lopencv_dnn -lopencv_features2d -lopencv_flann -lopencv_videoio -lopencv_photo -o test_opencv -std=c++11 scp lvyunxiang@192.168.1.7://work/lvyunxiang/t800020200318/T8000/engine/3rdparty_img/opencv_4.2.0/lib64/* ./ scp lvyunxiang@192.168.1.7://work/lvyunxiang/t800020200318/T8000/engine/3rdparty_img/lib_object_detect/lib/libobject_detect.so /lib64 scp lvyunxiang@192.168.1.7://work/lvyunxiang/t800020200318/T8000/engine/3rdparty_img/lib_object_detect/lib/libobject_detect.so /lib64 scp lvyunxiang@192.168.1.7://work/lvyunxiang/t800020200318/T8000/engine/ffmpeg.3.3/libavfilter/libavfilter.so.6 /lib64 export LD_LIBRARY_PATH=/home/cudnn_opencv/ from utils import visualization_utils as vis_util # What model to download. MODEL_NAME = 'ssd_mobilenet_v1_coco_2018_01_28' MODEL_FILE = '/root/my_tensorflow_object_detech_api/' + MODEL_NAME + '.tar.gz' # Path to frozen detection graph. This is the actual model that is used for the object detection. PATH_TO_FROZEN_GRAPH = MODEL_NAME + '/frozen_inference_graph.pb' # List of the strings that is used to add correct label for each box. PATH_TO_LABELS = os.path.join('/root/my_tensorflow_object_detech_api/models-master/research/object_detection/data', 'mscoco_label_map.pbtxt') NUM_CLASSES = 90 ./ffmpeg -y -ss 500 -i /home/dafu.ts -pix_fmt yuv420p -vf object_detect=model_path=/home/ssd_mobilenet_v1_coco_2017_11_17/frozen_inference_graph.pb:pbtxt_path=/home/ssd_mobilenet_v1_coco_2017_11_17/ssd_mobilenet_v1_coco_2017_11_17.pbtxt:object_name_path=/root/opencv_src/opencv-4.2.0/samples/data/dnn/object_detection_classes_coco.txt:min_match_rate=0.5:show_rect=1 -vcodec libx264 -b:v 8000k -acodec copy -f mpegts test_object_detect.ts cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/Xusr/local -D WITH_TBB=ON -D BUILD_NEW_PYTHON_SUPPORT=ON -D WITH_V4L=ON -D INSTALL_C_EXAMPLES=ON -D INSTALL_PYTHON_EXAMPLES=ON -D BUILD_EXAMPLES=ON -D WITH_QT=ON -D WITH_OPENGL=ON -D ENABLE_FAST_MATH=1 -D CUDA_FAST_MATH=1 -D WITH_CUBLAS=1 -D WITH_CUDA=ON -D OPENCV_EXTRA_MODULES_PATH=../opencv_contrib/modules -D OPENCV_GENERATE_PKGCONFIG=ON -D WITH_INF_ENGINE=ON -D ENABLE_CXX11=ON -D CUDA_ARCH_BIN=61 -D CUDA_ARCH_PTX=61 -D OPENCV_ENABLE_NONFREE=ON .. cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local -D ENABLE_FAST_MATH=1 -D CUDA_FAST_MATH=1 -D WITH_CUDA=ON -D ENABLE_CXX11=ON -D CUDA_ARCH_BIN=61 -D CUDA_ARCH_PTX=61 .. cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/ -D WITH_TBB=ON -D BUILD_NEW_PYTHON_SUPPORT=ON -D WITH_V4L=ON -D INSTALL_C_EXAMPLES=ON -D INSTALL_PYTHON_EXAMPLES=ON -D BUILD_EXAMPLES=ON -D WITH_QT=ON -D WITH_OPENGL=ON -D ENABLE_FAST_MATH=1 -D CUDA_FAST_MATH=1 -D WITH_CUBLAS=1 -D WITH_CUDA=ON -D OPENCV_EXTRA_MODULES_PATH=../opencv_contrib/modules -D OPENCV_GENERATE_PKGCONFIG=ON -D WITH_INF_ENGINE=ON -D ENABLE_CXX11=ON -D CUDA_ARCH_BIN=61 -D CUDA_ARCH_PTX=61 -D OPENCV_ENABLE_NONFREE=ON .. cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/ -D WITH_TBB=ON -D ENABLE_FAST_MATH=1 -D CUDA_FAST_MATH=1 -D WITH_CUDA=ON -D OPENCV_EXTRA_MODULES_PATH=/home/opencv_contrib/modules - -D WITH_INF_ENGINE=ON -D ENABLE_CXX11=ON -D CUDA_ARCH_BIN=61 -D CUDA_ARCH_PTX=61 .. cmake -DCMAKE_BUILD_TYPE=RELEASE -DCMAKE_INSTALL_PREFIX=/home/cudnn_opencv -DWITH_TBB=ON -DWITH_V4L=ON -DWITH_OPENGL=ON -DWITH_CUDA=ON -DWITH_CUDNN=ON -DENABLE_FAST_MATH=1 -DCUDA_FAST_MATH=1 -DCUDA_NVCC_FLAGS="-D_FORCE_INLINES" -DWITH_CUBLAS=1 -DOPENCV_EXTRA_MODULES_PATH=/home/opencv_ext2/opencv_contrib/modules .. cmake -DCMAKE_BUILD_TYPE=RELEASE -DCMAKE_INSTALL_PREFIX=/home/cudnn_opencv_gpu -DWITH_TBB=ON -DWITH_V4L=ON -DWITH_OPENGL=ON -DWITH_CUDA=ON -DWITH_CUDNN=ON -D CUDA_ARCH_BIN=5.3,6.0,6.1,7.0,7.5 -DCUDA_ARCH_PTX=7.5 -DENABLE_FAST_MATH=1 -DCUDA_FAST_MATH=1 -DCUDA_NVCC_FLAGS="-D_FORCE_INLINES" -DWITH_CUBLAS=1 -DOPENCV_EXTRA_MODULES_PATH=/home/opencv_ext2/opencv_contrib/modules .. cmake -DCMAKE_BUILD_TYPE=RELEASE -DCMAKE_INSTALL_PREFIX=/home/cudnn_opencv -DWITH_TBB=ON -DWITH_V4L=ON -DWITH_OPENGL=ON -D WITH_CUDA=ON -DWITH_CUDNN=ON -D OPENCV_DNN_CUDA=ON -D CUDA_ARCH_BIN=5.3,6.0,6.1,7.0,7.5 -DCUDA_ARCH_PTX=7.5 -DENABLE_FAST_MATH=1 -DCUDA_FAST_MATH=1 -DCUDA_NVCC_FLAGS="-D_FORCE_INLINES" -DWITH_CUBLAS=1 -DOPENCV_EXTRA_MODULES_PATH=/home/opencv_ext2/opencv_contrib/modules .. exoprt LD_LIBRARY_PATH=/home/cudnn_opencv_gpu/lib64/ cmake -DCMAKE_BUILD_TYPE=RELEASE -DCMAKE_INSTALL_PREFIX=/home/cudnn_opencv -DWITH_TBB=ON -DWITH_V4L=ON -DWITH_OPENGL=ON -DWITH_CUDA=ON -DWITH_CUDNN=ON -D OPENCV_DNN_CUDA=ON -D CUDA_ARCH_BIN=6.0,6.1,7.0,7.5 -DCUDA_ARCH_PTX=7.5 -DENABLE_FAST_MATH=1 -DCUDA_FAST_MATH=1 -DCUDA_NVCC_FLAGS="-D_FORCE_INLINES" -DWITH_CUBLAS=1 -DOPENCV_EXTRA_MODULES_PATH=/home/opencv_ext2/opencv_contrib/modules .. -y -ss 500 -i /home/dafu.ts -pix_fmt yuv420p -vf object_detect=model_path=/home/ssd_mobilenet_v1_coco_2017_11_17/frozen_inference_graph.pb:pbtxt_path=/home/ssd_mobilenet_v1_coco_2017_11_17/ssd_mobilenet_v1_coco_2017_11_17.pbtxt:object_name_path=/home/ssd_mobilenet_v1_coco_2017_11_17/object_detection_classes_coco.txt:min_match_rate=0.5:show_rect=1:use_gpu=0:object_detect_request=person_80_replace_/root/test&chair_24_remove -vcodec libx264 -loglevel debug -loglevel info -b:v 8000k -acodec copy -f mpegts test_object_detect.ts -stats person_50_remove object_detect=enable object_detect_request=person_20_replace use_gpu_detect=1 show_rect=1 model_vec=[] # TO-DO replace this with label map def class_text_to_int(row_label): #if row_label == FLAGS.model_name: # return 1 #elif row_label == 'vehicle': # return 2 for i in range(0, len(model_vec)): #print(i, model_vec[i]) if row_label==model_vec[i]: return i+1 #else: None def main(_): global model_vec model_vec=FLAGS.model_name.split(',') for value in model_vec: print(value) writer = tf.python_io.TFRecordWriter(FLAGS.output_path) #path = os.path.join(os.getcwd(), 'images') path = FLAGS.image_dir #path = FLAGS.output_path examples = pd.read_csv(FLAGS.csv_input) grouped = split(examples, 'filename') for group in grouped: tf_example = create_tf_example(group, path) writer.write(tf_example.SerializeToString()) writer.close() #output_path = os.path.join(os.getcwd(), FLAGS.output_path) output_path = FLAGS.output_path print('Successfully created the TFRecords: {}'.format(output_path)) sh yckj_model_train.sh /home/my_object_detect/model_train_image /home/my_object_detect/model_test_image mayun,cctv /home/my_object_detect/model_output_dir 50000 /home/my_object_detect/model_train_temp_dir python3 /root/opencv_src/opencv-4.2.0/samples/dnn/tf_text_graph_mask_rcnn.py --input mask_rcnn_inception_v2_coco_2018_01_28/frozen_inference_graph.pb --config /root/my_tensorflow_object_detech_api/models-master/research/object_detection/samples/configs/mask_rcnn_inception_v2_coco.config --output /home/ssd_lvyunxiang_rcnn_mobilenet_v1.pbtxt export LD_LIBRARY_PATH=/home/object_detect/cuda_lib:/home/object_detect/libcudnn_lib/:/home/object_detect/object_detect_lib:/home/object_detect/opencv_lib/lib64 scp -r root@192.168.1.187:/usr/local/yckj/model /usr/local/yckj -y -ss 500 -i /home/dafu.ts -pix_fmt yuv420p -vf object_detect=model_path=/usr/local/yckj/model/ssd_mobilenet_v1_coco_2017_11_17/frozen_inference_graph.pb:pbtxt_path=/usr/local/yckj/model/ssd_mobilenet_v1_coco_2017_11_17/ssd_mobilenet_v1.pbtxt:object_name_path=/usr/local/yckj/model/ssd_mobilenet_v1_coco_2017_11_17/object_detection_classes.txt:min_match_rate=0.1:show_rect=1:use_gpu=0:object_detect_request=person_20_mosaic&chair_24_mosaic:skip_frame=20 -vcodec libx264 -loglevel debug -loglevel info -b:v 8000k -acodec copy -f mpegts test_object_detect.ts -stats