Skip to content

Commit

Permalink
Fix: 수정 import error
Browse files Browse the repository at this point in the history
  • Loading branch information
semnisem committed Nov 25, 2024
1 parent a3efdbf commit dbbff0f
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions app/AIProcessor.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import cv2
from ultralytics import YOLO
from ultralytics import SAM
from segment_anything import sam_model_registry, SamPredictor
# from segment_anything import sam_model_registry, SamPredictor
import io
import logging

Expand Down Expand Up @@ -50,9 +50,10 @@ def remove_alpha(self, image):
return image_rgb

def load_sam_model(self, model_type="vit_h"): # sam 로드
self.sam_model = sam_model_registry[model_type](checkpoint=self.sam_path)
self.sam_model.to(self.device)
self.predictor = SamPredictor(self.sam_model)
# self.sam_model = sam_model_registry[model_type](checkpoint=self.sam_path)
# self.sam_model.to(self.device)
# self.predictor = SamPredictor(self.sam_model)
logging.info("SAM model cannot be loaded")

def object_detection(self, img):
results = self.yolo_model.predict(source=img, imgsz=640, device=self.device,
Expand Down

0 comments on commit dbbff0f

Please sign in to comment.