์ฝ˜ํ…์ธ ๋กœ ๊ฑด๋„ˆ๋›ฐ๊ธฐ

A Step-by-Step Guide to Training YOLO11 Models with IBM Watsonx

์˜ค๋Š˜๋‚  ํ™•์žฅ ๊ฐ€๋Šฅํ•œ ์ปดํ“จํ„ฐ ๋น„์ „ ์†”๋ฃจ์…˜์€ ์ ์  ๋” ๋ณดํŽธํ™”๋˜๊ณ  ์žˆ์œผ๋ฉฐ ์‹œ๊ฐ์  ๋ฐ์ดํ„ฐ๋ฅผ ์ฒ˜๋ฆฌํ•˜๋Š” ๋ฐฉ์‹์„ ๋ณ€ํ™”์‹œํ‚ค๊ณ  ์žˆ์Šต๋‹ˆ๋‹ค. ์ข‹์€ ์˜ˆ๋กœ AI ๋ชจ๋ธ์˜ ๊ฐœ๋ฐœ, ๋ฐฐํฌ, ๊ด€๋ฆฌ๋ฅผ ๊ฐ„์†Œํ™”ํ•˜๋Š” ๊ณ ๊ธ‰ AI ๋ฐ ๋ฐ์ดํ„ฐ ํ”Œ๋žซํผ์ธ IBM Watsonx๋ฅผ ๋“ค ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. ์ „์ฒด AI ๋ผ์ดํ”„์‚ฌ์ดํด์„ ์œ„ํ•œ ์™„๋ฒฝํ•œ ์ œํ’ˆ๊ตฐ์„ ์ œ๊ณตํ•˜๋ฉฐ IBM ํด๋ผ์šฐ๋“œ ์„œ๋น„์Šค์™€์˜ ์›ํ™œํ•œ ํ†ตํ•ฉ์„ ์ œ๊ณตํ•ฉ๋‹ˆ๋‹ค.

You can train Ultralytics YOLO11 models using IBM Watsonx. It's a good option for enterprises interested in efficient model training, fine-tuning for specific tasks, and improving model performance with robust tools and a user-friendly setup. In this guide, we'll walk you through the process of training YOLO11 with IBM Watsonx, covering everything from setting up your environment to evaluating your trained models. Let's get started!

IBM ์™“์Šจx๋ž€?

Watsonx is IBM's cloud-based platform designed for commercial generative AI and scientific data. IBM Watsonx's three components - watsonx.ai, watsonx.data, and watsonx.governance - come together to create an end-to-end, trustworthy AI platform that can accelerate AI projects aimed at solving business problems. It provides powerful tools for building, training, and deploying machine learning models and makes it easy to connect with various data sources.

IBM ์™“์Šจx ๊ฐœ์š”

Its user-friendly interface and collaborative capabilities streamline the development process and help with efficient model management and deployment. Whether for computer vision, predictive analytics, natural language processing, or other AI applications, IBM Watsonx provides the tools and support needed to drive innovation.

IBM ์™“์Šจx์˜ ์ฃผ์š” ๊ธฐ๋Šฅ

IBM ์™“์Šจx๋Š” ์„ธ ๊ฐ€์ง€ ์ฃผ์š” ๊ตฌ์„ฑ ์š”์†Œ์ธ watsonx.ai, watsonx.data, watsonx.governance๋กœ ์ด๋ฃจ์–ด์ ธ ์žˆ์Šต๋‹ˆ๋‹ค. ๊ฐ ๊ตฌ์„ฑ ์š”์†Œ๋Š” AI ๋ฐ ๋ฐ์ดํ„ฐ ๊ด€๋ฆฌ์˜ ๋‹ค์–‘ํ•œ ์ธก๋ฉด์„ ์ถฉ์กฑํ•˜๋Š” ๊ธฐ๋Šฅ์„ ์ œ๊ณตํ•ฉ๋‹ˆ๋‹ค. ์ž์„ธํžˆ ์‚ดํŽด๋ณด๊ฒ ์Šต๋‹ˆ๋‹ค.

์™“์Šจx.ai

Watsonx.ai๋Š” AI ๊ฐœ๋ฐœ์„ ์œ„ํ•œ ๊ฐ•๋ ฅํ•œ ๋„๊ตฌ๋ฅผ ์ œ๊ณตํ•˜๋ฉฐ IBM์ด ์ง€์›ํ•˜๋Š” ๋งž์ถคํ˜• ๋ชจ๋ธ, Llama 3์™€ ๊ฐ™์€ ํƒ€์‚ฌ ๋ชจ๋ธ, IBM์˜ ์ž์ฒด Granite ๋ชจ๋ธ์— ๋Œ€ํ•œ ์•ก์„ธ์Šค๋ฅผ ์ œ๊ณตํ•ฉ๋‹ˆ๋‹ค. ์—ฌ๊ธฐ์—๋Š” AI ํ”„๋กฌํ”„ํŠธ ์‹คํ—˜์„ ์œ„ํ•œ ํ”„๋กฌํ”„ํŠธ ๋žฉ, ๋ ˆ์ด๋ธ”์ด ์ง€์ •๋œ ๋ฐ์ดํ„ฐ๋กœ ๋ชจ๋ธ ์„ฑ๋Šฅ์„ ๊ฐœ์„ ํ•˜๊ธฐ ์œ„ํ•œ ํŠœ๋‹ ์ŠคํŠœ๋””์˜ค, ์ƒ์„ฑํ˜• AI ์• ํ”Œ๋ฆฌ์ผ€์ด์…˜ ๊ฐœ๋ฐœ์„ ๊ฐ„์†Œํ™”ํ•˜๋Š” ํ”Œ๋กœ์šฐ ์—”์ง„์ด ํฌํ•จ๋˜์–ด ์žˆ์Šต๋‹ˆ๋‹ค. ๋˜ํ•œ AI ๋ชจ๋ธ ๋ผ์ดํ”„์‚ฌ์ดํด์„ ์ž๋™ํ™”ํ•˜๊ณ  ๋‹ค์–‘ํ•œ API ๋ฐ ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ์— ์—ฐ๊ฒฐํ•  ์ˆ˜ ์žˆ๋Š” ํฌ๊ด„์ ์ธ ๋„๊ตฌ๋ฅผ ์ œ๊ณตํ•ฉ๋‹ˆ๋‹ค.

์™“์Šจx.๋ฐ์ดํ„ฐ

์™“์Šจx.data๋Š” IBM ์Šคํ† ๋ฆฌ์ง€ ํ“จ์ „ HCI ํ†ตํ•ฉ์„ ํ†ตํ•ด ํด๋ผ์šฐ๋“œ ๋ฐ ์˜จํ”„๋ ˆ๋ฏธ์Šค ๋ฐฐํฌ๋ฅผ ๋ชจ๋‘ ์ง€์›ํ•ฉ๋‹ˆ๋‹ค. ์‚ฌ์šฉ์ž ์นœํ™”์ ์ธ ์ฝ˜์†”์„ ํ†ตํ•ด ์—ฌ๋Ÿฌ ํ™˜๊ฒฝ์˜ ๋ฐ์ดํ„ฐ์— ์ค‘์•™ ์ง‘์ค‘์‹์œผ๋กœ ์•ก์„ธ์Šคํ•  ์ˆ˜ ์žˆ์œผ๋ฉฐ, ์ผ๋ฐ˜์ ์ธ SQL๋กœ ๋ฐ์ดํ„ฐ๋ฅผ ์‰ฝ๊ฒŒ ํƒ์ƒ‰ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. Presto ๋ฐ Spark์™€ ๊ฐ™์€ ํšจ์œจ์ ์ธ ์ฟผ๋ฆฌ ์—”์ง„์œผ๋กœ ์›Œํฌ๋กœ๋“œ๋ฅผ ์ตœ์ ํ™”ํ•˜๊ณ , AI ๊ธฐ๋ฐ˜ ์‹œ๋งจํ‹ฑ ๊ณ„์ธต์œผ๋กœ ๋ฐ์ดํ„ฐ ์ธ์‚ฌ์ดํŠธ๋ฅผ ๊ฐ€์†ํ™”ํ•˜๋ฉฐ, AI ๊ด€๋ จ์„ฑ์„ ์œ„ํ•œ ๋ฒกํ„ฐ ๋ฐ์ดํ„ฐ๋ฒ ์ด์Šค๋ฅผ ํฌํ•จํ•˜๊ณ , ๋ถ„์„ ๋ฐ AI ๋ฐ์ดํ„ฐ๋ฅผ ์‰ฝ๊ฒŒ ๊ณต์œ ํ•  ์ˆ˜ ์žˆ๋„๋ก ๊ฐœ๋ฐฉํ˜• ๋ฐ์ดํ„ฐ ํ˜•์‹์„ ์ง€์›ํ•ฉ๋‹ˆ๋‹ค.

์™“์Šจx.๊ฑฐ๋ฒ„๋„Œ์Šค

์™“์Šจx.๊ฑฐ๋ฒ„๋„Œ์Šค๋Š” ๊ทœ์ • ๋ณ€๊ฒฝ ์‚ฌํ•ญ์„ ์ž๋™์œผ๋กœ ์‹๋ณ„ํ•˜๊ณ  ์ •์ฑ…์„ ์‹œํ–‰ํ•˜์—ฌ ๊ทœ์ • ์ค€์ˆ˜๋ฅผ ๋” ์‰ฝ๊ฒŒ ๋งŒ๋“ญ๋‹ˆ๋‹ค. ์š”๊ฑด์„ ๋‚ด๋ถ€ ์œ„ํ—˜ ๋ฐ์ดํ„ฐ์— ์—ฐ๊ฒฐํ•˜๊ณ  ์ตœ์‹  AI ํŒฉํŠธ์‹œํŠธ๋ฅผ ์ œ๊ณตํ•ฉ๋‹ˆ๋‹ค. ์ด ํ”Œ๋žซํผ์€ ํŽธํ–ฅ์„ฑ ๋ฐ ํŽธํ–ฅ์„ฑ๊ณผ ๊ฐ™์€ ๋ฌธ์ œ๋ฅผ ๊ฐ์ง€ํ•˜๋Š” ๊ฒฝ๊ณ  ๋ฐ ๋„๊ตฌ๋ฅผ ํ†ตํ•ด ์œ„ํ—˜์„ ๊ด€๋ฆฌํ•  ์ˆ˜ ์žˆ๋„๋ก ์ง€์›ํ•ฉ๋‹ˆ๋‹ค. ๋˜ํ•œ AI ๋ผ์ดํ”„์‚ฌ์ดํด์˜ ๋ชจ๋‹ˆํ„ฐ๋ง ๋ฐ ๋ฌธ์„œํ™”๋ฅผ ์ž๋™ํ™”ํ•˜๊ณ , ๋ชจ๋ธ ์ธ๋ฒคํ† ๋ฆฌ๋กœ AI ๊ฐœ๋ฐœ์„ ์ฒด๊ณ„ํ™”ํ•˜๋ฉฐ, ์‚ฌ์šฉ์ž ์นœํ™”์ ์ธ ๋Œ€์‹œ๋ณด๋“œ ๋ฐ ๋ณด๊ณ  ๋„๊ตฌ๋กœ ํ˜‘์—…์„ ๊ฐ•ํ™”ํ•ฉ๋‹ˆ๋‹ค.

How to Train YOLO11 Using IBM Watsonx

You can use IBM Watsonx to accelerate your YOLO11 model training workflow.

์ „์ œ ์กฐ๊ฑด

watsonx.ai ํ”„๋กœ์ ํŠธ๋ฅผ ์ƒ์„ฑํ•˜๋ ค๋ฉด IBM Cloud ๊ณ„์ •์ด ํ•„์š”ํ•˜๋ฉฐ, ๋ฐ์ดํ„ฐ ์„ธํŠธ๋ฅผ ๋กœ๋“œํ•˜๋ ค๋ฉด Kaggle ๊ณ„์ •๋„ ํ•„์š”ํ•ฉ๋‹ˆ๋‹ค.

1๋‹จ๊ณ„: ํ™˜๊ฒฝ ์„ค์ •

๋จผ์ €, ์ฃผํ”ผํ„ฐ ๋…ธํŠธ๋ถ์„ ์‚ฌ์šฉํ•˜๋ ค๋ฉด IBM ๊ณ„์ •์„ ์„ค์ •ํ•ด์•ผ ํ•ฉ๋‹ˆ๋‹ค. IBM ํด๋ผ์šฐ๋“œ ๊ณ„์ •์„ ์‚ฌ์šฉํ•˜์—ฌ watsonx.ai์— ๋กœ๊ทธ์ธํ•ฉ๋‹ˆ๋‹ค.

๊ทธ๋Ÿฐ ๋‹ค์Œ watsonx.ai ํ”„๋กœ์ ํŠธ์™€ Jupyter ๋…ธํŠธ๋ถ์„ ๋งŒ๋“ญ๋‹ˆ๋‹ค.

์ด๋ ‡๊ฒŒ ํ•˜๋ฉด ๋ฐ์ดํ„ฐ ์„ธํŠธ๋ฅผ ๋กœ๋“œํ•  ์ˆ˜ ์žˆ๋Š” ๋…ธํŠธ๋ถ ํ™˜๊ฒฝ์ด ์—ด๋ฆฝ๋‹ˆ๋‹ค. ์ด ํŠœํ† ๋ฆฌ์–ผ์˜ ์ฝ”๋“œ๋ฅผ ์‚ฌ์šฉํ•˜์—ฌ ๊ฐ„๋‹จํ•œ ๊ฐ์ฒด ๊ฐ์ง€ ๋ชจ๋ธ ํ•™์Šต ์ž‘์—…์„ ์ˆ˜ํ–‰ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

2๋‹จ๊ณ„: ๊ด€๋ จ ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ ์„ค์น˜ ๋ฐ ๊ฐ€์ ธ์˜ค๊ธฐ

๊ทธ๋Ÿฐ ๋‹ค์Œ ํ•„์š”ํ•œ Python ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ๋ฅผ ์„ค์น˜ํ•˜๊ณ  ๊ฐ€์ ธ์˜ฌ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

์„ค์น˜

# Install the required packages
pip install torch torchvision torchaudio
pip install opencv-contrib-python-headless
pip install ultralytics==8.0.196

For detailed instructions and best practices related to the installation process, check our Ultralytics Installation guide. While installing the required packages for YOLO11, if you encounter any difficulties, consult our Common Issues guide for solutions and tips.

๊ทธ๋Ÿฐ ๋‹ค์Œ ํ•„์š”ํ•œ ํŒจํ‚ค์ง€๋ฅผ ๊ฐ€์ ธ์˜ฌ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

๊ด€๋ จ ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ ๊ฐ€์ ธ์˜ค๊ธฐ

# Import ultralytics
import ultralytics

ultralytics.checks()

# Import packages to retrieve and display image files

3๋‹จ๊ณ„: ๋ฐ์ดํ„ฐ ๋กœ๋“œ

For this tutorial, we will use a marine litter dataset available on Kaggle. With this dataset, we will custom-train a YOLO11 model to detect and classify litter and biological objects in underwater images.

Kaggle API๋ฅผ ์‚ฌ์šฉํ•ด ๋ฐ์ดํ„ฐ ์„ธํŠธ๋ฅผ ๋…ธํŠธ๋ถ์— ์ง์ ‘ ๋กœ๋“œํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. ๋จผ์ €, ๋ฌด๋ฃŒ Kaggle ๊ณ„์ •์„ ๋งŒ๋“œ์„ธ์š”. ๊ณ„์ •์„ ๋งŒ๋“  ํ›„์—๋Š” API ํ‚ค๋ฅผ ์ƒ์„ฑํ•ด์•ผ ํ•ฉ๋‹ˆ๋‹ค. ํ‚ค๋ฅผ ์ƒ์„ฑํ•˜๋Š” ๋ฐฉ๋ฒ•์€ "API ์ž๊ฒฉ ์ฆ๋ช…" ์„น์…˜ ์•„๋ž˜์˜ Kaggle API ์„ค๋ช…์„œ์—์„œ ์ฐพ์„ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

Kaggle ์‚ฌ์šฉ์ž ์ด๋ฆ„๊ณผ API ํ‚ค๋ฅผ ๋ณต์‚ฌํ•˜์—ฌ ๋‹ค์Œ ์ฝ”๋“œ์— ๋ถ™์—ฌ๋„ฃ์Šต๋‹ˆ๋‹ค. ๊ทธ๋Ÿฐ ๋‹ค์Œ ์ฝ”๋“œ๋ฅผ ์‹คํ–‰ํ•˜์—ฌ API๋ฅผ ์„ค์น˜ํ•˜๊ณ  ๋ฐ์ดํ„ฐ ์„ธํŠธ๋ฅผ Watsonx์— ๋กœ๋“œํ•ฉ๋‹ˆ๋‹ค.

์„ค์น˜

# Install kaggle
pip install kaggle

Kaggle์„ ์„ค์น˜ํ•œ ํ›„ ๋ฐ์ดํ„ฐ ์„ธํŠธ๋ฅผ Watsonx์— ๋กœ๋“œํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

๋ฐ์ดํ„ฐ ๋กœ๋“œ

# Replace "username" string with your username
os.environ["KAGGLE_USERNAME"] = "username"
# Replace "apiKey" string with your key
os.environ["KAGGLE_KEY"] = "apiKey"

# Load dataset
os.system("kaggle datasets download atiqishrak/trash-dataset-icra19 --unzip")

# Store working directory path as work_dir
work_dir = os.getcwd()

# Print work_dir path
print(os.getcwd())

# Print work_dir contents
print(os.listdir(f"{work_dir}"))

# Print trash_ICRA19 subdirectory contents
print(os.listdir(f"{work_dir}/trash_ICRA19"))

๋ฐ์ดํ„ฐ ์„ธํŠธ๋ฅผ ๋กœ๋“œํ•œ ํ›„, ์ž‘์—… ๋””๋ ‰ํ„ฐ๋ฆฌ๋ฅผ ์ธ์‡„ํ•˜์—ฌ ์ €์žฅํ–ˆ์Šต๋‹ˆ๋‹ค. ๋˜ํ•œ ์ž‘์—… ๋””๋ ‰ํ„ฐ๋ฆฌ์˜ ๋‚ด์šฉ์„ ์ธ์‡„ํ•˜์—ฌ "trash_ICRA19" ๋ฐ์ดํ„ฐ ์ง‘ํ•ฉ์ด ์ œ๋Œ€๋กœ ๋กœ๋“œ๋˜์—ˆ๋Š”์ง€ ํ™•์ธํ–ˆ์Šต๋‹ˆ๋‹ค.

๋””๋ ‰ํ„ฐ๋ฆฌ ๋‚ด์šฉ ์ค‘ "trash_ICRA19"๊ฐ€ ํ‘œ์‹œ๋˜๋ฉด ์„ฑ๊ณต์ ์œผ๋กœ ๋กœ๋“œ๋œ ๊ฒƒ์ž…๋‹ˆ๋‹ค. ๋‹ค์Œ ์„ธ ๊ฐœ์˜ ํŒŒ์ผ/ํด๋”๊ฐ€ ํ‘œ์‹œ๋˜์–ด์•ผ ํ•ฉ๋‹ˆ๋‹ค. config.yaml ํŒŒ์ผ, a videos_for_testing ๋””๋ ‰ํ„ฐ๋ฆฌ์™€ dataset ๋””๋ ‰ํ† ๋ฆฌ์— ์ €์žฅํ•ฉ๋‹ˆ๋‹ค. ์šฐ๋ฆฌ๋Š” videos_for_testing ๋””๋ ‰ํ† ๋ฆฌ์— ์žˆ์œผ๋ฏ€๋กœ ์ž์œ ๋กญ๊ฒŒ ์‚ญ์ œํ•˜์„ธ์š”.

We will use the config.yaml file and the contents of the dataset directory to train our object detection model. Here is a sample image from our marine litter data set.

๋ฐ”์šด๋”ฉ ๋ฐ•์Šค๊ฐ€ ์žˆ๋Š” ํ•ด์–‘ ์“ฐ๋ ˆ๊ธฐ

4๋‹จ๊ณ„: ๋ฐ์ดํ„ฐ ์‚ฌ์ „ ์ฒ˜๋ฆฌ

๋‹คํ–‰ํžˆ๋„ ํ•ด์–‘ ์“ฐ๋ ˆ๊ธฐ ๋ฐ์ดํ„ฐ ์„ธํŠธ์˜ ๋ชจ๋“  ๋ผ๋ฒจ์€ ์ด๋ฏธ YOLO .txt ํŒŒ์ผ๋กœ ํฌ๋งท๋˜์–ด ์žˆ์Šต๋‹ˆ๋‹ค. ํ•˜์ง€๋งŒ ๋ชจ๋ธ์ด ์ด๋ฏธ์ง€์™€ ๋ ˆ์ด๋ธ”์„ ์ฒ˜๋ฆฌํ•  ์ˆ˜ ์žˆ๋„๋ก ์ด๋ฏธ์ง€์™€ ๋ ˆ์ด๋ธ” ๋””๋ ‰ํ„ฐ๋ฆฌ์˜ ๊ตฌ์กฐ๋ฅผ ์žฌ์ •๋ ฌํ•ด์•ผ ํ•ฉ๋‹ˆ๋‹ค. ํ˜„์žฌ ๋กœ๋“œ๋œ ๋ฐ์ดํ„ฐ ์„ธํŠธ ๋””๋ ‰ํ„ฐ๋ฆฌ๋Š” ์ด ๊ตฌ์กฐ๋ฅผ ๋”ฐ๋ฆ…๋‹ˆ๋‹ค:

๋กœ๋“œ๋œ ๋ฐ์ดํ„ฐ ์„ธํŠธ ๋””๋ ‰ํ† ๋ฆฌ

ํ•˜์ง€๋งŒ YOLO ๋ชจ๋ธ์€ ๊ธฐ๋ณธ์ ์œผ๋กœ train/val/test ๋ถ„ํ•  ๋‚ด์˜ ํ•˜์œ„ ๋””๋ ‰ํ„ฐ๋ฆฌ์— ๋ณ„๋„์˜ ์ด๋ฏธ์ง€์™€ ๋ ˆ์ด๋ธ”์ด ํ•„์š”ํ•ฉ๋‹ˆ๋‹ค. ๋””๋ ‰ํ„ฐ๋ฆฌ๋ฅผ ๋‹ค์Œ๊ณผ ๊ฐ™์€ ๊ตฌ์กฐ๋กœ ์žฌ๊ตฌ์„ฑํ•ด์•ผ ํ•ฉ๋‹ˆ๋‹ค:

Yolo ๋””๋ ‰ํ† ๋ฆฌ ๊ตฌ์กฐ

๋ฐ์ดํ„ฐ ์ง‘ํ•ฉ ๋””๋ ‰ํ„ฐ๋ฆฌ๋ฅผ ์žฌ๊ตฌ์„ฑํ•˜๋ ค๋ฉด ๋‹ค์Œ ์Šคํฌ๋ฆฝํŠธ๋ฅผ ์‹คํ–‰ํ•˜๋ฉด ๋ฉ๋‹ˆ๋‹ค:

๋ฐ์ดํ„ฐ ์ „์ฒ˜๋ฆฌ

# Function to reorganize dir
def organize_files(directory):
    for subdir in ["train", "test", "val"]:
        subdir_path = os.path.join(directory, subdir)
        if not os.path.exists(subdir_path):
            continue

        images_dir = os.path.join(subdir_path, "images")
        labels_dir = os.path.join(subdir_path, "labels")

        # Create image and label subdirs if non-existent
        os.makedirs(images_dir, exist_ok=True)
        os.makedirs(labels_dir, exist_ok=True)

        # Move images and labels to respective subdirs
        for filename in os.listdir(subdir_path):
            if filename.endswith(".txt"):
                shutil.move(os.path.join(subdir_path, filename), os.path.join(labels_dir, filename))
            elif filename.endswith(".jpg") or filename.endswith(".png") or filename.endswith(".jpeg"):
                shutil.move(os.path.join(subdir_path, filename), os.path.join(images_dir, filename))
            # Delete .xml files
            elif filename.endswith(".xml"):
                os.remove(os.path.join(subdir_path, filename))


if __name__ == "__main__":
    directory = f"{work_dir}/trash_ICRA19/dataset"
    organize_files(directory)

๋‹ค์Œ์œผ๋กœ ๋ฐ์ดํ„ฐ ์ง‘ํ•ฉ์— ๋Œ€ํ•œ .yaml ํŒŒ์ผ์„ ์ˆ˜์ •ํ•ด์•ผ ํ•ฉ๋‹ˆ๋‹ค. ๋‹ค์Œ์€ .yaml ํŒŒ์ผ์— ์‚ฌ์šฉํ•  ์„ค์ •์ž…๋‹ˆ๋‹ค. ํด๋ž˜์Šค ID ๋ฒˆํ˜ธ๋Š” 0๋ถ€ํ„ฐ ์‹œ์ž‘ํ•ฉ๋‹ˆ๋‹ค:

path: /path/to/dataset/directory # root directory for dataset
train: train/images # train images subdirectory
val: train/images # validation images subdirectory
test: test/images # test images subdirectory

# Classes
names:
    0: plastic
    1: bio
    2: rov

๋‹ค์Œ ์Šคํฌ๋ฆฝํŠธ๋ฅผ ์‹คํ–‰ํ•˜์—ฌ config.yaml์˜ ํ˜„์žฌ ๋‚ด์šฉ์„ ์‚ญ์ œํ•˜๊ณ  ์ƒˆ ๋ฐ์ดํ„ฐ ์„ธํŠธ ๋””๋ ‰ํ„ฐ๋ฆฌ ๊ตฌ์กฐ๋ฅผ ๋ฐ˜์˜ํ•˜๋Š” ์œ„์˜ ๋‚ด์šฉ์œผ๋กœ ๋Œ€์ฒดํ•ฉ๋‹ˆ๋‹ค. 4๋ฒˆ์งธ ์ค„์˜ ๋ฃจํŠธ ๋””๋ ‰ํ„ฐ๋ฆฌ ๊ฒฝ๋กœ์˜ work_dir ๋ถ€๋ถ„์„ ์•ž์„œ ๊ฒ€์ƒ‰ํ•œ ์ž์‹ ์˜ ์ž‘์—… ๋””๋ ‰ํ„ฐ๋ฆฌ ๊ฒฝ๋กœ๋กœ ๋ฐ”๊พธ์–ด์•ผ ํ•ฉ๋‹ˆ๋‹ค. train, val, test ํ•˜์œ„ ๋””๋ ‰ํ„ฐ๋ฆฌ ์ •์˜๋Š” ๊ทธ๋Œ€๋กœ ๋‘ก๋‹ˆ๋‹ค. ๋˜ํ•œ ์ฝ”๋“œ 23์ค„์˜ {work_dir}๋„ ๋ณ€๊ฒฝํ•˜์ง€ ๋งˆ์„ธ์š”.

.yaml ํŒŒ์ผ ํŽธ์ง‘

# Contents of new confg.yaml file
def update_yaml_file(file_path):
    data = {
        "path": "work_dir/trash_ICRA19/dataset",
        "train": "train/images",
        "val": "train/images",
        "test": "test/images",
        "names": {0: "plastic", 1: "bio", 2: "rov"},
    }

    # Ensures the "names" list appears after the sub/directories
    names_data = data.pop("names")
    with open(file_path, "w") as yaml_file:
        yaml.dump(data, yaml_file)
        yaml_file.write("\n")
        yaml.dump({"names": names_data}, yaml_file)


if __name__ == "__main__":
    file_path = f"{work_dir}/trash_ICRA19/config.yaml"  # .yaml file path
    update_yaml_file(file_path)
    print(f"{file_path} updated successfully.")

Step 5: Train the YOLO11 model

Run the following command-line code to fine tune a pretrained default YOLO11 model.

Train the YOLO11 model

!yolo task=detect mode=train data={work_dir}/trash_ICRA19/config.yaml model=yolo11n.pt epochs=2 batch=32 lr0=.04 plots=True

๋‹ค์Œ์€ ๋ชจ๋ธ ํ•™์Šต ๋ช…๋ น์˜ ๋งค๊ฐœ ๋ณ€์ˆ˜๋ฅผ ์ž์„ธํžˆ ์‚ดํŽด๋ณด๋Š” ๋‚ด์šฉ์ž…๋‹ˆ๋‹ค:

  • task: It specifies the computer vision task for which you are using the specified YOLO model and data set.
  • ๋ชจ๋“œ: ์ง€์ •๋œ ๋ชจ๋ธ๊ณผ ๋ฐ์ดํ„ฐ๋ฅผ ๋กœ๋“œํ•˜๋Š” ๋ชฉ์ ์„ ๋‚˜ํƒ€๋ƒ…๋‹ˆ๋‹ค. ๋ชจ๋ธ์„ ํ•™์Šต ์ค‘์ด๋ฏ€๋กœ "ํ•™์Šต"์œผ๋กœ ์„ค์ •๋˜์–ด ์žˆ์Šต๋‹ˆ๋‹ค. ๋‚˜์ค‘์— ๋ชจ๋ธ์˜ ์„ฑ๋Šฅ์„ ํ…Œ์ŠคํŠธํ•  ๋•Œ๋Š” "์˜ˆ์ธก"์œผ๋กœ ์„ค์ •ํ•ฉ๋‹ˆ๋‹ค.
  • epochs: This delimits the number of times YOLO11 will pass through our entire data set.
  • batch: The numerical value stipulates the training batch sizes. Batches are the number of images a model processes before it updates its parameters.
  • lr0: Specifies the model's initial learning rate.
  • ํ”Œ๋กฏ: YOLO ์œผ๋กœ ์ „๋‹ฌํ•˜์—ฌ ๋ชจ๋ธ์˜ ํ•™์Šต ๋ฐ ํ‰๊ฐ€ ๋ฉ”ํŠธ๋ฆญ์˜ ํ”Œ๋กฏ์„ ์ƒ์„ฑํ•˜๊ณ  ์ €์žฅํ•ฉ๋‹ˆ๋‹ค.

For a detailed understanding of the model training process and best practices, refer to the YOLO11 Model Training guide. This guide will help you get the most out of your experiments and ensure you're using YOLO11 effectively.

6๋‹จ๊ณ„: ๋ชจ๋ธ ํ…Œ์ŠคํŠธ

์ด์ œ ์ถ”๋ก ์„ ์‹คํ–‰ํ•˜์—ฌ ๋ฏธ์„ธ ์กฐ์ •๋œ ๋ชจ๋ธ์˜ ์„ฑ๋Šฅ์„ ํ…Œ์ŠคํŠธํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค:

Test the YOLO11 model

!yolo task=detect mode=predict source={work_dir}/trash_ICRA19/dataset/test/images model={work_dir}/runs/detect/train/weights/best.pt conf=0.5 iou=.5 save=True save_txt=True

This brief script generates predicted labels for each image in our test set, as well as new output image files that overlay the predicted bounding box atop the original image.

๊ฐ ์ด๋ฏธ์ง€์— ๋Œ€ํ•œ ์˜ˆ์ƒ .txt ๋ ˆ์ด๋ธ”์€ ๋‹ค์Œ์„ ํ†ตํ•ด ์ €์žฅ๋ฉ๋‹ˆ๋‹ค. save_txt=True ์ธ์ˆ˜๋ฅผ ํ†ตํ•ด ์ƒ์„ฑ๋˜๋ฉฐ, ๋ฐ”์šด๋”ฉ ๋ฐ•์Šค ์˜ค๋ฒ„๋ ˆ์ด๊ฐ€ ์žˆ๋Š” ์ถœ๋ ฅ ์ด๋ฏธ์ง€๋Š” save=True ์ธ์ˆ˜์ž…๋‹ˆ๋‹ค.
๋งค๊ฐœ ๋ณ€์ˆ˜ conf=0.5 ์€ ์‹ ๋ขฐ ์ˆ˜์ค€์ด 50% ๋ฏธ๋งŒ์ธ ๋ชจ๋“  ์˜ˆ์ธก์„ ๋ฌด์‹œํ•˜๋„๋ก ๋ชจ๋ธ์— ์•Œ๋ฆฝ๋‹ˆ๋‹ค.

๋งˆ์ง€๋ง‰์œผ๋กœ iou=.5 ๋Š” ๋ชจ๋ธ์ด ๋™์ผํ•œ ํด๋ž˜์Šค์˜ ์ƒ์ž๊ฐ€ 50% ์ด์ƒ ๊ฒน์น˜๋Š” ๊ฒฝ์šฐ ๋ฌด์‹œํ•˜๋„๋ก ์ง€์‹œํ•ฉ๋‹ˆ๋‹ค. ๋™์ผํ•œ ์˜ค๋ธŒ์ ํŠธ์— ๋Œ€ํ•ด ์ƒ์„ฑ๋˜๋Š” ์ž ์žฌ์ ์ธ ์ค‘๋ณต ์ƒ์ž๋ฅผ ์ค„์ด๋Š” ๋ฐ ๋„์›€์ด ๋ฉ๋‹ˆ๋‹ค.
๋ฅผ ์‚ฌ์šฉํ•˜๋ฉด ์˜ˆ์ธก๋œ ๋ฐ”์šด๋”ฉ ๋ฐ•์Šค ์˜ค๋ฒ„๋ ˆ์ด๊ฐ€ ์žˆ๋Š” ์ด๋ฏธ์ง€๋ฅผ ๋กœ๋“œํ•˜์—ฌ ๋ช‡ ๊ฐœ์˜ ์ด๋ฏธ์ง€์—์„œ ๋ชจ๋ธ์ด ์–ด๋–ป๊ฒŒ ์ž‘๋™ํ•˜๋Š”์ง€ ํ™•์ธํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

์˜ˆ์ธก ํ‘œ์‹œ

# Show the first ten images from the preceding prediction task
for pred_dir in glob.glob(f"{work_dir}/runs/detect/predict/*.jpg")[:10]:
    img = Image.open(pred_dir)
    display(img)

์œ„์˜ ์ฝ”๋“œ๋Š” ํ…Œ์ŠคํŠธ ์„ธํŠธ์˜ ์ด๋ฏธ์ง€ 10๊ฐœ๋ฅผ ํด๋ž˜์Šค ์ด๋ฆ„ ๋ ˆ์ด๋ธ” ๋ฐ ์‹ ๋ขฐ ์ˆ˜์ค€๊ณผ ํ•จ๊ป˜ ์˜ˆ์ธก๋œ ๋ฐ”์šด๋”ฉ ๋ฐ•์Šค์™€ ํ•จ๊ป˜ ํ‘œ์‹œํ•ฉ๋‹ˆ๋‹ค.

7๋‹จ๊ณ„: ๋ชจ๋ธ ํ‰๊ฐ€

We can produce visualizations of the model's precision and recall for each class. These visualizations are saved in the home directory, under the train folder. The precision score is displayed in the P_curve.png:

์ •๋ฐ€๋„ ์‹ ๋ขฐ๋„ ๊ณก์„ 

The graph shows an exponential increase in precision as the model's confidence level for predictions increases. However, the model precision has not yet leveled out at a certain confidence level after two epochs.

The recall graph (R_curve.png) displays an inverse trend:

๋ฆฌ์ฝœ ์‹ ๋ขฐ๋„ ๊ณก์„ 

์ •ํ™•๋„์™€ ๋‹ฌ๋ฆฌ ์ •ํ™•๋„๋Š” ๋ฐ˜๋Œ€ ๋ฐฉํ–ฅ์œผ๋กœ ์›€์ง์ด๋ฉฐ, ์‹ ๋ขฐ๋„๊ฐ€ ๋‚ฎ์€ ์ธ์Šคํ„ด์Šค์—์„œ๋Š” ์ •ํ™•๋„๊ฐ€ ๋†’์•„์ง€๊ณ  ์‹ ๋ขฐ๋„๊ฐ€ ๋†’์€ ์ธ์Šคํ„ด์Šค์—์„œ๋Š” ์ •ํ™•๋„๊ฐ€ ๋‚ฎ์•„์ง‘๋‹ˆ๋‹ค. ์ด๋Š” ๋ถ„๋ฅ˜ ๋ชจ๋ธ์—์„œ ์ •ํ™•๋„์™€ ์žฌ์ธ์šฉ๋ฅ ์˜ ์ƒ์ถฉ ๊ด€๊ณ„๋ฅผ ๋ณด์—ฌ์ฃผ๋Š” ์ ์ ˆํ•œ ์˜ˆ์ž…๋‹ˆ๋‹ค.

Step 8: Calculating Intersection Over Union

You can measure the prediction accuracy by calculating the IoU between a predicted bounding box and a ground truth bounding box for the same object. Check out IBM's tutorial on training YOLO11 for more details.

์š”์•ฝ

We explored IBM Watsonx key features, and how to train a YOLO11 model using IBM Watsonx. We also saw how IBM Watsonx can enhance your AI workflows with advanced tools for model building, data management, and compliance.

์‚ฌ์šฉ๋ฒ•์— ๋Œ€ํ•œ ์ž์„ธํ•œ ๋‚ด์šฉ์€ IBM ์™“์Šจx ๊ณต์‹ ๋ฌธ์„œ๋ฅผ ์ฐธ์กฐํ•˜์„ธ์š”.

๋˜ํ•œ Ultralytics ํ†ตํ•ฉ ๊ฐ€์ด๋“œ ํŽ˜์ด์ง€์—์„œ ๋‹ค์–‘ํ•œ ํฅ๋ฏธ๋กœ์šด ํ†ตํ•ฉ ๊ธฐ๋Šฅ์— ๋Œ€ํ•ด ์ž์„ธํžˆ ์•Œ์•„๋ณด์„ธ์š”.

์ž์ฃผ ๋ฌป๋Š” ์งˆ๋ฌธ

How do I train a YOLO11 model using IBM Watsonx?

To train a YOLO11 model using IBM Watsonx, follow these steps:

  1. ํ™˜๊ฒฝ ์„ค์ •ํ•˜๊ธฐ: IBM Cloud ๊ณ„์ •์„ ์ƒ์„ฑํ•˜๊ณ  Watsonx.ai ํ”„๋กœ์ ํŠธ๋ฅผ ์„ค์ •ํ•ฉ๋‹ˆ๋‹ค. ์ฝ”๋”ฉ ํ™˜๊ฒฝ์— Jupyter Notebook์„ ์‚ฌ์šฉํ•ฉ๋‹ˆ๋‹ค.
  2. ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ ์„ค์น˜: ๋‹ค์Œ๊ณผ ๊ฐ™์€ ํ•„์š”ํ•œ ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ ์„ค์น˜ torch, opencv๋ฐ ultralytics.
  3. ๋ฐ์ดํ„ฐ ๋กœ๋“œ: Kaggle API๋ฅผ ์‚ฌ์šฉํ•˜์—ฌ ๋ฐ์ดํ„ฐ ์„ธํŠธ๋ฅผ Watsonx์— ๋กœ๋“œํ•ฉ๋‹ˆ๋‹ค.
  4. ๋ฐ์ดํ„ฐ ์ „์ฒ˜๋ฆฌ: ๋ฐ์ดํ„ฐ ์ง‘ํ•ฉ์„ ํ•„์š”ํ•œ ๋””๋ ‰ํ† ๋ฆฌ ๊ตฌ์กฐ๋กœ ๊ตฌ์„ฑํ•˜๊ณ  .yaml ๊ตฌ์„ฑ ํŒŒ์ผ์ž…๋‹ˆ๋‹ค.
  5. ๋ชจ๋ธ ํ›ˆ๋ จ: YOLO ๋ช…๋ น์ค„ ์ธํ„ฐํŽ˜์ด์Šค๋ฅผ ์‚ฌ์šฉํ•˜์—ฌ ๋‹ค์Œ๊ณผ ๊ฐ™์€ ํŠน์ • ๋งค๊ฐœ ๋ณ€์ˆ˜๋ฅผ ์‚ฌ์šฉํ•˜์—ฌ ๋ชจ๋ธ์„ ํ•™์Šต์‹œํ‚ต๋‹ˆ๋‹ค. epochs, batch size๋ฐ learning rate.
  6. ํ…Œ์ŠคํŠธ ๋ฐ ํ‰๊ฐ€: ์ถ”๋ก ์„ ์‹คํ–‰ํ•˜์—ฌ ๋ชจ๋ธ์„ ํ…Œ์ŠคํŠธํ•˜๊ณ  ์ •ํ™•๋„ ๋ฐ ํšŒ์ƒ๋ฅ ๊ณผ ๊ฐ™์€ ๋ฉ”ํŠธ๋ฆญ์„ ์‚ฌ์šฉํ•˜์—ฌ ์„ฑ๋Šฅ์„ ํ‰๊ฐ€ํ•ฉ๋‹ˆ๋‹ค.

For detailed instructions, refer to our YOLO11 Model Training guide.

AI ๋ชจ๋ธ ํŠธ๋ ˆ์ด๋‹์„ ์œ„ํ•œ IBM ์™“์Šจx์˜ ์ฃผ์š” ๊ธฐ๋Šฅ์€ ๋ฌด์—‡์ธ๊ฐ€์š”?

IBM ์™“์Šจ์—‘์Šค๋Š” AI ๋ชจ๋ธ ํ•™์Šต์„ ์œ„ํ•œ ๋ช‡ ๊ฐ€์ง€ ์ฃผ์š” ๊ธฐ๋Šฅ์„ ์ œ๊ณตํ•ฉ๋‹ˆ๋‹ค:

  • Watsonx.ai: IBM์ด ์ง€์›ํ•˜๋Š” ์‚ฌ์šฉ์ž ์ง€์ • ๋ชจ๋ธ ๋ฐ Llama 3์™€ ๊ฐ™์€ ํƒ€์‚ฌ ๋ชจ๋ธ์— ๋Œ€ํ•œ ์•ก์„ธ์Šค๋ฅผ ํฌํ•จํ•˜์—ฌ AI ๊ฐœ๋ฐœ์„ ์œ„ํ•œ ๋„๊ตฌ๋ฅผ ์ œ๊ณตํ•ฉ๋‹ˆ๋‹ค. ์—ฌ๊ธฐ์—๋Š” ์ข…ํ•ฉ์ ์ธ AI ์ˆ˜๋ช… ์ฃผ๊ธฐ ๊ด€๋ฆฌ๋ฅผ ์œ„ํ•œ ํ”„๋กฌํ”„ํŠธ ๋žฉ, ํŠœ๋‹ ์ŠคํŠœ๋””์˜ค, ํ”Œ๋กœ์šฐ ์—”์ง„์ด ํฌํ•จ๋ฉ๋‹ˆ๋‹ค.
  • Watsonx.data: ํด๋ผ์šฐ๋“œ ๋ฐ ์˜จํ”„๋ ˆ๋ฏธ์Šค ๋ฐฐํฌ๋ฅผ ์ง€์›ํ•˜๋ฉฐ, ์ค‘์•™ ์ง‘์ค‘์‹ ๋ฐ์ดํ„ฐ ์•ก์„ธ์Šค, ํšจ์œจ์ ์ธ ์ฟผ๋ฆฌ ์—”์ง„(์˜ˆ: Presto ๋ฐ Spark), AI ๊ธฐ๋ฐ˜ ์‹œ๋งจํ‹ฑ ๋ ˆ์ด์–ด๋ฅผ ์ œ๊ณตํ•ฉ๋‹ˆ๋‹ค.
  • ์™“์Šจx.๊ฑฐ๋ฒ„๋„Œ์Šค: ๊ทœ์ • ์ค€์ˆ˜๋ฅผ ์ž๋™ํ™”ํ•˜๊ณ , ์•Œ๋ฆผ์„ ํ†ตํ•ด ์œ„ํ—˜์„ ๊ด€๋ฆฌํ•˜๋ฉฐ, ํŽธํ–ฅ์„ฑ ๋ฐ ํŽธํ–ฅ์„ฑ๊ณผ ๊ฐ™์€ ๋ฌธ์ œ๋ฅผ ๊ฐ์ง€ํ•˜๋Š” ๋„๊ตฌ๋ฅผ ์ œ๊ณตํ•ฉ๋‹ˆ๋‹ค. ๋˜ํ•œ ํ˜‘์—…์„ ์œ„ํ•œ ๋Œ€์‹œ๋ณด๋“œ์™€ ๋ณด๊ณ  ๋„๊ตฌ๋„ ํฌํ•จ๋˜์–ด ์žˆ์Šต๋‹ˆ๋‹ค.

์ž์„ธํ•œ ๋‚ด์šฉ์€ IBM ์™“์Šจx ๊ณต์‹ ๋ฌธ์„œ๋ฅผ ์ฐธ์กฐํ•˜์„ธ์š”.

Why should I use IBM Watsonx for training Ultralytics YOLO11 models?

IBM Watsonx is an excellent choice for training Ultralytics YOLO11 models due to its comprehensive suite of tools that streamline the AI lifecycle. Key benefits include:

  • ํ™•์žฅ์„ฑ: IBM ํด๋ผ์šฐ๋“œ ์„œ๋น„์Šค๋กœ ๋ชจ๋ธ ๊ต์œก์„ ์‰ฝ๊ฒŒ ํ™•์žฅํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.
  • ํ†ตํ•ฉ: ๋‹ค์–‘ํ•œ ๋ฐ์ดํ„ฐ ์†Œ์Šค ๋ฐ API์™€ ์›ํ™œํ•˜๊ฒŒ ํ†ตํ•ฉํ•˜์„ธ์š”.
  • ์‚ฌ์šฉ์ž ์นœํ™”์ ์ธ ์ธํ„ฐํŽ˜์ด์Šค: ํ˜‘์—…์ ์ด๊ณ  ์ง๊ด€์ ์ธ ์ธํ„ฐํŽ˜์ด์Šค๋กœ ๊ฐœ๋ฐœ ํ”„๋กœ์„ธ์Šค๋ฅผ ๊ฐ„์†Œํ™”ํ•ฉ๋‹ˆ๋‹ค.
  • ๊ณ ๊ธ‰ ๋„๊ตฌ: ๋ชจ๋ธ ์„ฑ๋Šฅ ํ–ฅ์ƒ์„ ์œ„ํ•œ ํ”„๋กฌํ”„ํŠธ ๋žฉ, ํŠœ๋‹ ์ŠคํŠœ๋””์˜ค, ํ”Œ๋กœ์šฐ ์—”์ง„๊ณผ ๊ฐ™์€ ๊ฐ•๋ ฅํ•œ ํˆด์„ ์ด์šฉํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

Learn more about Ultralytics YOLO11 and how to train models using IBM Watsonx in our integration guide.

How can I preprocess my dataset for YOLO11 training on IBM Watsonx?

To preprocess your dataset for YOLO11 training on IBM Watsonx:

  1. ๋””๋ ‰ํ„ฐ๋ฆฌ ๊ตฌ์„ฑ: ๋ฐ์ดํ„ฐ ์„ธํŠธ๊ฐ€ YOLO ๋””๋ ‰ํ„ฐ๋ฆฌ ๊ตฌ์กฐ๋ฅผ ๋”ฐ๋ฅด๋ฉฐ, train/val/test ๋ถ„ํ•  ๋‚ด์—์„œ ์ด๋ฏธ์ง€์™€ ๋ ˆ์ด๋ธ”์„ ์œ„ํ•œ ๋ณ„๋„์˜ ํ•˜์œ„ ๋””๋ ‰ํ„ฐ๋ฆฌ๊ฐ€ ์žˆ๋Š”์ง€ ํ™•์ธํ•ฉ๋‹ˆ๋‹ค.
  2. .yaml ํŒŒ์ผ ์—…๋ฐ์ดํŠธ: ์ˆ˜์ • .yaml ๊ตฌ์„ฑ ํŒŒ์ผ์„ ์ˆ˜์ •ํ•˜์—ฌ ์ƒˆ ๋””๋ ‰ํ† ๋ฆฌ ๊ตฌ์กฐ์™€ ํด๋ž˜์Šค ์ด๋ฆ„์„ ๋ฐ˜์˜ํ•˜์„ธ์š”.
  3. ์ „์ฒ˜๋ฆฌ ์Šคํฌ๋ฆฝํŠธ ์‹คํ–‰: Python ์Šคํฌ๋ฆฝํŠธ๋ฅผ ์‚ฌ์šฉํ•˜์—ฌ ๋ฐ์ดํ„ฐ ์ง‘ํ•ฉ์„ ์žฌ๊ตฌ์„ฑํ•˜๊ณ  ๋‹ค์Œ์„ ์—…๋ฐ์ดํŠธํ•ฉ๋‹ˆ๋‹ค. .yaml ํŒŒ์ผ์— ์ €์žฅํ•ฉ๋‹ˆ๋‹ค.

๋‹ค์Œ์€ ๋ฐ์ดํ„ฐ ์ง‘ํ•ฉ์„ ์ •๋ฆฌํ•˜๋Š” ์ƒ˜ํ”Œ ์Šคํฌ๋ฆฝํŠธ์ž…๋‹ˆ๋‹ค:

import os
import shutil


def organize_files(directory):
    for subdir in ["train", "test", "val"]:
        subdir_path = os.path.join(directory, subdir)
        if not os.path.exists(subdir_path):
            continue

        images_dir = os.path.join(subdir_path, "images")
        labels_dir = os.path.join(subdir_path, "labels")

        os.makedirs(images_dir, exist_ok=True)
        os.makedirs(labels_dir, exist_ok=True)

        for filename in os.listdir(subdir_path):
            if filename.endswith(".txt"):
                shutil.move(os.path.join(subdir_path, filename), os.path.join(labels_dir, filename))
            elif filename.endswith(".jpg") or filename.endswith(".png") or filename.endswith(".jpeg"):
                shutil.move(os.path.join(subdir_path, filename), os.path.join(images_dir, filename))


if __name__ == "__main__":
    directory = f"{work_dir}/trash_ICRA19/dataset"
    organize_files(directory)

์ž์„ธํ•œ ๋‚ด์šฉ์€ ๋ฐ์ดํ„ฐ ์ „์ฒ˜๋ฆฌ ๊ฐ€์ด๋“œ๋ฅผ ์ฐธ์กฐํ•˜์„ธ์š”.

What are the prerequisites for training a YOLO11 model on IBM Watsonx?

Before you start training a YOLO11 model on IBM Watsonx, ensure you have the following prerequisites:

  • IBM ํด๋ผ์šฐ๋“œ ๊ณ„์ •: IBM Cloud์—์„œ ๊ณ„์ •์„ ์ƒ์„ฑํ•˜์—ฌ Watsonx.ai์— ์•ก์„ธ์Šคํ•ฉ๋‹ˆ๋‹ค.
  • Kaggle ๊ณ„์ •: ๋ฐ์ดํ„ฐ ์ง‘ํ•ฉ์„ ๋กœ๋“œํ•˜๋ ค๋ฉด Kaggle ๊ณ„์ •๊ณผ API ํ‚ค๊ฐ€ ํ•„์š”ํ•ฉ๋‹ˆ๋‹ค.
  • ์ฃผํ”ผํ„ฐ ๋…ธํŠธ๋ถ: ์ฝ”๋”ฉ ๋ฐ ๋ชจ๋ธ ํŠธ๋ ˆ์ด๋‹์„ ์œ„ํ•ด Watsonx.ai ๋‚ด์— Jupyter Notebook ํ™˜๊ฒฝ์„ ์„ค์ •ํ•ฉ๋‹ˆ๋‹ค.

ํ™˜๊ฒฝ ์„ค์ •์— ๋Œ€ํ•œ ์ž์„ธํ•œ ๋‚ด์šฉ์€ Ultralytics ์„ค์น˜ ๊ฐ€์ด๋“œ๋ฅผ ์ฐธ์กฐํ•˜์„ธ์š”.


๐Ÿ“… Created 2 months ago โœ๏ธ Updated 12 days ago

๋Œ“๊ธ€