diff --git a/README.md b/README.md index e69de29..b7e80b0 100644 --- a/README.md +++ b/README.md @@ -0,0 +1,46 @@ +# Normal Object Detection + +YOLO 기반 일반 객체 탐지 스크립트입니다. 원격 이미지 URL을 받아 추론하고, 결과를 JSON으로 출력하며 ClearML에 기록합니다. + +## 요구 사항 + +- Python 3.11+ +- [uv](https://docs.astral.sh/uv/) (권장) + +## 설치 + +```bash +uv sync +``` + +## 사용법 + +```bash +uv run main.py --image_url "https://example.com/image.jpg" +``` + +- `--image_url`: 추론할 이미지 URL (필수) +- 모델: `weights/yolo26m.pt` (Ultralytics YOLO) +- 탐지 결과가 그려진 이미지는 `*_marked.jpg`로 저장됩니다. + +## 출력 + +표준 출력으로 JSON이 출력됩니다. + +| 필드 | 설명 | +|------|------| +| `path` | 입력 이미지 경로 | +| `marked_path` | 바운딩 박스가 그려진 이미지 경로 | +| `shape` | 이미지 크기 (width, height) | +| `speed_ms` | 추론 속도 (ms) | +| `detections` | 탐지 객체 목록 (클래스, 신뢰도, `xywh` 박스) | + +## ClearML + +실행 시 ClearML Task가 생성됩니다. + +- **Project**: `Normal_Object_Detection` +- **Task**: `model-yolo26-human` +- **Artifact**: `final_result` (추론 결과 JSON) + +ClearML 서버 연결 설정이 필요합니다 (`clearml-init`). diff --git a/main.py b/main.py index e13df68..35fa166 100644 --- a/main.py +++ b/main.py @@ -11,16 +11,6 @@ from clearml import Task # 1. ClearML 임포트 model = YOLO("./weights/yolo26m.pt") # Medium 크기 가중치 자동 다운로드 -def init_acai_task(output): - task = Task.init( - project_name="Normal_Object_Detection", - task_name="model-yolo26-human" - ) - - result_data = {"output": output, "status": "PASS"} - task.upload_artifact(name="final_result", artifact_object=result_data) - - def xyxy_to_xywh(box: dict) -> dict: x1 = math.floor(box["x1"]) y1 = math.floor(box["y1"]) @@ -57,7 +47,20 @@ def main(image_path: str): } print(json.dumps(output, indent=2, ensure_ascii=False)) - init_acai_task(output) + return output + + + + + + +task = Task.init( + project_name="Normal_Object_Detection", + task_name="model-yolo26-human" +) +def init_acai_task(output): + result_data = {"output": output, "status": "PASS"} + task.upload_artifact(name="final_result", artifact_object=result_data) if __name__ == "__main__": parser = argparse.ArgumentParser() @@ -77,4 +80,6 @@ if __name__ == "__main__": f.write(image_data) image_path = "image.jpg" - main(image_path) \ No newline at end of file + output = main(image_path) + + init_acai_task(output) \ No newline at end of file