da03 commited on
Commit
487aaae
·
1 Parent(s): 9caafdc
Files changed (1) hide show
  1. main.py +11 -2
main.py CHANGED
@@ -457,6 +457,8 @@ async def websocket_endpoint(websocket: WebSocket):
457
  try:
458
  previous_actions = []
459
  previous_frames = []
 
 
460
  while True:
461
  try:
462
  # Receive user input with a timeout
@@ -518,6 +520,14 @@ async def websocket_endpoint(websocket: WebSocket):
518
  else:
519
  #previous_frames = []
520
  previous_actions = []
 
 
 
 
 
 
 
 
521
  #previous_actions = []
522
  # Load and append the corresponding ground truth image instead of model output
523
  #print ('here4', len(previous_frames))
@@ -538,8 +548,7 @@ async def websocket_endpoint(websocket: WebSocket):
538
  img_str = base64.b64encode(buffered.getvalue()).decode()
539
 
540
  # Log the processing time
541
- processing_time = time.time() - start_time
542
- print(f"Frame processing time: {processing_time:.2f} seconds")
543
 
544
  # Send the generated frame back to the client
545
  await websocket.send_json({"image": img_str})
 
457
  try:
458
  previous_actions = []
459
  previous_frames = []
460
+ frames_since_update = 0
461
+ frame_times = []
462
  while True:
463
  try:
464
  # Receive user input with a timeout
 
520
  else:
521
  #previous_frames = []
522
  previous_actions = []
523
+ processing_time = time.time() - start_time
524
+ print(f"Frame processing time: {processing_time:.2f} seconds")
525
+ frame_times.append(processing_time)
526
+ frames_since_update += 1
527
+ print (f"Average frame processing time: {np.mean(frame_times):.2f} seconds")
528
+ fps = 1 / np.mean(frame_times)
529
+ print (f"FPS: {fps:.2f}")
530
+
531
  #previous_actions = []
532
  # Load and append the corresponding ground truth image instead of model output
533
  #print ('here4', len(previous_frames))
 
548
  img_str = base64.b64encode(buffered.getvalue()).decode()
549
 
550
  # Log the processing time
551
+
 
552
 
553
  # Send the generated frame back to the client
554
  await websocket.send_json({"image": img_str})