henry000 commited on
Commit
d65babf
·
1 Parent(s): 3ebbbd9

🔥 [Remove] stream inference mode

Browse files
Files changed (1) hide show
  1. yolo/tools/solver.py +0 -12
yolo/tools/solver.py CHANGED
@@ -1,8 +1,5 @@
1
- import time
2
  from pathlib import Path
3
 
4
- import cv2
5
- import numpy as np
6
  from lightning import LightningModule
7
  from torchmetrics.detection import MeanAveragePrecision
8
 
@@ -139,15 +136,6 @@ class InferenceModel(BaseModel):
139
  self._save_image(img, batch_idx)
140
  return img, fps
141
 
142
- def _display_stream(self, img):
143
- img = cv2.cvtColor(np.array(img), cv2.COLOR_RGB2BGR)
144
- fps = 1 / (time.time() - self.trainer.current_epoch_start_time)
145
- cv2.putText(img, f"FPS: {fps:.2f}", (0, 15), 0, 0.5, (100, 255, 0), 1, cv2.LINE_AA)
146
- cv2.imshow("Prediction", img)
147
- if cv2.waitKey(1) & 0xFF == ord("q"):
148
- self.trainer.should_stop = True
149
- return fps
150
-
151
  def _save_image(self, img, batch_idx):
152
  save_image_path = Path(self.trainer.default_root_dir) / f"frame{batch_idx:03d}.png"
153
  img.save(save_image_path)
 
 
1
  from pathlib import Path
2
 
 
 
3
  from lightning import LightningModule
4
  from torchmetrics.detection import MeanAveragePrecision
5
 
 
136
  self._save_image(img, batch_idx)
137
  return img, fps
138
 
 
 
 
 
 
 
 
 
 
139
  def _save_image(self, img, batch_idx):
140
  save_image_path = Path(self.trainer.default_root_dir) / f"frame{batch_idx:03d}.png"
141
  img.save(save_image_path)