diff --git a/README.md b/README.md index 609d8d4..a8d513a 100644 --- a/README.md +++ b/README.md @@ -18,6 +18,7 @@ Use with [python-OP3](https://github.com/culdo/python-OP3) * MJPEG streaming for YOLO+SiamMask result on port 8091 * Auto labeling powered by YOLO+SiamMask. # Requirement +* CUDA Toolkit 10.1 + cuDNN 7.6.5 or you can download those dll in Releases * Ubuntu 18.04 or 16.04 * Ubuntu 16.04 need compiled opencv for unicode labels on result image * Put this project in same directory as [darknet](https://github.com/AlexeyAB/darknet) diff --git a/darknet_video/core/darknet.py b/darknet_video/core/darknet.py index b7b6f7f..cf03b63 100644 --- a/darknet_video/core/darknet.py +++ b/darknet_video/core/darknet.py @@ -84,9 +84,9 @@ class METADATA(Structure): # lib = CDLL("/home/pjreddie/documents/darknet/libdarknet.so", RTLD_GLOBAL) # lib = CDLL("libdarknet.so", RTLD_GLOBAL) hasGPU = True +libPath = os.path.dirname(__file__) +libPath = os.path.join(libPath, "..", "..", "lib") if os.name == "nt": - libPath = os.path.dirname(__file__) - libPath = os.path.join(libPath, "..", "..", "lib") os.environ['PATH'] = libPath + ';' + os.environ['PATH'] winGPUdll = os.path.join(libPath, "yolo_cpp_dll.dll") winNoGPUdll = os.path.join(libPath, "yolo_cpp_dll_nogpu.lib") @@ -128,7 +128,7 @@ class METADATA(Structure): print( "Environment variables indicated a CPU run, but we didn't find `" + winNoGPUdll + "`. Trying a GPU run anyway.") else: - lib = CDLL(os.path.dirname(__file__) + "/../libdarknet.so", RTLD_GLOBAL) + lib = CDLL(os.path.join(libPath, "libdarknet.so"), RTLD_GLOBAL) lib.network_width.argtypes = [c_void_p] lib.network_width.restype = c_int lib.network_height.argtypes = [c_void_p] diff --git a/test/test_darknet.py b/test/test_darknet.py index 5bc3c10..72a1cf5 100644 --- a/test/test_darknet.py +++ b/test/test_darknet.py @@ -35,13 +35,6 @@ def mango_yolo(url, weights, **kwargs): if __name__ == '__main__': - outdoor_lab = "rtsp://192.168.0.61:554/user=admin&password=&channel=1&stream=0.sdp?real_stream--rtp-caching=1" - # indoor_lab = "rtsp://203.64.134.168:554/user=admin&password=&channel=1&stream=0.sdp?real_stream--rtp-caching=1" - indoor_lab = "rtsp://192.168.0.60:554/user=admin&password=&channel=1&stream=0.sdp?real_stream--rtp-caching=1" - op3_camera = "http://192.168.0.101:8080/stream?topic=/usb_cam_node/image_raw&type=ros_compressed" - gg_phone_ip = "http://203.64.134.168:8000/video" - phone_ip = "http://192.168.13.246:8080/video" - wan_phone_ip = "http://203.64.134.168:8082/video" v4_weights = "bin/yolov4.weights" v4tiny_weights = "bin/yolov4-tiny.weights" @@ -59,10 +52,11 @@ def mango_yolo(url, weights, **kwargs): hands_weights = "backup/yolov4-hands_best.weights" hand_weights = "bin/cross-hands.weights" + phone_ip = "http://192.168.13.246:8080/video" yt_video = get_yt_vid("https://www.youtube.com/watch?v=9XPBNaLXzPo") # os.environ["CUDA_VISIBLE_DEVICES"] = "1" if not labeling: - coco_yolo(phone_ip, enet_weights, is_realtime=True, is_tracking=False, + coco_yolo(yt_video, enet_weights, is_realtime=True, is_tracking=False, meta_file="coco_cht.data", thresh=0.25, show_gui=True, is_stream_result=False) else: pass