YOLO는 실시간 객체 탐지를 위한 딥러닝 모델로, 한 번의 신경망 연산으로 이미지 내의 객체를 빠르게 탐지할 수 있는 것이 특징입니다. YOLO 모델에 대한 설명은 이전 포스팅을 참고해주세요.
YOLOv10 모델 구조
YOLO(You Only Look Once)는 객체 감지 및 이미지 분할 모델입니다. 2015년 출시된 YOLO 모델은 빠른 속도와 정확성으로 널리 사용되었습니다. YOLOv10은 Ultralytics 파이썬 패키지를 기반으로 구축되어 실시
bompro.tistory.com
아래는 YOLO 모델을 로컬 환경에서 실행하는 코드입니다.
1. 가상환경 생성
conda create -n yolov10 python=3.10
conda activate yolov10
2. 의존성 패키지 설치
git clone https://github.com/THU-MIG/yolov10.git
cd yolov10
pip install -r requirements.txt
pip install -e .
3. 모델 다운로드
- yolov10
!mkdir -p {path}/weights
!wget -P {path}/weights -q https://github.com/THU-MIG/yolov10/releases/download/v1.1/yolov10n.pt
!wget -P {path}/weights -q https://github.com/THU-MIG/yolov10/releases/download/v1.1/yolov10s.pt
!wget -P {path}/weights -q https://github.com/THU-MIG/yolov10/releases/download/v1.1/yolov10m.pt
!wget -P {path}/weights -q https://github.com/THU-MIG/yolov10/releases/download/v1.1/yolov10b.pt
!wget -P {path}/weights -q https://github.com/THU-MIG/yolov10/releases/download/v1.1/yolov10x.pt
!wget -P {path}/weights -q https://github.com/THU-MIG/yolov10/releases/download/v1.1/yolov10l.pt
- yolo-doclaynet
hantian/yolo-doclaynet · Hugging Face
More details refer to Github Introduction You know that RAG is very popular these days. There are many applications that support talking to documents. However, there is a huge performance drop when talking to a complex document due to the complex structure
huggingface.co
4. 환경변수 설정(* 오류 해결)
os.environ['TORCH_FORCE_NO_WEIGHTS_ONLY_LOAD'] = '1'
5. 모델 실행
import cv2
import supervision as sv
from ultralytics import YOLOv10
def detect_layout(model_path, img_path):
model = YOLO(model=model_path)
image = cv2.imread(img_path)
results = model(image)[0]
detections = sv.Detections.from_ultralytics(results)
bounding_box_annotator = sv.BoundingBoxAnnotator()
label_annotator = sv.LabelAnnotator()
annotated_image = bounding_box_annotator.annotate(scene=image, detections=detections)
annotated_image = label_annotator.annotate(scene=annotated_image, detections=detections)
sv.plot_image(annotated_image)
'LLM' 카테고리의 다른 글
YOLOv10 모델 구조 (0) | 2025.04.06 |
---|---|
허깅페이스 모델 로컬 다운로드 (0) | 2024.11.27 |
RRADistill (1) | 2024.11.26 |
G-Eval Prompt (0) | 2024.02.27 |
HAE-RAE Bench (0) | 2024.02.25 |