oguzakif commited on
Commit
7f0774a
1 Parent(s): dcc7275

variable init position bug fix

Browse files
Files changed (1) hide show
  1. app.py +11 -9
app.py CHANGED
@@ -162,19 +162,21 @@ def track_and_mask(vid, masked_frame, original_list, mask_list, in_fps, dt_strin
162
  # init tracker
163
  state = siamese_init(
164
  frame, target_pos, target_sz, siammask, cfg['hp'], device=device)
 
 
 
165
  else:
166
  # track
167
  state = siamese_track(
168
  state, frame, mask_enable=True, refine_enable=True, device=device)
169
-
170
- original_list.append(cv2.cvtColor(frame, cv2.COLOR_BGR2RGB))
171
- mask = state['mask'] > state['p'].seg_thr
172
- frame[:, :, 2] = (mask > 0) * 255 + \
173
- (mask == 0) * frame[:, :, 2]
174
-
175
- mask = mask.astype(np.uint8) # convert to an unsigned byte
176
- mask = mask * 255
177
- mask_list.append(mask)
178
 
179
  video_writer.write(frame)
180
  f = f + 1
 
162
  # init tracker
163
  state = siamese_init(
164
  frame, target_pos, target_sz, siammask, cfg['hp'], device=device)
165
+ original_list.append(cv2.cvtColor(frame, cv2.COLOR_BGR2RGB))
166
+ frame[:, :, 2] = (mask > 0) * 255 + \
167
+ (mask == 0) * frame[:, :, 2]
168
  else:
169
  # track
170
  state = siamese_track(
171
  state, frame, mask_enable=True, refine_enable=True, device=device)
172
+ original_list.append(cv2.cvtColor(frame, cv2.COLOR_BGR2RGB))
173
+ mask = state['mask'] > state['p'].seg_thr
174
+ frame[:, :, 2] = (mask > 0) * 255 + \
175
+ (mask == 0) * frame[:, :, 2]
176
+
177
+ mask = mask.astype(np.uint8) # convert to an unsigned byte
178
+ mask = mask * 255
179
+ mask_list.append(mask)
 
180
 
181
  video_writer.write(frame)
182
  f = f + 1