| # Hugging Face 모델 & 데이터셋 사용 가이드 |
|
|
| 이 페이지는 Hugging Face Hub에 올려진 YOLO26 모델과 데이터셋을 다운로드해서 사용하는 방법을 설명합니다. |
|
|
| ## 모델 다운로드 및 추론 |
|
|
| ### 설치 및 로그인 |
|
|
| ```bash |
| pip install huggingface_hub ultralytics |
| huggingface-cli login # (또는 HUGGINGFACE_HUB_TOKEN 환경변수 설정) |
| ``` |
|
|
| ### 모델 사용 - 기본 예시 |
|
|
| ```python |
| from huggingface_hub import snapshot_download |
| from ultralytics import YOLO |
| |
| model_dir = snapshot_download( |
| repo_id="your-id/nut-volt-yolo26m", |
| repo_type="model", |
| ) |
| |
| model = YOLO(f"{model_dir}/weights/best.pt") |
| results = model.predict(source="test.jpg", imgsz=640, conf=0.25) |
| |
| results[0].save(filename="prediction.jpg") |
| print(results[0].plot()) |
| ``` |
|
|
| ### 모델 사용 - 비디오 추론 예시 |
|
|
| ```python |
| from huggingface_hub import snapshot_download |
| from ultralytics import YOLO |
| |
| model_dir = snapshot_download( |
| repo_id="your-id/nut-volt-yolo26m", |
| repo_type="model", |
| ) |
| |
| model = YOLO(f"{model_dir}/weights/best.pt") |
| |
| # 이미지 추론 |
| results = model.predict(source="image.jpg", imgsz=640, conf=0.25) |
| results[0].save(filename="image_pred.jpg") |
| |
| # 비디오 추론 |
| results = model.predict(source="video.mp4", imgsz=640, conf=0.25, save=True) |
| ``` |
|
|
| ## 데이터셋 다운로드 |
|
|
| ### 학습 시 사용한 데이터셋 다운로드 |
|
|
| ```python |
| from huggingface_hub import snapshot_download |
| |
| dataset_dir = snapshot_download( |
| repo_id="your-id/nut-volt-dataset", |
| repo_type="dataset", |
| ) |
| |
| print(dataset_dir) |
| ``` |
|
|
| 내려받은 데이터셋의 `data.yaml`을 사용해 새로운 모델을 학습할 수 있습니다. |
|
|
| ## 주의사항 |
|
|
| - 모델 폴더 내에 `weights/best.pt` 파일이 존재해야 합니다. |
| - 데이터셋 repo에는 `output_dataset/` 전체 디렉토리 구조가 포함되어 있습니다. |
| - Repo 이름은 필요에 맞게 변경해서 사용해도 됩니다. |
|
|
| ## repo 링크 |
|
|
| - 모델: https://huggingface.co/mihyun1115/nut-volt-yolo26m |
| - 데이터셋: https://huggingface.co/datasets/mihyun1115/nut-volt-dataset |