Alexander Fengler commited on
Commit
c28e79f
1 Parent(s): 4809f98

backend work for visualization stuff

Browse files
Files changed (4) hide show
  1. app.py +1 -0
  2. inference.py +14 -12
  3. notebook_out_vid.mp4 +0 -0
  4. visualization_tests.ipynb +0 -0
app.py CHANGED
@@ -73,6 +73,7 @@ with gr.Blocks() as demo:
73
 
74
  with gr.Row():
75
  processed_frames = gr.Image(label="Live Frame")
 
76
  original_frames = gr.Image(label="Original Frame")
77
 
78
  with gr.Row():
 
73
 
74
  with gr.Row():
75
  processed_frames = gr.Image(label="Live Frame")
76
+ # graphs = gr.Image(label="Graphs")
77
  original_frames = gr.Image(label="Original Frame")
78
 
79
  with gr.Row():
inference.py CHANGED
@@ -100,20 +100,23 @@ palette = visualizer.dataset_meta.get('palette', None)
100
 
101
  print(len(classes))
102
  print(len(palette))
103
- def inference_frame_serial(image):
104
  start = time()
105
  result = inference_detector(model, image)
106
- print(f'inference time: {time()-start}')
107
  # show the results
108
- visualizer.add_datasample(
109
- 'result',
110
- image,
111
- data_sample=result,
112
- draw_gt = None,
113
- show=False
114
- )
115
- frame = visualizer.get_image()
116
- return frame
 
 
 
117
 
118
  def inference_frame(image):
119
  result = inference_detector(model, image)
@@ -134,7 +137,6 @@ def inference_frame(image):
134
  cnt+=1
135
 
136
  #frames = process_frames(result, image, visualizer)
137
-
138
  return frames
139
 
140
  def inference_frame_par_ready(image):
 
100
 
101
  print(len(classes))
102
  print(len(palette))
103
+ def inference_frame_serial(image, visualize = True):
104
  start = time()
105
  result = inference_detector(model, image)
106
+ #print(f'inference time: {time()-start}')
107
  # show the results
108
+ if visualize:
109
+ visualizer.add_datasample(
110
+ 'result',
111
+ image,
112
+ data_sample=result,
113
+ draw_gt = None,
114
+ show=False
115
+ )
116
+ frame = visualizer.get_image()
117
+ else:
118
+ frame = None
119
+ return frame, result
120
 
121
  def inference_frame(image):
122
  result = inference_detector(model, image)
 
137
  cnt+=1
138
 
139
  #frames = process_frames(result, image, visualizer)
 
140
  return frames
141
 
142
  def inference_frame_par_ready(image):
notebook_out_vid.mp4 ADDED
Binary file (97.5 kB). View file
 
visualization_tests.ipynb ADDED
The diff for this file is too large to render. See raw diff