Marthee commited on
Commit
b19565b
·
verified ·
1 Parent(s): 59ef905

Update doors_fasterrcnn.py

Browse files
Files changed (1) hide show
  1. doors_fasterrcnn.py +3 -3
doors_fasterrcnn.py CHANGED
@@ -407,7 +407,7 @@ def main_run(img_pillow,pdf_fullpath, weights_path, weights_path2, pdf_name,pdfp
407
  # Load the model with the specified number of classes
408
  model2 = get_model(num_classes2)
409
  # Load the saved model's state dictionary with map_location to handle CPU
410
- device = torch.device('cuda') if torch.cuda.is_available() else torch.device('cpu')
411
  try:
412
  model.load_state_dict(torch.load(weights_path2, map_location=device), strict=False)
413
  except RuntimeError as e:
@@ -416,11 +416,11 @@ def main_run(img_pillow,pdf_fullpath, weights_path, weights_path2, pdf_name,pdfp
416
  # Set the model to evaluation mode
417
  model2.eval()
418
  # Move the model to the appropriate device
419
- model2.to(device)
420
 
421
  # START INFERENCE
422
  doors_info = ev_model(img_pillow, model, device, 0.9)
423
- doors_info_double = ev_model(img_pillow, model2, device, 0.8)
424
 
425
 
426
  width_pixels, lines, sanda, line_midpoint, single_count, door_type = get_door_info(doors_info)
 
407
  # Load the model with the specified number of classes
408
  model2 = get_model(num_classes2)
409
  # Load the saved model's state dictionary with map_location to handle CPU
410
+ device2 = torch.device('cuda') if torch.cuda.is_available() else torch.device('cpu')
411
  try:
412
  model.load_state_dict(torch.load(weights_path2, map_location=device), strict=False)
413
  except RuntimeError as e:
 
416
  # Set the model to evaluation mode
417
  model2.eval()
418
  # Move the model to the appropriate device
419
+ model2.to(device2)
420
 
421
  # START INFERENCE
422
  doors_info = ev_model(img_pillow, model, device, 0.9)
423
+ doors_info_double = ev_model(img_pillow, model2, device2, 0.8)
424
 
425
 
426
  width_pixels, lines, sanda, line_midpoint, single_count, door_type = get_door_info(doors_info)