weight_decay fix
This commit is contained in:
parent
8eb381dc88
commit
c344efc224
|
@ -124,6 +124,8 @@ 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 = 'rtsp://170.93.143.139/rtplive/470011e600ef003a004ee33696235daa' # IP traffic camera
|
||||
# pipe = 'http://wmccpinetop.axiscam.net/mjpg/video.mjpg' # IP golf camera
|
||||
|
||||
# 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
|
||||
|
@ -132,6 +134,7 @@ class LoadWebcam: # for inference
|
|||
# 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.pipe = pipe
|
||||
self.cap = cv2.VideoCapture(pipe) # video capture object
|
||||
|
||||
def __iter__(self):
|
||||
|
@ -144,11 +147,23 @@ class LoadWebcam: # for inference
|
|||
cv2.destroyAllWindows()
|
||||
raise StopIteration
|
||||
|
||||
# Read image
|
||||
# Read frame
|
||||
if self.pipe == 0: # local camera
|
||||
ret_val, img0 = self.cap.read()
|
||||
img0 = cv2.flip(img0, 1) # flip left-right
|
||||
else: # IP camera
|
||||
n = 0
|
||||
while True:
|
||||
n += 1
|
||||
self.cap.grab()
|
||||
if n % 30 == 0: # skip frames
|
||||
ret_val, img0 = self.cap.retrieve()
|
||||
if ret_val:
|
||||
break
|
||||
|
||||
# Print
|
||||
assert ret_val, 'Webcam Error'
|
||||
img_path = 'webcam_%g.jpg' % self.count
|
||||
img0 = cv2.flip(img0, 1) # flip left-right
|
||||
print('webcam %g: ' % self.count, end='')
|
||||
|
||||
# Padded resize
|
||||
|
|
Loading…
Reference in New Issue