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

Method __next__

ultralytics/data/loaders.py:146–172  ·  view source on GitHub ↗

Returns source paths, transformed and original images for processing.

(self)

Source from the content-addressed store, hash-verified

144 return self
145
146 def __next__(self):
147 """Returns source paths, transformed and original images for processing."""
148 self.count += 1
149
150 images = []
151 for i, x in enumerate(self.imgs):
152
153 # Wait until a frame is available in each buffer
154 while not x:
155 if not self.threads[i].is_alive() or cv2.waitKey(1) == ord('q'): # q to quit
156 self.close()
157 raise StopIteration
158 time.sleep(1 / min(self.fps))
159 x = self.imgs[i]
160 if not x:
161 LOGGER.warning(f'WARNING ⚠️ Waiting for stream {i}')
162
163 # Get and remove the first frame from imgs buffer
164 if self.buffer:
165 images.append(x.pop(0))
166
167 # Get the last frame, and clear the rest from the imgs buffer
168 else:
169 images.append(x.pop(-1) if x else np.zeros(self.shape[i], dtype=np.uint8))
170 x.clear()
171
172 return self.sources, images, None, ''
173
174 def __len__(self):
175 """Return the length of the sources object."""

Callers

nothing calls this directly

Calls 2

closeMethod · 0.95
appendMethod · 0.45

Tested by

no test coverage detected