Ultralytics 설치
Ultralytics는 pip, conda, Docker를 포함한 다양한 설치 방법을 제공합니다. 최신 안정화 릴리스의 경우 ultralytics pip 패키지를 통해 YOLO를 설치하거나, 가장 최신 버전을 원할 경우 Ultralytics GitHub 저장소를 복제(clone)하여 설치할 수 있습니다. Docker를 사용하여 격리된 컨테이너 내에서 패키지를 실행할 수도 있으며, 이를 통해 로컬 설치 과정을 생략할 수 있습니다.
Watch: Ultralytics YOLO Quick Start Guide
Install or update the ultralytics package using pip by running pip install -U ultralytics. For more details on the ultralytics package, visit the Python Package Index (PyPI).
# Install or upgrade the ultralytics package from PyPI
pip install -U ultralyticsultralytics를 Ultralytics GitHub 저장소에서 직접 설치할 수도 있습니다. 이는 최신 개발 버전을 원할 경우 유용합니다. Git 명령줄 도구가 설치되어 있는지 확인한 후 다음을 실행하십시오:
# Install the ultralytics package from GitHub
pip install git+https://github.com/ultralytics/ultralytics.git@main종속성 목록은 ultralytics의 pyproject.toml 파일을 확인하십시오. 위 예제들은 모두 필요한 모든 종속성을 설치합니다.
헤드리스(Headless) 서버 설치
For server environments without a display (e.g., cloud VMs, Docker containers, CI/CD pipelines), use the ultralytics-opencv-headless package. This is identical to the standard ultralytics package but depends on opencv-python-headless instead of opencv-python, avoiding unnecessary GUI dependencies and potential libGL errors.
pip install ultralytics-opencv-headless두 패키지 모두 동일한 기능과 API를 제공합니다. 헤드리스 변형은 단순히 디스플레이 라이브러리가 필요한 OpenCV의 GUI 구성 요소를 제외합니다.
고급 설치
표준 설치 방법이 대부분의 사용 사례를 다루지만, 개발이나 사용자 지정 구성을 위해 더 맞춤화된 설정이 필요할 수 있습니다.
영구적인 사용자 지정 수정이 필요한 경우, Ultralytics 저장소를 포크하고 pyproject.toml이나 다른 코드를 변경한 후 해당 포크에서 설치할 수 있습니다.
- Ultralytics GitHub 저장소를 본인의 GitHub 계정으로 포크(Fork) 하십시오.
- 포크를 로컬에 복제(Clone) 하십시오:
git clone https://github.com/YOUR_USERNAME/ultralytics.git cd ultralytics - 변경 사항을 위한 새 브랜치를 생성 하십시오:
git checkout -b my-custom-branch pyproject.toml또는 기타 파일을 필요에 따라 수정 하십시오.- 변경 사항을 커밋(Commit) 및 푸시(Push) 하십시오:
git add . git commit -m "My custom changes" git push origin my-custom-branch - 브랜치를 가리키는
git+https구문을 사용하여 pip로 설치 하십시오:pip install git+https://github.com/YOUR_USERNAME/ultralytics.git@my-custom-branch
CLI와 함께 Ultralytics 사용
Ultralytics 명령줄 인터페이스(CLI)를 사용하면 Python 환경 없이도 간단한 한 줄 명령어로 실행할 수 있습니다. CLI는 사용자 지정이나 Python 코드가 필요 없으며, 터미널에서 yolo 명령어로 모든 작업을 수행합니다. 명령줄에서 YOLO를 사용하는 방법에 대한 자세한 내용은 CLI 가이드를 참조하십시오.
Ultralytics yolo 명령은 다음 구문을 사용합니다:
yolo TASK MODE ARGSTASK(선택 사항)는 (detect, segment, classify, pose, obb, semantic) 중 하나입니다.MODE(필수)는 (train, val, predict, export, track, benchmark) 중 하나입니다.ARGS(optional) arearg=valuepairs likeimgsz=640that override defaults.
모든 ARGS는 전체 구성 가이드 또는 yolo cfg CLI 명령을 통해 확인할 수 있습니다.
Arguments must be passed as arg=value pairs, split by an equals = sign and delimited by spaces. Do not use -- argument prefixes or commas , between arguments.
yolo predict model=yolo26n.pt imgsz=640 conf=0.25✅yolo predict model yolo26n.pt imgsz 640 conf 0.25❌ (=누락됨)yolo predict model=yolo26n.pt, imgsz=640, conf=0.25❌ (쉼표,사용 금지)yolo predict --model yolo26n.pt --imgsz 640 --conf 0.25❌ (--사용 금지)yolo solution model=yolo26n.pt imgsz=640 conf=0.25❌ (usesolutions, notsolution)
Python과 함께 Ultralytics 사용
Ultralytics YOLO Python 인터페이스는 Python 프로젝트에 원활하게 통합되어 모델 출력물을 로드, 실행 및 처리하기 쉽게 해줍니다. 단순성을 위해 설계된 Python 인터페이스를 통해 사용자는 객체 탐지, 세그멘테이션 및 분류를 빠르게 구현할 수 있습니다. 이는 YOLO Python 인터페이스를 Python 프로젝트에 이러한 기능을 통합하는 데 귀중한 도구로 만들어 줍니다.
예를 들어, 단 몇 줄의 코드로 모델을 로드하고, 학습시키고, 성능을 평가하고, ONNX 형식으로 내보낼 수 있습니다. Python 프로젝트 내에서 YOLO를 사용하는 방법에 대해 더 자세히 알아보려면 Python 가이드를 탐색하십시오.
from ultralytics import YOLO
# Create a new YOLO model from scratch
model = YOLO("yolo26n.yaml")
# Load a pretrained YOLO model (recommended for training)
model = YOLO("yolo26n.pt")
# Train the model using the 'coco8.yaml' dataset for 3 epochs
results = model.train(data="coco8.yaml", epochs=3)
# Evaluate the model's performance on the validation set
results = model.val()
# Perform object detection on an image using the model
results = model("https://ultralytics.com/images/bus.jpg")
# Export the model to ONNX format
success = model.export(format="onnx")Ultralytics 설정
Ultralytics 라이브러리에는 실험을 미세하게 제어할 수 있는 SettingsManager가 포함되어 있어 사용자가 설정을 쉽게 액세스하고 수정할 수 있습니다. 환경의 사용자 구성 디렉토리 내 JSON 파일에 저장되는 이 설정들은 Python 환경 또는 명령줄 인터페이스(CLI)를 통해 보고 수정할 수 있습니다.
설정 검사
현재 설정 구성을 보려면:
Use Python to view your settings by importing the settings object from the ultralytics module. Print and return settings with these commands:
from ultralytics import settings
# View all settings
print(settings)
# Return a specific setting
value = settings["runs_dir"]설정 수정
Ultralytics는 다음과 같은 방법으로 쉽게 설정을 수정할 수 있습니다:
In Python, use the update method on the settings object:
from ultralytics import settings
# Update a setting
settings.update({"runs_dir": "/path/to/runs"})
# Update multiple settings
settings.update({"runs_dir": "/path/to/runs", "tensorboard": False})
# Reset settings to default values
settings.reset()설정 이해하기
아래 표는 Ultralytics 내의 조정 가능한 설정을 요약하며, 예시 값, 데이터 유형 및 설명을 포함합니다.
| 이름 | 예시 값 | 데이터 유형 | 설명 |
|---|---|---|---|
settings_version | '0.0.4' | str | Ultralytics settings version (distinct from the Ultralytics pip version) |
datasets_dir | '/path/to/datasets' | str | 데이터셋이 저장되는 디렉토리 |
weights_dir | '/path/to/weights' | str | 모델 가중치가 저장되는 디렉토리 |
runs_dir | '/path/to/runs' | str | 실험 실행 결과가 저장되는 디렉토리 |
uuid | 'a1b2c3d4' | str | 현재 설정에 대한 고유 식별자 |
sync | True | bool | Option to sync analytics and crashes to Ultralytics Platform |
api_key | '' | str | Ultralytics Platform API Key |
clearml | True | bool | Option to use ClearML logging |
comet | True | bool | Option to use Comet ML for experiment tracking and visualization |
dvc | True | bool | Option to use DVC for experiment tracking and version control |
hub | True | bool | Option to use Ultralytics Platform integration |
mlflow | True | bool | Option to use MLFlow for experiment tracking |
neptune | True | bool | Option to use Neptune for experiment tracking |
raytune | True | bool | Option to use Ray Tune for hyperparameter tuning |
tensorboard | True | bool | Option to use TensorBoard for visualization |
wandb | True | bool | Option to use Weights & Biases logging |
vscode_msg | True | bool | When a VS Code terminal is detected, enables a prompt to download the Ultralytics-Snippets extension. |
프로젝트나 실험을 진행하면서 최적의 구성을 위해 이 설정들을 다시 확인하십시오.
자주 묻는 질문(FAQ)
pip를 사용하여 Ultralytics를 어떻게 설치하나요?
pip를 사용하여 Ultralytics를 설치하려면 다음을 실행하세요:
pip install -U ultralyticsThis installs the latest stable release of the ultralytics package from PyPI. To install the development version directly from GitHub:
pip install git+https://github.com/ultralytics/ultralytics.git시스템에 Git 명령줄 도구가 설치되어 있는지 확인하십시오.
conda를 사용하여 Ultralytics YOLO를 설치할 수 있나요?
네, conda를 사용하여 Ultralytics YOLO를 설치하려면 다음을 실행하세요:
conda install -c conda-forge ultralytics이 방법은 pip의 훌륭한 대안이며, 다른 패키지와의 호환성을 보장합니다. CUDA 환경의 경우 충돌을 방지하기 위해 ultralytics, pytorch, pytorch-cuda를 함께 설치하십시오:
conda install -c pytorch -c nvidia -c conda-forge pytorch torchvision pytorch-cuda=11.8 ultralytics더 자세한 내용은 Conda 퀵스타트 가이드를 참조하십시오.
Docker를 사용하여 Ultralytics YOLO를 실행하면 어떤 장점이 있나요?
Docker는 Ultralytics YOLO를 위한 격리되고 일관된 환경을 제공하여 시스템 전반에서 원활한 성능을 보장하고 로컬 설치 복잡성을 피할 수 있게 합니다. 공식 Docker 이미지는 Docker Hub에서 제공되며, GPU, CPU, ARM64, NVIDIA Jetson 및 Conda용 변형이 있습니다. 최신 이미지를 가져와 실행하려면 다음을 사용하세요:
# Pull the latest ultralytics image from Docker Hub
sudo docker pull ultralytics/ultralytics:latest
# Run the ultralytics image in a container with GPU support
sudo docker run -it --ipc=host --runtime=nvidia --gpus all ultralytics/ultralytics:latest상세한 Docker 지침은 Docker 퀵스타트 가이드를 참조하십시오.
개발을 위해 Ultralytics 저장소를 복제(clone)하려면 어떻게 해야 하나요?
Ultralytics 저장소를 복제하고 개발 환경을 설정하려면 다음을 실행하세요:
# Clone the ultralytics repository
git clone https://github.com/ultralytics/ultralytics
# Navigate to the cloned directory
cd ultralytics
# Install the package in editable mode for development
pip install -e .이를 통해 프로젝트에 기여하거나 최신 소스 코드로 실험할 수 있습니다. 자세한 내용은 Ultralytics GitHub 저장소를 방문하십시오.
Ultralytics YOLO CLI를 사용해야 하는 이유는 무엇인가요?
Ultralytics YOLO CLI는 Python 코드 없이 객체 탐지 작업을 실행할 수 있게 하여, 터미널에서 직접 학습, 검증, 예측을 위한 한 줄 명령어를 제공합니다. 기본 구문은 다음과 같습니다:
yolo TASK MODE ARGS예를 들어, 탐지 모델을 학습하려면 다음을 실행하세요:
yolo train data=coco8.yaml model=yolo26n.pt epochs=10 lr0=0.01전체 CLI 가이드에서 더 많은 명령어와 사용 예시를 살펴보세요.