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

YOLOv5 AWS ๋”ฅ ๋Ÿฌ๋‹ ์ธ์Šคํ„ด์Šค์—์„œ ๐Ÿš€: ์ „์ฒด ๊ฐ€์ด๋“œ

Setting up a high-performance deep learning environment can be daunting for newcomers, but fear not! ๐Ÿ› ๏ธ With this guide, we'll walk you through the process of getting YOLOv5 up and running on an AWS Deep Learning instance. By leveraging the power of Amazon Web Services (AWS), even those new to machine learning can get started quickly and cost-effectively. The AWS platform's scalability is perfect for both experimentation and production deployment.

YOLOv5 ์˜ ๋‹ค๋ฅธ ๋น ๋ฅธ ์‹œ์ž‘ ์˜ต์…˜์€ ๋‹ค์Œ๊ณผ ๊ฐ™์Šต๋‹ˆ๋‹ค. Colab ๋…ธํŠธ๋ถ ์ฝœ๋žฉ์—์„œ ์—ด๊ธฐ ์บ๊ธ€์—์„œ ์—ด๊ธฐ, GCP ๋”ฅ ๋Ÿฌ๋‹ VM์™€ ๋„์ปค ์ด๋ฏธ์ง€์˜ ๋„์ปค ํ—ˆ๋ธŒ ๋„์ปค ํ’€.

1๋‹จ๊ณ„: AWS ์ฝ˜์†” ๋กœ๊ทธ์ธ

๋จผ์ € ๊ณ„์ •์„ ์ƒ์„ฑํ•˜๊ฑฐ๋‚˜ https://aws.amazon.com/console/ ์—์„œ AWS ์ฝ˜์†”์— ๋กœ๊ทธ์ธํ•ฉ๋‹ˆ๋‹ค. ๋กœ๊ทธ์ธํ•œ ํ›„ ์ธ์Šคํ„ด์Šค๋ฅผ ๊ด€๋ฆฌํ•˜๊ณ  ์„ค์ •ํ•  EC2 ์„œ๋น„์Šค๋ฅผ ์„ ํƒํ•ฉ๋‹ˆ๋‹ค.

์ฝ˜์†”

2๋‹จ๊ณ„: ์ธ์Šคํ„ด์Šค ์‹œ์ž‘

EC2 ๋Œ€์‹œ๋ณด๋“œ์—์„œ ์ƒˆ ๊ฐ€์ƒ ์„œ๋ฒ„๋ฅผ ์ƒ์„ฑํ•˜๋Š” ๊ด€๋ฌธ์ธ ์ธ์Šคํ„ด์Šค ์‹œ์ž‘ ๋ฒ„ํŠผ์„ ์ฐพ์„ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

์‹œ์ž‘

์˜ฌ๋ฐ”๋ฅธ ์•„๋งˆ์กด ๋จธ์‹  ์ด๋ฏธ์ง€(AMI) ์„ ํƒํ•˜๊ธฐ

Here's where you choose the operating system and software stack for your instance. Type 'Deep Learning' into the search field and select the latest Ubuntu-based Deep Learning AMI, unless your needs dictate otherwise. Amazon's Deep Learning AMIs come pre-installed with popular frameworks and GPU drivers to streamline your setup process.

AMI ์„ ํƒ

์ธ์Šคํ„ด์Šค ์œ ํ˜• ์„ ํƒํ•˜๊ธฐ

๋”ฅ ๋Ÿฌ๋‹ ์ž‘์—…์˜ ๊ฒฝ์šฐ ์ผ๋ฐ˜์ ์œผ๋กœ ๋ชจ๋ธ ํ•™์Šต ์†๋„๋ฅผ ํฌ๊ฒŒ ๋†’์ผ ์ˆ˜ ์žˆ๋Š” GPU ์ธ์Šคํ„ด์Šค ์œ ํ˜•์„ ์„ ํƒํ•˜๋Š” ๊ฒƒ์ด ์ข‹์Šต๋‹ˆ๋‹ค. ์ธ์Šคํ„ด์Šค ํฌ๊ธฐ๋ฅผ ๊ณ ๋ คํ•  ๋•Œ ๋ชจ๋ธ์˜ ๋ฉ”๋ชจ๋ฆฌ ์š”๊ตฌ ์‚ฌํ•ญ์ด ์ธ์Šคํ„ด์Šค๊ฐ€ ์ œ๊ณตํ•  ์ˆ˜ ์žˆ๋Š” ์šฉ๋Ÿ‰์„ ์ดˆ๊ณผํ•ด์„œ๋Š” ์•ˆ ๋œ๋‹ค๋Š” ์ ์„ ๊ธฐ์–ตํ•˜์„ธ์š”.

์ฐธ๊ณ : ๋ชจ๋ธ์˜ ํฌ๊ธฐ๋Š” ์ธ์Šคํ„ด์Šค๋ฅผ ์„ ํƒํ•  ๋•Œ ๊ณ ๋ คํ•ด์•ผ ํ•  ์š”์†Œ์ž…๋‹ˆ๋‹ค. ๋ชจ๋ธ์ด ์ธ์Šคํ„ด์Šค์˜ ์‚ฌ์šฉ ๊ฐ€๋Šฅํ•œ RAM์„ ์ดˆ๊ณผํ•˜๋Š” ๊ฒฝ์šฐ ์• ํ”Œ๋ฆฌ์ผ€์ด์…˜์— ์ถฉ๋ถ„ํ•œ ๋ฉ”๋ชจ๋ฆฌ๊ฐ€ ์žˆ๋Š” ๋‹ค๋ฅธ ์ธ์Šคํ„ด์Šค ์œ ํ˜•์„ ์„ ํƒํ•˜์„ธ์š”.

์‚ฌ์šฉ ๊ฐ€๋Šฅํ•œ GPU ์ธ์Šคํ„ด์Šค ์œ ํ˜• ๋ชฉ๋ก์€ EC2 ์ธ์Šคํ„ด์Šค ์œ ํ˜•, ํŠนํžˆ ๊ฐ€์†ํ™”๋œ ์ปดํ“จํŒ…์—์„œ ํ™•์ธํ•˜์„ธ์š”.

์œ ํ˜• ์„ ํƒ

GPU ๋ชจ๋‹ˆํ„ฐ๋ง ๋ฐ ์ตœ์ ํ™”์— ๋Œ€ํ•œ ์ž์„ธํ•œ ๋‚ด์šฉ์€ GPU ๋ชจ๋‹ˆํ„ฐ๋ง ๋ฐ ์ตœ์ ํ™”๋ฅผ ์ฐธ์กฐํ•˜์„ธ์š”. ๊ฐ€๊ฒฉ ์ฑ…์ •์— ๋Œ€ํ•ด์„œ๋Š” ์˜จ๋””๋งจ๋“œ ๊ฐ€๊ฒฉ ์ฑ…์ • ๋ฐ ํ˜„๋ฌผ ๊ฐ€๊ฒฉ ์ฑ…์ •์„ ์ฐธ์กฐํ•˜์„ธ์š”.

์ธ์Šคํ„ด์Šค ๊ตฌ์„ฑ

Amazon EC2 ์ŠคํŒŸ ์ธ์Šคํ„ด์Šค๋Š” ์‚ฌ์šฉํ•˜์ง€ ์•Š๋Š” ์šฉ๋Ÿ‰์„ ํ‘œ์ค€ ๋น„์šฉ์˜ ์ผ๋ถ€๋กœ ์ž…์ฐฐํ•  ์ˆ˜ ์žˆ์œผ๋ฏ€๋กœ ์• ํ”Œ๋ฆฌ์ผ€์ด์…˜์„ ์‹คํ–‰ํ•  ์ˆ˜ ์žˆ๋Š” ๋น„์šฉ ํšจ์œจ์ ์ธ ๋ฐฉ๋ฒ•์„ ์ œ๊ณตํ•ฉ๋‹ˆ๋‹ค. ์ŠคํŒŸ ์ธ์Šคํ„ด์Šค๊ฐ€ ๋‹ค์šด๋˜๋”๋ผ๋„ ๋ฐ์ดํ„ฐ๊ฐ€ ์œ ์ง€๋˜๋Š” ์˜๊ตฌ์ ์ธ ํ™˜๊ฒฝ์„ ์›ํ•œ๋‹ค๋ฉด ์˜๊ตฌ ์š”์ฒญ์„ ์„ ํƒํ•˜์„ธ์š”.

์ŠคํŒŸ ์š”์ฒญ

์‹œ์ž‘ํ•˜๊ธฐ ์ „์— 4~7๋‹จ๊ณ„์—์„œ ํ•„์š”์— ๋”ฐ๋ผ ๋‚˜๋จธ์ง€ ์ธ์Šคํ„ด์Šค ์„ค์ • ๋ฐ ๋ณด์•ˆ ๊ตฌ์„ฑ์„ ์กฐ์ •ํ•˜๋Š” ๊ฒƒ์„ ์žŠ์ง€ ๋งˆ์„ธ์š”.

3๋‹จ๊ณ„: ์ธ์Šคํ„ด์Šค์— ์—ฐ๊ฒฐ

์ธ์Šคํ„ด์Šค๊ฐ€ ์‹คํ–‰ ์ค‘์ด๋ฉด ํ•ด๋‹น ํ™•์ธ๋ž€์„ ์„ ํƒํ•˜๊ณ  ์—ฐ๊ฒฐ์„ ํด๋ฆญํ•˜์—ฌ SSH ์ •๋ณด์— ์•ก์„ธ์Šคํ•ฉ๋‹ˆ๋‹ค. ํ‘œ์‹œ๋œ SSH ๋ช…๋ น์„ ์›ํ•˜๋Š” ํ„ฐ๋ฏธ๋„์—์„œ ์‚ฌ์šฉํ•˜์—ฌ ์ธ์Šคํ„ด์Šค์— ์—ฐ๊ฒฐ์„ ์„ค์ •ํ•ฉ๋‹ˆ๋‹ค.

์—ฐ๊ฒฐ

4๋‹จ๊ณ„: ์‹คํ–‰ YOLOv5

์ธ์Šคํ„ด์Šค์— ๋กœ๊ทธ์ธํ•˜๋ฉด ์ด์ œ YOLOv5 ๋ฆฌํฌ์ง€ํ† ๋ฆฌ๋ฅผ ๋ณต์ œํ•˜๊ณ  Python 3.8 ์ด์ƒ ํ™˜๊ฒฝ์—์„œ ์ข…์†์„ฑ์„ ์„ค์น˜ํ•  ์ค€๋น„๊ฐ€ ๋œ ๊ฒƒ์ž…๋‹ˆ๋‹ค. YOLOv5 ์˜ ๋ชจ๋ธ๊ณผ ๋ฐ์ดํ„ฐ ์„ธํŠธ๊ฐ€ ์ตœ์‹  ๋ฆด๋ฆฌ์Šค์—์„œ ์ž๋™์œผ๋กœ ๋‹ค์šด๋กœ๋“œ๋ฉ๋‹ˆ๋‹ค.

git clone https://github.com/ultralytics/yolov5  # clone repository
cd yolov5
pip install -r requirements.txt  # install dependencies

ํ™˜๊ฒฝ์ด ์„ค์ •๋˜๋ฉด ํ•™์Šต, ์œ ํšจ์„ฑ ๊ฒ€์‚ฌ, ์ถ”๋ก  ์ˆ˜ํ–‰, YOLOv5 ๋ชจ๋ธ ๋‚ด๋ณด๋‚ด๊ธฐ๋ฅผ ์‹œ์ž‘ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค:

# Train a model on your data
python train.py

# Validate the trained model for Precision, Recall, and mAP
python val.py --weights yolov5s.pt

# Run inference using the trained model on your images or videos
python detect.py --weights yolov5s.pt --source path/to/images

# Export the trained model to other formats for deployment
python export.py --weights yolov5s.pt --include onnx coreml tflite

์„ ํƒ์  ์ถ”๊ฐ€ ๊ธฐ๋Šฅ

๋Œ€๊ทœ๋ชจ ๋ฐ์ดํ„ฐ ์„ธํŠธ์˜ ๊ตฌ์„ธ์ฃผ๊ฐ€ ๋  ์ˆ˜ ์žˆ๋Š” ์Šค์™‘ ๋ฉ”๋ชจ๋ฆฌ๋ฅผ ๋” ์ถ”๊ฐ€ํ•˜๋ ค๋ฉด ์‹คํ–‰ํ•˜์„ธ์š”:

sudo fallocate -l 64G /swapfile  # allocate 64GB swap file
sudo chmod 600 /swapfile  # modify permissions
sudo mkswap /swapfile  # set up a Linux swap area
sudo swapon /swapfile  # activate swap file
free -h  # verify swap memory

And that's it! ๐ŸŽ‰ You've successfully created an AWS Deep Learning instance and run YOLOv5. Whether you're just starting with object detection or scaling up for production, this setup can help you achieve your machine learning goals. Happy training, validating, and deploying! If you encounter any hiccups along the way, the robust AWS documentation and the active Ultralytics community are here to support you.


๐Ÿ“… Created 11 months ago โœ๏ธ Updated 13 days ago

๋Œ“๊ธ€