From d70ceec22a2a8e6d5ccbd9e8e894ad0b5229b34c Mon Sep 17 00:00:00 2001 From: Glenn Jocher Date: Sun, 11 Aug 2019 19:16:54 +0200 Subject: [PATCH] updates --- detect.py | 2 +- utils/datasets.py | 8 +++++++- utils/utils.py | 14 +++++++------- 3 files changed, 15 insertions(+), 9 deletions(-) diff --git a/detect.py b/detect.py index 5d0f2b4e..dd482ab9 100644 --- a/detect.py +++ b/detect.py @@ -51,7 +51,7 @@ def detect(cfg, return # Half precision - opt.half = opt.half and device.type != 'cpu' # half precision only supported on cuda + opt.half = opt.half and device.type != 'cpu' # half precision only supported on CUDA if opt.half: model.half() diff --git a/utils/datasets.py b/utils/datasets.py index d38f0030..ac3b33c4 100755 --- a/utils/datasets.py +++ b/utils/datasets.py @@ -124,7 +124,13 @@ class LoadWebcam: # for inference pipe = 0 # local camera # pipe = 'rtsp://192.168.1.64/1' # IP camera # pipe = 'rtsp://username:password@192.168.1.64/1' # IP camera with login - # pipe = '"rtspsrc location="rtsp://username:password@192.168.1.64/1" latency=10 ! appsink' # GStreamer https://answers.opencv.org/question/215996/changing-gstreamer-pipeline-to-opencv-in-pythonsolved/ + + # https://answers.opencv.org/question/215996/changing-gstreamer-pipeline-to-opencv-in-pythonsolved/ + # pipe = '"rtspsrc location="rtsp://username:password@192.168.1.64/1" latency=10 ! appsink' # GStreamer + + # https://answers.opencv.org/question/200787/video-acceleration-gstremer-pipeline-in-videocapture/ + # https://stackoverflow.com/questions/54095699/install-gstreamer-support-for-opencv-python-package # install help + # pipe = "rtspsrc location=rtsp://root:root@192.168.0.91:554/axis-media/media.amp?videocodec=h264&resolution=3840x2160 protocols=GST_RTSP_LOWER_TRANS_TCP ! rtph264depay ! queue ! vaapih264dec ! videoconvert ! appsink" # GStreamer self.cap = cv2.VideoCapture(pipe) # video capture object diff --git a/utils/utils.py b/utils/utils.py index 57674618..fdb0c4c0 100755 --- a/utils/utils.py +++ b/utils/utils.py @@ -624,14 +624,14 @@ def print_mutation(hyp, results, bucket=''): if bucket: os.system('gsutil cp gs://%s/evolve.txt .' % bucket) # download evolve.txt - with open('evolve.txt', 'a') as f: # append result - f.write(c + b + '\n') - x = np.unique(np.loadtxt('evolve.txt', ndmin=2), axis=0) # load unique rows - np.savetxt('evolve.txt', x[np.argsort(-fitness(x))], '%11.3g') # save sort by fitness + + with open('evolve.txt', 'a') as f: # append result + f.write(c + b + '\n') + x = np.unique(np.loadtxt('evolve.txt', ndmin=2), axis=0) # load unique rows + np.savetxt('evolve.txt', x[np.argsort(-fitness(x))], '%11.3g') # save sort by fitness + + if bucket: os.system('gsutil cp evolve.txt gs://%s' % bucket) # upload evolve.txt - else: - with open('evolve.txt', 'a') as f: - f.write(c + b + '\n') def fitness(x):