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

๋น ๋ฅธ ์‹œ์ž‘ ๊ฐ€์ด๋“œ: NVIDIA Jetson๊ณผ Ultralytics YOLOv8

์ด ํฌ๊ด„์ ์ธ ๊ฐ€์ด๋“œ๋Š” NVIDIA Jetson ์žฅ์น˜์— Ultralytics YOLOv8 ๋ฐฐํฌ์— ๋Œ€ํ•œ ์ž์„ธํ•œ ์•ˆ๋‚ด๋ฅผ ์ œ๊ณตํ•ฉ๋‹ˆ๋‹ค. ๋˜ํ•œ ์ž‘๊ณ  ๊ฐ•๋ ฅํ•œ ์žฅ์น˜์—์„œ YOLOv8 ์˜ ์„ฑ๋Šฅ์„ ์ž…์ฆํ•˜๊ธฐ ์œ„ํ•œ ์„ฑ๋Šฅ ๋ฒค์น˜๋งˆํฌ๋„ ์†Œ๊ฐœํ•ฉ๋‹ˆ๋‹ค.

NVIDIA ์ ฏ์Šจ ์—์ฝ”์‹œ์Šคํ…œ

์ฐธ๊ณ 

์ด ๊ฐ€์ด๋“œ๋Š” ์•ˆ์ •์ ์ธ ์ตœ์‹  JetPack ๋ฆด๋ฆฌ์Šค์ธ JP5.1.3์„ ์‹คํ–‰ํ•˜๋Š” NVIDIA Jetson Orin NX 16GB ๊ธฐ๋ฐ˜์˜ Seeed Studio ์žฌ์ปดํ“จํ„ฐ J4012๋กœ ํ…Œ์ŠคํŠธ๋˜์—ˆ์Šต๋‹ˆ๋‹ค. Jetson Nano(JP4.6.4๊นŒ์ง€๋งŒ ์ง€์›)์™€ ๊ฐ™์€ ๊ตฌํ˜• Jetson ์žฅ์น˜์— ์ด ๊ฐ€์ด๋“œ๋ฅผ ์‚ฌ์šฉํ•˜๋ฉด ์ž‘๋™์ด ๋ณด์žฅ๋˜์ง€ ์•Š์„ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. ๊ทธ๋Ÿฌ๋‚˜ JP5.1.3์„ ์‹คํ–‰ํ•˜๋Š” ๋ชจ๋“  Jetson Orin, Xavier NX, AGX Xavier ์žฅ์น˜์—์„œ ์ž‘๋™ํ•  ๊ฒƒ์œผ๋กœ ์˜ˆ์ƒ๋ฉ๋‹ˆ๋‹ค.

NVIDIA Jetson์ด๋ž€?

NVIDIA Jetson์€ ์—ฃ์ง€ ๋””๋ฐ”์ด์Šค์— ๊ฐ€์†ํ™”๋œ AI(์ธ๊ณต ์ง€๋Šฅ) ์ปดํ“จํŒ…์„ ์ œ๊ณตํ•˜๋„๋ก ์„ค๊ณ„๋œ ์ž„๋ฒ ๋””๋“œ ์ปดํ“จํŒ… ๋ณด๋“œ ์‹œ๋ฆฌ์ฆˆ์ž…๋‹ˆ๋‹ค. ์ด ์ž‘๊ณ  ๊ฐ•๋ ฅํ•œ ์žฅ์น˜๋Š” NVIDIA์˜ GPU ์•„ํ‚คํ…์ฒ˜๋ฅผ ๊ธฐ๋ฐ˜์œผ๋กœ ๊ตฌ์ถ•๋˜์—ˆ์œผ๋ฉฐ ํด๋ผ์šฐ๋“œ ์ปดํ“จํŒ… ๋ฆฌ์†Œ์Šค์— ์˜์กดํ•  ํ•„์š” ์—†์ด ์žฅ์น˜์—์„œ ์ง์ ‘ ๋ณต์žกํ•œ AI ์•Œ๊ณ ๋ฆฌ์ฆ˜๊ณผ ๋”ฅ ๋Ÿฌ๋‹ ๋ชจ๋ธ์„ ์‹คํ–‰ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. Jetson ๋ณด๋“œ๋Š” ๋กœ๋ด‡ ๊ณตํ•™, ์ž์œจ ์ฃผํ–‰ ์ฐจ๋Ÿ‰, ์‚ฐ์—… ์ž๋™ํ™” ๋ฐ ์งง์€ ์ง€์—ฐ ์‹œ๊ฐ„๊ณผ ๋†’์€ ํšจ์œจ์„ฑ์œผ๋กœ ๋กœ์ปฌ์—์„œ AI ์ถ”๋ก ์„ ์ˆ˜ํ–‰ํ•ด์•ผ ํ•˜๋Š” ๊ธฐํƒ€ ์• ํ”Œ๋ฆฌ์ผ€์ด์…˜์—์„œ ์ž์ฃผ ์‚ฌ์šฉ๋ฉ๋‹ˆ๋‹ค. ๋˜ํ•œ ์ด๋Ÿฌํ•œ ๋ณด๋“œ๋Š” ARM64 ์•„ํ‚คํ…์ฒ˜๋ฅผ ๊ธฐ๋ฐ˜์œผ๋กœ ํ•˜๋ฉฐ ๊ธฐ์กด GPU ์ปดํ“จํŒ… ์žฅ์น˜์— ๋น„ํ•ด ์ €์ „๋ ฅ์œผ๋กœ ์‹คํ–‰๋ฉ๋‹ˆ๋‹ค.

์—”๋น„๋””์•„ ์ ฏ์Šจ ์‹œ๋ฆฌ์ฆˆ ๋น„๊ต

์ ฏ์Šจ ์˜ค๋ฆฐ์€ ์ด์ „ ์„ธ๋Œ€์™€ ๋น„๊ตํ–ˆ์„ ๋•Œ ๋Œ€ํญ ํ–ฅ์ƒ๋œ AI ์„ฑ๋Šฅ์„ ์ œ๊ณตํ•˜๋Š” ์—”๋น„๋””์•„ ์•”ํŽ˜์–ด ์•„ํ‚คํ…์ฒ˜๋ฅผ ๊ธฐ๋ฐ˜์œผ๋กœ ํ•˜๋Š” ์—”๋น„๋””์•„ ์ ฏ์Šจ ์ œํ’ˆ๊ตฐ์˜ ์ตœ์‹  ๋ฒ„์ „์ž…๋‹ˆ๋‹ค. ์•„๋ž˜ ํ‘œ๋Š” ์—์ฝ”์‹œ์Šคํ…œ์— ์žˆ๋Š” ๋ช‡ ๊ฐ€์ง€ ์ ฏ์Šจ ๋””๋ฐ”์ด์Šค๋ฅผ ๋น„๊ตํ•œ ๊ฒƒ์ž…๋‹ˆ๋‹ค.

Jetson AGX Orin 64GB ์ ฏ์Šจ ์˜ค๋ฆฐ NX 16GB ์ ฏ์Šจ ์˜ค๋ฆฐ ๋‚˜๋…ธ 8GB Jetson AGX Xavier ์ ฏ์Šจ ์ž๋น„์— NX ์ ฏ์Šจ ๋‚˜๋…ธ
AI ์„ฑ๋Šฅ 275 TOPS 100 TOPS TOP 40 32 TOPS 21 TOPS 472 GFLOPS
GPU 64๊ฐœ์˜ Tensor ์ฝ”์–ด๋ฅผ ๊ฐ–์ถ˜ 2048์ฝ”์–ด NVIDIA ์•”ํŽ˜์–ด ์•„ํ‚คํ…์ฒ˜ GPU 32๊ฐœ์˜ Tensor ์ฝ”์–ด๋ฅผ ๊ฐ–์ถ˜ 1024์ฝ”์–ด NVIDIA ์•”ํŽ˜์–ด ์•„ํ‚คํ…์ฒ˜ GPU 32๊ฐœ์˜ Tensor ์ฝ”์–ด๋ฅผ ๊ฐ–์ถ˜ 1024์ฝ”์–ด NVIDIA ์•”ํŽ˜์–ด ์•„ํ‚คํ…์ฒ˜ GPU 64๊ฐœ์˜ Tensor ์ฝ”์–ด๋ฅผ ๊ฐ–์ถ˜ 512์ฝ”์–ด NVIDIA ๋ณผํƒ€ ์•„ํ‚คํ…์ฒ˜ GPU 48๊ฐœ์˜ Tensor ์ฝ”์–ด๋ฅผ ๊ฐ–์ถ˜ 384์ฝ”์–ด NVIDIA Voltaโ„ข ์•„ํ‚คํ…์ฒ˜ GPU 128์ฝ”์–ด NVIDIA Maxwellโ„ข ์•„ํ‚คํ…์ฒ˜ GPU
GPU ์ตœ๋Œ€ ์ฃผํŒŒ์ˆ˜ 1.3GHz 918MHz 625MHz 1377 MHz 1100 MHz 921MHz
CPU 12์ฝ”์–ด NVIDIA Armยฎ Cortex A78AE v8.2 64๋น„ํŠธ CPU 3MB L2 + 6MB L3 8์ฝ”์–ด NVIDIA Armยฎ Cortex A78AE v8.2 64๋น„ํŠธ CPU 2MB L2 + 4MB L3 6์ฝ”์–ด Armยฎ Cortexยฎ-A78AE v8.2 64๋น„ํŠธ CPU 1.5MB L2 + 4MB L3 8์ฝ”์–ด NVIDIA Carmel Armยฎv8.2 64๋น„ํŠธ CPU 8MB L2 + 4MB L3 6์ฝ”์–ด NVIDIA Carmel Armยฎv8.2 64๋น„ํŠธ CPU 6MB L2 + 4MB L3 ์ฟผ๋“œ ์ฝ”์–ด Armยฎ Cortexยฎ-A57 MPCore ํ”„๋กœ์„ธ์„œ
CPU ์ตœ๋Œ€ ์ฃผํŒŒ์ˆ˜ 2.2 GHz 2.0 GHz 1.5GHz 2.2 GHz 1.9 GHz 1.43GHz
๋ฉ”๋ชจ๋ฆฌ 64GB 256๋น„ํŠธ LPDDR5 204.8GB/s 16GB 128๋น„ํŠธ LPDDR5 102.4GB/s 8GB 128๋น„ํŠธ LPDDR5 68GB/s 32GB 256๋น„ํŠธ LPDDR4x 136.5GB/s 8GB 128๋น„ํŠธ LPDDR4x 59.7GB/s 4GB 64๋น„ํŠธ LPDDR4 25.6GB/s"

๋” ์ž์„ธํ•œ ๋น„๊ต ํ‘œ๋Š” NVIDIA Jetson ๊ณต์‹ ํŽ˜์ด์ง€์˜ ๊ธฐ์ˆ  ์‚ฌ์–‘ ์„น์…˜์—์„œ ํ™•์ธํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

NVIDIA JetPack์ด๋ž€?

Jetson ๋ชจ๋“ˆ์„ ๊ตฌ๋™ํ•˜๋Š” NVIDIA JetPack SDK๋Š” ๊ฐ€์žฅ ํฌ๊ด„์ ์ธ ์†”๋ฃจ์…˜์œผ๋กœ, ์—”๋“œํˆฌ์—”๋“œ ๊ฐ€์†ํ™”๋œ AI ์• ํ”Œ๋ฆฌ์ผ€์ด์…˜ ๊ตฌ์ถ•์„ ์œ„ํ•œ ์™„๋ฒฝํ•œ ๊ฐœ๋ฐœ ํ™˜๊ฒฝ์„ ์ œ๊ณตํ•˜๊ณ  ์ถœ์‹œ ์‹œ๊ฐ„์„ ๋‹จ์ถ•ํ•ฉ๋‹ˆ๋‹ค. JetPack์—๋Š” ๋ถ€ํŠธ๋กœ๋”, Linux ์ปค๋„, ์šฐ๋ถ„ํˆฌ ๋ฐ์Šคํฌํ†ฑ ํ™˜๊ฒฝ ๋ฐ GPU ์ปดํ“จํŒ…, ๋ฉ€ํ‹ฐ๋ฏธ๋””์–ด, ๊ทธ๋ž˜ํ”ฝ ๋ฐ ์ปดํ“จํ„ฐ ๋น„์ „ ๊ฐ€์†ํ™”๋ฅผ ์œ„ํ•œ ์ „์ฒด ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ ์„ธํŠธ๊ฐ€ ํฌํ•จ๋œ Jetson Linux๊ฐ€ ํฌํ•จ๋˜์–ด ์žˆ์Šต๋‹ˆ๋‹ค. ๋˜ํ•œ ํ˜ธ์ŠคํŠธ ์ปดํ“จํ„ฐ์™€ ๊ฐœ๋ฐœ์ž ํ‚คํŠธ ๋ชจ๋‘๋ฅผ ์œ„ํ•œ ์ƒ˜ํ”Œ, ์„ค๋ช…์„œ, ๊ฐœ๋ฐœ์ž ๋„๊ตฌ๊ฐ€ ํฌํ•จ๋˜์–ด ์žˆ์œผ๋ฉฐ ์ŠคํŠธ๋ฆฌ๋ฐ ๋น„๋””์˜ค ๋ถ„์„์„ ์œ„ํ•œ DeepStream, ๋กœ๋ณดํ‹ฑ์Šค๋ฅผ ์œ„ํ•œ Isaac, ๋Œ€ํ™”ํ˜• AI๋ฅผ ์œ„ํ•œ Riva์™€ ๊ฐ™์€ ์ƒ์œ„ ์ˆ˜์ค€์˜ SDK๋ฅผ ์ง€์›ํ•ฉ๋‹ˆ๋‹ค.

ํ”Œ๋ž˜์‹œ ์ ฏํŒฉ์—์„œ ์—”๋น„๋””์•„ ์ ฏ์Šจ์œผ๋กœ์˜ ์ „ํ™˜

NVIDIA Jetson ์žฅ์น˜๋ฅผ ์†์— ๋„ฃ์€ ํ›„ ์ฒซ ๋ฒˆ์งธ ๋‹จ๊ณ„๋Š” ์žฅ์น˜์— NVIDIA JetPack์„ ํ”Œ๋ž˜์‹œํ•˜๋Š” ๊ฒƒ์ž…๋‹ˆ๋‹ค. NVIDIA Jetson ๋””๋ฐ”์ด์Šค๋ฅผ ํ”Œ๋ž˜์‹œํ•˜๋Š” ๋ฐฉ๋ฒ•์—๋Š” ์—ฌ๋Ÿฌ ๊ฐ€์ง€๊ฐ€ ์žˆ์Šต๋‹ˆ๋‹ค.

  1. ์ ฏ์Šจ ์˜ค๋ฆฐ ๋‚˜๋…ธ ๊ฐœ๋ฐœ์ž ํ‚คํŠธ์™€ ๊ฐ™์€ ๊ณต์‹ NVIDIA ๊ฐœ๋ฐœ ํ‚คํŠธ๋ฅผ ์†Œ์œ ํ•˜๊ณ  ์žˆ๋Š” ๊ฒฝ์šฐ ์ด ๋งํฌ๋ฅผ ๋ฐฉ๋ฌธํ•˜์—ฌ ์ด๋ฏธ์ง€๋ฅผ ๋‹ค์šด๋กœ๋“œํ•˜๊ณ  ์žฅ์น˜ ๋ถ€ํŒ…์„ ์œ„ํ•œ JetPack์ด ํฌํ•จ๋œ SD ์นด๋“œ๋ฅผ ์ค€๋น„ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.
  2. ๋‹ค๋ฅธ NVIDIA ๊ฐœ๋ฐœ ํ‚คํŠธ๋ฅผ ์†Œ์œ ํ•˜๊ณ  ์žˆ๋Š” ๊ฒฝ์šฐ, ์ด ๋งํฌ๋ฅผ ๋ฐฉ๋ฌธํ•˜์—ฌ SDK ๊ด€๋ฆฌ์ž๋ฅผ ์‚ฌ์šฉํ•˜์—ฌ JetPack์„ ์žฅ์น˜์— ํ”Œ๋ž˜์‹œํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.
  3. ์”จ๋“œ ์ŠคํŠœ๋””์˜ค ์žฌ์ปดํ“จํ„ฐ J4012 ์žฅ์น˜๋ฅผ ์†Œ์œ ํ•˜๊ณ  ์žˆ๋Š” ๊ฒฝ์šฐ, ์ด ๋งํฌ๋ฅผ ๋ฐฉ๋ฌธํ•˜์—ฌ JetPack์„ ํฌํ•จ๋œ SSD์— ํ”Œ๋ž˜์‹œํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.
  4. NVIDIA Jetson ๋ชจ๋“ˆ๋กœ ๊ตฌ๋™๋˜๋Š” ๋‹ค๋ฅธ ํƒ€์‚ฌ ์žฅ์น˜๋ฅผ ์†Œ์œ ํ•˜๊ณ  ์žˆ๋Š” ๊ฒฝ์šฐ ์ด ๋งํฌ๋ฅผ ๋ฐฉ๋ฌธํ•˜์—ฌ ๋ช…๋ น์ค„ ํ”Œ๋ž˜์‹ฑ์„ ๋”ฐ๋ฅด๋Š” ๊ฒƒ์ด ์ข‹์Šต๋‹ˆ๋‹ค.

์ฐธ๊ณ 

์œ„์˜ ๋ฐฉ๋ฒ• 3๊ณผ 4์˜ ๊ฒฝ์šฐ, ์‹œ์Šคํ…œ์„ ํ”Œ๋ž˜์‹œํ•˜๊ณ  ์žฅ์น˜๋ฅผ ๋ถ€ํŒ…ํ•œ ํ›„ ์žฅ์น˜ ํ„ฐ๋ฏธ๋„์—์„œ "sudo apt update && sudo apt install nvidia-jetpack -y"๋ฅผ ์ž…๋ ฅํ•˜์—ฌ ํ•„์š”ํ•œ ๋‚˜๋จธ์ง€ JetPack ๊ตฌ์„ฑ ์š”์†Œ๋ฅผ ๋ชจ๋‘ ์„ค์น˜ํ•˜์„ธ์š”.

Docker๋กœ ์‹œ์ž‘ํ•˜๊ธฐ

๊ฐ€์žฅ ๋น ๋ฅด๊ฒŒ ์‹œ์ž‘ํ•˜๋Š” ๋ฐฉ๋ฒ•์€ NVIDIA Jetson์—์„œ Ultralytics YOLOv8 ์‚ฌ์ „ ๋นŒ๋“œ๋œ Jetson์šฉ ๋„์ปค ์ด๋ฏธ์ง€๋กœ ์‹คํ–‰ํ•˜๋Š” ๊ฒƒ์ž…๋‹ˆ๋‹ค.

์•„๋ž˜ ๋ช…๋ น์–ด๋ฅผ ์‹คํ–‰ํ•˜์—ฌ Docker ์ปจํ…Œ์ด๋„ˆ๋ฅผ ๊ฐ€์ ธ์™€ Jetson์—์„œ ์‹คํ–‰ํ•ฉ๋‹ˆ๋‹ค. ์ด๊ฒƒ์€ Python3 ํ™˜๊ฒฝ์˜ PyTorch ๋ฐ Torchvision์ด ํฌํ•จ๋œ l4t-pytorch ๋„์ปค ์ด๋ฏธ์ง€๋ฅผ ๊ธฐ๋ฐ˜์œผ๋กœ ํ•ฉ๋‹ˆ๋‹ค.

t=ultralytics/ultralytics:latest-jetson && sudo docker pull $t && sudo docker run -it --ipc=host --runtime=nvidia $t

Docker ์—†์ด ์‹œ์ž‘

Ultralytics ํŒจํ‚ค์ง€ ์„ค์น˜

์—ฌ๊ธฐ์„œ๋Š” PyTorch ๋ชจ๋ธ์„ ๋‹ค๋ฅธ ๋‹ค๋ฅธ ํ˜•์‹์œผ๋กœ ๋‚ด๋ณด๋‚ผ ์ˆ˜ ์žˆ๋„๋ก ์„ ํƒ์  ์ข…์†์„ฑ๊ณผ ํ•จ๊ป˜ Jetson์— ultralyics ํŒจํ‚ค์ง€๋ฅผ ์„ค์น˜ํ•ฉ๋‹ˆ๋‹ค. ์—ฌ๊ธฐ์„œ๋Š” ์ฃผ๋กœ NVIDIA TensorRT ๋‚ด๋ณด๋‚ด๊ธฐ์— ์ดˆ์ ์„ ๋งž์ถ”๊ฒ ์Šต๋‹ˆ๋‹ค. TensoRT๋ฅผ ์‚ฌ์šฉํ•˜๋ฉด Jetson ์žฅ์น˜์—์„œ ์ตœ๋Œ€ํ•œ์˜ ์„ฑ๋Šฅ์„ ์–ป์„ ์ˆ˜ ์žˆ๊ธฐ ๋•Œ๋ฌธ์ž…๋‹ˆ๋‹ค.

  1. ํŒจํ‚ค์ง€ ๋ชฉ๋ก ์—…๋ฐ์ดํŠธ, pip ์„ค์น˜ ๋ฐ ์ตœ์‹  ๋ฒ„์ „์œผ๋กœ ์—…๊ทธ๋ ˆ์ด๋“œ
sudo apt update
sudo apt install python3-pip -y
pip install -U pip
  1. ์„ค์น˜ ultralytics ์„ ํƒ์  ์ข…์†์„ฑ์ด ์žˆ๋Š” pip ํŒจํ‚ค์ง€
pip install ultralytics[export]
  1. ๋””๋ฐ”์ด์Šค ์žฌ๋ถ€ํŒ…
sudo reboot

PyTorch ๋ฐ ํ† ์น˜๋น„์ „ ์„ค์น˜

์œ„์˜ ultralytics ์„ค์น˜๋Š” Torch ๋ฐ Torchvision์„ ์„ค์น˜ํ•ฉ๋‹ˆ๋‹ค. ๊ทธ๋Ÿฌ๋‚˜ pip๋ฅผ ํ†ตํ•ด ์„ค์น˜๋œ ์ด ๋‘ ํŒจํ‚ค์ง€๋Š” ARM64 ์•„ํ‚คํ…์ฒ˜ ๊ธฐ๋ฐ˜์ธ Jetson ํ”Œ๋žซํผ์—์„œ ์‹คํ–‰ํ•˜๊ธฐ์—๋Š” ํ˜ธํ™˜๋˜์ง€ ์•Š์Šต๋‹ˆ๋‹ค. ๋”ฐ๋ผ์„œ ๋ฏธ๋ฆฌ ๋นŒ๋“œ๋œ PyTorch pip ํœ ์„ ์ˆ˜๋™์œผ๋กœ ์„ค์น˜ํ•˜๊ณ  ์†Œ์Šค์—์„œ Torchvision์„ ์ปดํŒŒ์ผ/์„ค์น˜ํ•ด์•ผ ํ•ฉ๋‹ˆ๋‹ค.

  1. ํ˜„์žฌ ์„ค์น˜๋œ PyTorch ๋ฐ Torchvision ์ œ๊ฑฐ
pip uninstall torch torchvision
  1. JP5.1.3์— ๋”ฐ๋ผ PyTorch 2.1.0์„ ์„ค์น˜ํ•ฉ๋‹ˆ๋‹ค.
sudo apt-get install -y libopenblas-base libopenmpi-dev
wget https://developer.download.nvidia.com/compute/redist/jp/v512/pytorch/torch-2.1.0a0+41361538.nv23.06-cp38-cp38-linux_aarch64.whl -O torch-2.1.0a0+41361538.nv23.06-cp38-cp38-linux_aarch64.whl
pip install torch-2.1.0a0+41361538.nv23.06-cp38-cp38-linux_aarch64.whl
  1. PyTorch v2.1.0์— ๋”ฐ๋ผ Torchvision v0.16.2๋ฅผ ์„ค์น˜ํ•ฉ๋‹ˆ๋‹ค.
sudo apt install -y libjpeg-dev zlib1g-dev
git clone https://github.com/pytorch/vision torchvision
cd torchvision
git checkout v0.16.2
python3 setup.py install --user

์ด ํŽ˜์ด์ง€๋ฅผ ๋ฐฉ๋ฌธํ•˜์—ฌ ๋‹ค๋ฅธ JetPack ๋ฒ„์ „์— ๋Œ€ํ•œ PyTorch ์˜ ๋ชจ๋“  ๋ฒ„์ „์— ์•ก์„ธ์Šคํ•˜์„ธ์š”. PyTorch , ํ† ์น˜๋น„์ „ ํ˜ธํ™˜์„ฑ์— ๋Œ€ํ•œ ์ž์„ธํ•œ ๋ชฉ๋ก์€ ์—ฌ๊ธฐ์—์„œ ํ™•์ธํ•˜์„ธ์š”.

NVIDIA Jetson์—์„œ TensorRT ์‚ฌ์šฉ

Ultralytics ์—์„œ ์ง€์›ํ•˜๋Š” ๋ชจ๋“  ๋ชจ๋ธ ๋‚ด๋ณด๋‚ด๊ธฐ ํ˜•์‹ ์ค‘ TensorRT ์€ NVIDIA Jetson ์žฅ์น˜์™€ ํ•จ๊ป˜ ์ž‘์—…ํ•  ๋•Œ ์ตœ๊ณ ์˜ ์ถ”๋ก  ์„ฑ๋Šฅ์„ ์ œ๊ณตํ•˜๋ฉฐ, Jetson์—์„œ๋Š” TensorRT ์„ ์‚ฌ์šฉํ•  ๊ฒƒ์„ ๊ถŒ์žฅํ•ฉ๋‹ˆ๋‹ค. ์ž์„ธํ•œ ๋‚ด์šฉ์€ TensorRT ์—์„œ ํ™•์ธํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

๋ชจ๋ธ์„ TensorRT ๋กœ ๋ณ€ํ™˜ํ•˜๊ณ  ์ถ”๋ก  ์‹คํ–‰

PyTorch ํ˜•์‹์˜ YOLOv8n ๋ชจ๋ธ์€ ๋‚ด๋ณด๋‚ธ ๋ชจ๋ธ์„ ์‚ฌ์šฉํ•˜์—ฌ ์ถ”๋ก ์„ ์‹คํ–‰ํ•˜๊ธฐ ์œ„ํ•ด TensorRT ๋กœ ๋ณ€ํ™˜๋ฉ๋‹ˆ๋‹ค.

์˜ˆ

from ultralytics import YOLO

# Load a YOLOv8n PyTorch model
model = YOLO('yolov8n.pt')

# Export the model
model.export(format='engine')  # creates 'yolov8n.engine'

# Load the exported TensorRT model
trt_model = YOLO('yolov8n.engine')

# Run inference
results = trt_model('https://ultralytics.com/images/bus.jpg')
# Export a YOLOv8n PyTorch model to TensorRT format
yolo export model=yolov8n.pt format=engine  # creates 'yolov8n.engine'

# Run inference with the exported model
yolo predict model=yolov8n.engine source='https://ultralytics.com/images/bus.jpg'

์ธ์ˆ˜

ํ‚ค ๊ฐ€์น˜ ์„ค๋ช…
format 'engine' ํ˜•์‹์œผ๋กœ ๋‚ด๋ณด๋‚ผ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.
imgsz 640 ์ด๋ฏธ์ง€ ํฌ๊ธฐ๋ฅผ ์Šค์นผ๋ผ ๋˜๋Š” (h, w) ๋ชฉ๋ก(์˜ˆ: (640, 480))์œผ๋กœ ์ง€์ •ํ•ฉ๋‹ˆ๋‹ค.
half False FP16 ์–‘์žํ™”

์—”๋น„๋””์•„ ์ ฏ์Šจ ์˜ค๋ฆฐ YOLOv8 ๋ฒค์น˜๋งˆํฌ

YOLOv8 ์•„๋ž˜ ๋ฒค์น˜๋งˆํฌ๋Š” Ultralytics ํŒ€์ด ์†๋„์™€ ์ •ํ™•๋„๋ฅผ ์ธก์ •ํ•˜๋Š” 3๊ฐ€์ง€ ๋‹ค๋ฅธ ๋ชจ๋ธ ํฌ๋งท์œผ๋กœ ์‹คํ–‰ํ–ˆ์Šต๋‹ˆ๋‹ค: PyTorch, TorchScript , TensorRT. ๋ฒค์น˜๋งˆํฌ๋Š” ๊ธฐ๋ณธ ์ž…๋ ฅ ์ด๋ฏธ์ง€ ํฌ๊ธฐ 640์˜ FP32 ์ •๋ฐ€๋„์—์„œ Jetson Orin NX 16GB ์žฅ์น˜ ๊ธฐ๋ฐ˜์˜ Seeed Studio ์žฌ์ปดํ“จํ„ฐ J4012์—์„œ ์‹คํ–‰๋˜์—ˆ์Šต๋‹ˆ๋‹ค.

NVIDIA ์ ฏ์Šจ ์—์ฝ”์‹œ์Šคํ…œ
๋ชจ๋ธ ํ˜•์‹ ์ƒํƒœ ํฌ๊ธฐ(MB) mAP50-95(B) ์ถ”๋ก  ์‹œ๊ฐ„(ms/im)
YOLOv8n PyTorch โœ… 6.2 0.4473 14.3
YOLOv8n TorchScript โœ… 12.4 0.4520 13.3
YOLOv8n TensorRT โœ… 13.6 0.4520 8.7
YOLOv8s PyTorch โœ… 21.5 0.5868 18
YOLOv8s TorchScript โœ… 43.0 0.5971 23.9
YOLOv8s TensorRT โœ… 44.0 0.5965 14.82
YOLOv8m PyTorch โœ… 49.7 0.6101 36.4
YOLOv8m TorchScript โœ… 99.2 0.6125 53.34
YOLOv8m TensorRT โœ… 100.3 0.6123 33.28
YOLOv8l PyTorch โœ… 83.7 0.6588 61.3
YOLOv8l TorchScript โœ… 167.2 0.6587 85.21
YOLOv8l TensorRT โœ… 168.3 0.6591 51.34
YOLOv8x PyTorch โœ… 130.5 0.6650 93
YOLOv8x TorchScript โœ… 260.7 0.6651 135.3
YOLOv8x TensorRT โœ… 261.8 0.6645 84.5

์ด ํ‘œ๋Š” ์„ธ ๊ฐ€์ง€ ํ˜•์‹(PyTorch, TorchScript, TensorRT)์˜ ๋‹ค์„ฏ ๊ฐ€์ง€ ๋ชจ๋ธ(YOLOv8n, YOLOv8s, YOLOv8m, YOLOv8l, YOLOv8x)์— ๋Œ€ํ•œ ๋ฒค์น˜๋งˆํฌ ๊ฒฐ๊ณผ๋ฅผ ๋‚˜ํƒ€๋‚ด๋ฉฐ, ๊ฐ ์กฐํ•ฉ์˜ ์ƒํƒœ, ํฌ๊ธฐ, mAP50-95(B) ์ง€ํ‘œ ๋ฐ ์ถ”๋ก  ์‹œ๊ฐ„์„ ์ œ๊ณตํ•ฉ๋‹ˆ๋‹ค.

์ด ๋งํฌ๋ฅผ ๋ฐฉ๋ฌธํ•˜์—ฌ ๋‹ค์–‘ํ•œ ๋ฒ„์ „์˜ NVIDIA Jetson ํ•˜๋“œ์›จ์–ด์—์„œ ์‹คํ–‰๋˜๋Š” Seeed Studio์˜ ๋” ๋งŽ์€ ๋ฒค์น˜๋งˆํ‚น ๊ฒฐ๊ณผ๋ฅผ ์‚ดํŽด๋ณด์„ธ์š”.

๊ฒฐ๊ณผ ์žฌํ˜„

๋ชจ๋“  ๋‚ด๋ณด๋‚ด๊ธฐ ํ˜•์‹์—์„œ ์œ„์˜ Ultralytics ๋ฒค์น˜๋งˆํฌ๋ฅผ ์žฌํ˜„ํ•˜๋ ค๋ฉด ๋‹ค์Œ ์ฝ”๋“œ๋ฅผ ์‹คํ–‰ํ•˜์„ธ์š”:

์˜ˆ

from ultralytics import YOLO

# Load a YOLOv8n PyTorch model
model = YOLO('yolov8n.pt')

# Benchmark YOLOv8n speed and accuracy on the COCO8 dataset for all all export formats
results = model.benchmarks(data='coco8.yaml', imgsz=640)
# Benchmark YOLOv8n speed and accuracy on the COCO8 dataset for all all export formats
yolo benchmark model=yolov8n.pt data=coco8.yaml imgsz=640

๋ฒค์น˜๋งˆํ‚น ๊ฒฐ๊ณผ๋Š” ์‹œ์Šคํ…œ์˜ ์ •ํ™•ํ•œ ํ•˜๋“œ์›จ์–ด ๋ฐ ์†Œํ”„ํŠธ์›จ์–ด ๊ตฌ์„ฑ๊ณผ ๋ฒค์น˜๋งˆํฌ๋ฅผ ์‹คํ–‰ํ•  ๋‹น์‹œ ์‹œ์Šคํ…œ์˜ ํ˜„์žฌ ์ž‘์—…๋Ÿ‰์— ๋”ฐ๋ผ ๋‹ฌ๋ผ์งˆ ์ˆ˜ ์žˆ๋‹ค๋Š” ์ ์— ์œ ์˜ํ•˜์„ธ์š”. ๊ฐ€์žฅ ์‹ ๋ขฐํ•  ์ˆ˜ ์žˆ๋Š” ๊ฒฐ๊ณผ๋ฅผ ์–ป์œผ๋ ค๋ฉด ๋งŽ์€ ์ˆ˜์˜ ์ด๋ฏธ์ง€๊ฐ€ ํฌํ•จ๋œ ๋ฐ์ดํ„ฐ ์„ธํŠธ๋ฅผ ์‚ฌ์šฉํ•˜์„ธ์š”. data='coco8.yaml' (128 val images), ordata='coco.yaml'` (5000๊ฐœ val ์ด๋ฏธ์ง€).

์ฐธ๊ณ 

ํ˜„์žฌ PyTorch, Torchscript ๋ฐ TensorRT ์—์„œ๋งŒ ๋ฒค์น˜๋งˆํ‚น ๋„๊ตฌ๋ฅผ ์‚ฌ์šฉํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. ํ–ฅํ›„ ๋‹ค๋ฅธ ์ˆ˜์ถœ๋„ ์ง€์›ํ•  ์ˆ˜ ์žˆ๋„๋ก ์—…๋ฐ์ดํŠธํ•  ์˜ˆ์ •์ž…๋‹ˆ๋‹ค.

NVIDIA Jetson ์‚ฌ์šฉ ์‹œ ๋ชจ๋ฒ” ์‚ฌ๋ก€

NVIDIA Jetson์„ ์‚ฌ์šฉํ•  ๋•Œ YOLOv8 ์„ ์‹คํ–‰ํ•˜๋Š” NVIDIA Jetson์—์„œ ์„ฑ๋Šฅ์„ ๊ทน๋Œ€ํ™”ํ•˜๊ธฐ ์œ„ํ•ด ๋”ฐ๋ผ์•ผ ํ•  ๋ช‡ ๊ฐ€์ง€ ๋ชจ๋ฒ” ์‚ฌ๋ก€๊ฐ€ ์žˆ์Šต๋‹ˆ๋‹ค.

  1. ์ตœ๋Œ€ ์ „๋ ฅ ๋ชจ๋“œ ํ™œ์„ฑํ™”

    Jetson์—์„œ ์ตœ๋Œ€ ์ „๋ ฅ ๋ชจ๋“œ๋ฅผ ํ™œ์„ฑํ™”ํ•˜๋ฉด ๋ชจ๋“  CPU, GPU ์ฝ”์–ด๊ฐ€ ์ผœ์ ธ ์žˆ๋Š”์ง€ ํ™•์ธํ•ฉ๋‹ˆ๋‹ค.

    sudo nvpmodel -m 0
    

  2. Jetson ํด๋ก ์‚ฌ์šฉ

    Jetson ํด๋Ÿญ์„ ํ™œ์„ฑํ™”ํ•˜๋ฉด ๋ชจ๋“  CPU, GPU ์ฝ”์–ด๊ฐ€ ์ตœ๋Œ€ ์ฃผํŒŒ์ˆ˜๋กœ ํด๋Ÿญ๋ฉ๋‹ˆ๋‹ค.

    sudo jetson_clocks
    

  3. Jetson ํ†ต๊ณ„ ์• ํ”Œ๋ฆฌ์ผ€์ด์…˜ ์„ค์น˜

    ์ ฏ์Šจ ํ†ต๊ณ„ ์• ํ”Œ๋ฆฌ์ผ€์ด์…˜์„ ์‚ฌ์šฉํ•˜์—ฌ ์‹œ์Šคํ…œ ๊ตฌ์„ฑ ์š”์†Œ์˜ ์˜จ๋„๋ฅผ ๋ชจ๋‹ˆํ„ฐ๋งํ•˜๊ณ  CPU, GPU, RAM ์‚ฌ์šฉ๋ฅ  ๋ณด๊ธฐ, ์ „์› ๋ชจ๋“œ ๋ณ€๊ฒฝ, ์ตœ๋Œ€ ํด๋Ÿญ์œผ๋กœ ์„ค์ •, ์ ฏํŒฉ ์ •๋ณด ํ™•์ธ๊ณผ ๊ฐ™์€ ๊ธฐํƒ€ ์‹œ์Šคํ…œ ์„ธ๋ถ€ ์ •๋ณด๋ฅผ ํ™•์ธํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

    sudo apt update
    sudo pip install jetson-stats
    sudo reboot
    jtop
    

Jetson ํ†ต๊ณ„

๋‹ค์Œ ๋‹จ๊ณ„

NVIDIA Jetson์— YOLOv8 ์„ ์„ฑ๊ณต์ ์œผ๋กœ ์„ค์ •ํ•˜์‹  ๊ฒƒ์„ ์ถ•ํ•˜๋“œ๋ฆฝ๋‹ˆ๋‹ค! ์ถ”๊ฐ€ ํ•™์Šต ๋ฐ ์ง€์›์€ Ultralytics YOLOv8 ๋ฌธ์„œ์—์„œ ๋” ๋งŽ์€ ๊ฐ€์ด๋“œ๋ฅผ ํ™•์ธํ•˜์„ธ์š”!



2024-04-02 ์ƒ์„ฑ๋จ 2024-04-18 ์—…๋ฐ์ดํŠธ๋จ
์ž‘์„ฑ์ž: glenn-jocher (1), Burhan-Q (1), lakshanthad (1)

๋Œ“๊ธ€