MCPcopy Create free account
hub / github.com/BICLab/SpikeYOLO / close

Method close

ultralytics/data/loaders.py:128–139  ·  view source on GitHub ↗

Close stream loader and release resources.

(self)

Source from the content-addressed store, hash-verified

126 time.sleep(0.01) # wait until the buffer is empty
127
128 def close(self):
129 """Close stream loader and release resources."""
130 self.running = False # stop flag for Thread
131 for thread in self.threads:
132 if thread.is_alive():
133 thread.join(timeout=5) # Add timeout
134 for cap in self.caps: # Iterate through the stored VideoCapture objects
135 try:
136 cap.release() # release video capture
137 except Exception as e:
138 LOGGER.warning(f'WARNING ⚠️ Could not release VideoCapture object: {e}')
139 cv2.destroyAllWindows()
140
141 def __iter__(self):
142 """Iterates through YOLO image feed and re-opens unresponsive streams."""

Callers 15

__next__Method · 0.95
coco2yolo.pyFile · 0.45
plot_labelsFunction · 0.45
plot_resultsFunction · 0.45
plot_tune_resultsFunction · 0.45
feature_visualizationFunction · 0.45
wrapperFunction · 0.45
is_onlineFunction · 0.45
plotMethod · 0.45
plot_pr_curveFunction · 0.45
plot_mc_curveFunction · 0.45
downloadFunction · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected