BhumikaMak commited on
Commit
672c2bf
·
1 Parent(s): c5224aa

Debug: refactor src

Browse files
Files changed (1) hide show
  1. yolov8.py +2 -1
yolov8.py CHANGED
@@ -6,6 +6,7 @@ import torchvision.transforms as transforms
6
  from pytorch_grad_cam import EigenCAM
7
  from pytorch_grad_cam.utils.image import show_cam_on_image, scale_cam_image
8
  import gradio as gr
 
9
 
10
  # Global Color Palette
11
  COLORS = np.random.uniform(0, 255, size=(80, 3))
@@ -53,7 +54,7 @@ def generate_cam_image(model, target_layers, tensor, rgb_img, boxes):
53
 
54
  def xai_yolov8s(image):
55
  # Load YOLOv8 model
56
- model = torch.hub.load('ultralytics/yolov8', 'yolov8s', pretrained=True)
57
  model.eval()
58
  model.cpu()
59
 
 
6
  from pytorch_grad_cam import EigenCAM
7
  from pytorch_grad_cam.utils.image import show_cam_on_image, scale_cam_image
8
  import gradio as gr
9
+ from ultralytics import YOLO
10
 
11
  # Global Color Palette
12
  COLORS = np.random.uniform(0, 255, size=(80, 3))
 
54
 
55
  def xai_yolov8s(image):
56
  # Load YOLOv8 model
57
+ model = YOLO('yolov8s.pt')
58
  model.eval()
59
  model.cpu()
60