kisa-misa commited on
Commit
d6e06bd
·
1 Parent(s): 339c8c8

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -7
app.py CHANGED
@@ -31,9 +31,9 @@ deq = {}
31
  indices = [0] * 100
32
  c = 0
33
  num = 1
34
- f = open('/content/pulse.csv', "w+")
35
  f.close()
36
- with open('/content/pulse.csv', 'a') as f:
37
  # create the csv writer
38
  writer = csv.writer(f)
39
 
@@ -299,7 +299,7 @@ class DetectionPredictor(BasePredictor):
299
 
300
  outputs = deepsort.update(xywhs, confss, oids, im0)
301
 
302
- with open('/content/pulse.csv', 'a') as f:
303
  # create the csv writer
304
  writer = csv.writer(f)
305
  if len(outputs) > 0:
@@ -307,14 +307,14 @@ class DetectionPredictor(BasePredictor):
307
  identities = outputs[:, -2]
308
  object_id = outputs[:, -1]
309
 
310
- f2 = open('/content/vehicles_data.csv', "w+")
311
  f2.close()
312
- with open('/content/vehicles_data.csv', 'a') as f:
313
  writer2 = csv.writer(f)
314
  header = ['id', 'class', 'speed', 'weight']
315
  writer2.writerow(header)
316
  draw_boxes(im0, bbox_xyxy, self.model.names, object_id,writer, writer2, identities)
317
- df = pd.read_csv("/content/pulse.csv")
318
  df['time'] = pd.to_datetime(df['time'], format = '%H:%M:%S %d.%m.%Y')
319
 
320
 
@@ -329,7 +329,7 @@ class DetectionPredictor(BasePredictor):
329
  ax.set_xticklabels([pd.to_datetime(t.get_text()).strftime('%H:%M:%S') for t in ax.get_xticklabels()])
330
  plt.ylabel('Pulse')
331
  plt.xlabel('time')
332
- plt.savefig(f'/content/time_series/figure_{num:010d}.png')
333
  num += 1
334
  except:
335
  log_string += f'An error occured while saving figure_{num:010d}.png, '
 
31
  indices = [0] * 100
32
  c = 0
33
  num = 1
34
+ f = open('/pulse.csv', "w+")
35
  f.close()
36
+ with open('/pulse.csv', 'a') as f:
37
  # create the csv writer
38
  writer = csv.writer(f)
39
 
 
299
 
300
  outputs = deepsort.update(xywhs, confss, oids, im0)
301
 
302
+ with open('/pulse.csv', 'a') as f:
303
  # create the csv writer
304
  writer = csv.writer(f)
305
  if len(outputs) > 0:
 
307
  identities = outputs[:, -2]
308
  object_id = outputs[:, -1]
309
 
310
+ f2 = open('/vehicles_data.csv', "w+")
311
  f2.close()
312
+ with open('/vehicles_data.csv', 'a') as f:
313
  writer2 = csv.writer(f)
314
  header = ['id', 'class', 'speed', 'weight']
315
  writer2.writerow(header)
316
  draw_boxes(im0, bbox_xyxy, self.model.names, object_id,writer, writer2, identities)
317
+ df = pd.read_csv("/pulse.csv")
318
  df['time'] = pd.to_datetime(df['time'], format = '%H:%M:%S %d.%m.%Y')
319
 
320
 
 
329
  ax.set_xticklabels([pd.to_datetime(t.get_text()).strftime('%H:%M:%S') for t in ax.get_xticklabels()])
330
  plt.ylabel('Pulse')
331
  plt.xlabel('time')
332
+ plt.savefig(f'/time_series/figure_{num:010d}.png')
333
  num += 1
334
  except:
335
  log_string += f'An error occured while saving figure_{num:010d}.png, '