Skip to content

Commit

Permalink
Add requirements, clear code.
Browse files Browse the repository at this point in the history
  • Loading branch information
culdo committed Apr 2, 2022
1 parent fc1938f commit 9336760
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 11 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
6 changes: 3 additions & 3 deletions darknet_video/core/darknet.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down Expand Up @@ -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]
Expand Down
10 changes: 2 additions & 8 deletions test/test_darknet.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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

0 comments on commit 9336760

Please sign in to comment.