MCPcopy
hub / github.com/WongKinYiu/PyTorch_YOLOv4 / __next__

Method __next__

utils/datasets.py:332–349  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

330 return self
331
332 def __next__(self):
333 self.count += 1
334 img0 = self.imgs.copy()
335 if cv2.waitKey(1) == ord('q'): # q to quit
336 cv2.destroyAllWindows()
337 raise StopIteration
338
339 # Letterbox
340 img = [letterbox(x, new_shape=self.img_size, auto=self.rect)[0] for x in img0]
341
342 # Stack
343 img = np.stack(img, 0)
344
345 # Convert
346 img = img[:, :, :, ::-1].transpose(0, 3, 1, 2) # BGR to RGB, to bsx3x416x416
347 img = np.ascontiguousarray(img)
348
349 return self.sources, img, img0, None
350
351 def __len__(self):
352 return 0 # 1E12 frames = 32 streams at 30 FPS for 30 years

Callers

nothing calls this directly

Calls 1

letterboxFunction · 0.85

Tested by

no test coverage detected