ONNX YOLO11 ã¢ãã«ã®ãšã¯ã¹ããŒã
å€ãã®å Žåãã³ã³ãã¥ãŒã¿ããžã§ã³ã¢ãã«ãå±éããéã«ã¯ãæè»æ§ããããè€æ°ã®ãã©ãããã©ãŒã ãšäºææ§ã®ããã¢ãã«ãã©ãŒããããå¿ èŠã«ãªããŸãã
ã¢ãã«ã Ultralytics YOLO11ã¢ãã«ãONNX ãã©ãŒãããã«ãšã¯ã¹ããŒãããããšã§ããããã€ã¡ã³ããåçåãããããŸããŸãªç°å¢ã§æé©ãªããã©ãŒãã³ã¹ãä¿èšŒãããŸãããã®ã¬ã€ãã§ã¯ãYOLO11 ã®ã¢ãã«ãç°¡åã«ONNX ã«å€æããå®éã®ã¢ããªã±ãŒã·ã§ã³ã§ã®æ¡åŒµæ§ãšæå¹æ§ãé«ããæ¹æ³ã玹ä»ããŸãã
ONNX ããã³ONNX ã©ã³ã¿ã€ã
ONNXOpenNeural NetworkExchangeã®ç¥ã§ãFacebookãšMicrosoft ãæåã«éçºããã³ãã¥ããã£ã»ãããžã§ã¯ãã§ãããçŸåšé²è¡äžã®ONNX ã®éçºã¯ãIBMãã¢ããŸã³ïŒAWSãéããŠïŒãGoogle ã®ãããªæ§ã ãªçµç¹ã«ãã£ãŠãµããŒããããŠããå ±åäœæ¥ã§ããããã®ãããžã§ã¯ãã¯ãç°ãªãAIãã¬ãŒã ã¯ãŒã¯ãããŒããŠã§ã¢éã§äœ¿çšã§ããããã«ãæ©æ¢°åŠç¿ã¢ãã«ãè¡šçŸããããã«èšèšããããªãŒãã³ãªãã¡ã€ã«ãã©ãŒããããäœæããããšãç®çãšããŠããã
ONNX ã¢ãã«ã¯ãç°ãªããã¬ãŒã ã¯ãŒã¯éã§ã·ãŒã ã¬ã¹ã«ç§»è¡ããããã«äœ¿çšããããšãã§ãããäŸãã°ãPyTorch ã§ãã¬ãŒãã³ã°ããããã£ãŒãã©ãŒãã³ã°ã¢ãã«ã¯ãONNX 圢åŒã«ãšã¯ã¹ããŒãããTensorFlow ã«ç°¡åã«ã€ã³ããŒãããããšãã§ããã
ãããã¯ãONNX ã®ã¢ãã«ãONNX Runtime ã§äœ¿çšããããšãã§ãããONNX Runtimeã¯ãæ©æ¢°åŠç¿ã¢ãã«ã®ããã®å€ç®çã®ã¯ãã¹ãã©ãããã©ãŒã ã»ã¢ã¯ã»ã©ã¬ãŒã¿ã§ãPyTorch ã®ãããªãã¬ãŒã ã¯ãŒã¯ãšäºææ§ãããã TensorFlowTFLiteãscikit-learnãªã©ã®ãã¬ãŒã ã¯ãŒã¯ãšäºææ§ãããã
ONNX ã©ã³ã¿ã€ã ã¯ãããŒããŠã§ã¢åºæã®æ©èœã掻çšããããšã§ãONNX ã¢ãã«ã®å®è¡ãæé©åããŸãããã®æé©åã«ãããCPUãGPUãå°çšã¢ã¯ã»ã©ã¬ãŒã¿ãªã©ãããŸããŸãªããŒããŠã§ã¢ãã©ãããã©ãŒã äžã§ã¢ãã«ãå¹ççãã€é«æ§èœã«å®è¡ããããšãã§ããã
åç¬ã§äœ¿çšããå Žåã§ããONNX Runtime ãšäœµçšããå Žåã§ããONNX ã¯æ©æ¢°åŠç¿ã¢ãã«ã®å±éãšäºææ§ã®ããã®æè»ãªãœãªã¥ãŒã·ã§ã³ãæäŸããŸãã
ONNX ã¢ãã«ã®äž»ãªç¹åŸŽ
ONNX ãæ§ã ãªãã©ãŒããããæ±ãããšãã§ããã®ã¯ã次ã®ãããªäž»ãªç¹åŸŽãããããã§ããïŒ
-
å ±éã®ã¢ãã«è¡šçŸïŒONNX ã¯ãå ±éã®æŒç®åã»ããïŒç³ã¿èŸŒã¿ãã¬ã€ã€ãŒãªã©ïŒãšæšæºããŒã¿ãã©ãŒããããå®çŸ©ããŠãããã¢ãã«ãONNX ãã©ãŒãããã«å€æããããšãããã®ã¢ãŒããã¯ãã£ãšéã¿ã¯ããã®å ±éè¡šçŸã«å€æãããŸãããã®çµ±äžæ§ã«ãããONNX ããµããŒãããã©ã®ãã¬ãŒã ã¯ãŒã¯ã§ãã¢ãã«ãç解ã§ããããšãä¿èšŒãããã
-
ããŒãžã§ãã³ã°ãšåŸæ¹äºææ§:ONNX ã¯ããªãã¬ãŒã¿ã®ããã®ããŒãžã§ãã³ã°ã»ã·ã¹ãã ãç¶æããŠããŸããããã«ãããèŠæ Œãé²åããŠããå€ãããŒãžã§ã³ã§äœæãããã¢ãã«ã䜿çšå¯èœãªãŸãŸã§ããããšãä¿èšŒãããŸããåŸæ¹äºææ§ã¯ãã¢ãã«ãããã«æ代é ãã«ãªãã®ãé²ãéèŠãªæ©èœã§ãã
-
ã°ã©ãããŒã¹ã®ã¢ãã«è¡šçŸïŒONNX ã¢ãã«ã¯èšç®ã°ã©ããšããŠè¡šçŸãããããã®ã°ã©ãããŒã¹ã®æ§é ã¯ãæ©æ¢°åŠç¿ã¢ãã«ãè¡šçŸããæ®éçãªæ¹æ³ã§ãããããŒãã¯æäœãèšç®ãè¡šãããšããžã¯ãããã®éãæµãããã³ãœã«ãè¡šãããã®åœ¢åŒã¯ãåããã¢ãã«ãã°ã©ããšããŠè¡šçŸããæ§ã ãªãã¬ãŒã ã¯ãŒã¯ã«å®¹æã«é©å¿ã§ããã
-
ããŒã«ãšãšã³ã·ã¹ãã ïŒONNX ã®åšèŸºã«ã¯ãã¢ãã«ã®å€æãèŠèŠåãæé©åãæ¯æŽããããŒã«ã®è±å¯ãªãšã³ã·ã¹ãã ãããããããã®ããŒã«ã«ãããéçºè ã¯ONNX ã¢ãã«ã§ã®äœæ¥ã容æã«ãªããç°ãªããã¬ãŒã ã¯ãŒã¯éã§ã¢ãã«ãã·ãŒã ã¬ã¹ã«å€æã§ããã
äžè¬çãªäœ¿ãæ¹ONNX
YOLO11 ã¢ãã«ãONNX ãã©ãŒãããã«ãšã¯ã¹ããŒãããæ¹æ³ã®åã«ãONNX ã¢ãã«ãé垞䜿çšãããå Žæã«ã€ããŠèŠãŠã¿ãŸãããã
CPU é å
ONNX ã¢ãã«ã¯ãONNX ã©ã³ã¿ã€ã ãšã®äºææ§ããããããCPUäžã§å±éãããããšãå€ãããã®ã©ã³ã¿ã€ã ã¯CPU å®è¡çšã«æé©åãããŠãããããã«ããæšè«é床ãå€§å¹ ã«æ¹åãããCPU ã®ãªã¢ã«ã¿ã€ã å±éãå¯èœã«ãªãã
ãµããŒããããå±éãªãã·ã§ã³
ONNX ãäžè¬çã«ã¯CPUäžã§äœ¿çšãããããšãå€ããã以äžã®ãããªãã©ãããã©ãŒã ã«ãå±éã§ããïŒ
-
GPU ã¢ã¯ã»ã©ã¬ãŒã·ã§ã³ïŒONNX GPU ã¢ã¯ã»ã©ã¬ãŒã·ã§ã³ãç¹ã«NVIDIA CUDA ãå®å šã«ãµããŒãããŠãããããã«ãããé«ãèšç®èœåãå¿ èŠãšããã¿ã¹ã¯ã«ã€ããŠãNVIDIA GPUäžã§ã®å¹ççãªå®è¡ãå¯èœã«ãªãã
-
ãšããžããã€ã¹ãšã¢ãã€ã«ããã€ã¹:ONNX ã¯ãšããžããã€ã¹ãšã¢ãã€ã«ããã€ã¹ã«æ¡åŒµããããªã³ããã€ã¹ãšãªã¢ã«ã¿ã€ã æšè«ã·ããªãªã«æé©ã§ãã軜éã§ããšããžããŒããŠã§ã¢ãšäºææ§ããããŸãã
-
ãŠã§ããã©ãŠã¶ïŒONNX ã¯ãŠã§ããã©ãŠã¶ã§çŽæ¥å®è¡ã§ããã€ã³ã¿ã©ã¯ãã£ãã§ãã€ãããã¯ãªãŠã§ãããŒã¹ã®AIã¢ããªã±ãŒã·ã§ã³ã匷åã«ãµããŒãããŸãã
YOLO11 ã¢ãã«ã®ãšã¯ã¹ããŒãONNX
YOLO11 ã¢ãã«ãONNX ãã©ãŒãããã«å€æããããšã§ãã¢ãã«ã®äºææ§ãšé åã®æè»æ§ãæ¡å€§ã§ããŸãã
ã€ã³ã¹ããŒã«
å¿ èŠãªããã±ãŒãžãã€ã³ã¹ããŒã«ããã«ã¯ã以äžãå®è¡ããïŒ
ã€ã³ã¹ããŒã«ããã»ã¹ã«é¢ãã詳ãã説æãšãã¹ããã©ã¯ãã£ã¹ã«ã€ããŠã¯ãYOLO11 ã€ã³ã¹ããŒã«ã¬ã€ããã芧ãã ãããYOLO11 ã«å¿ èŠãªããã±ãŒãžãã€ã³ã¹ããŒã«ããéã«ãäœããã®åé¡ãçºçããå Žåã¯ã解決çããã³ãã«ã€ããŠãããããåé¡ã¬ã€ããåç §ããŠãã ããã
䜿çšæ¹æ³
䜿ãæ¹ã®èª¬æã«å ¥ãåã«ã Ultralytics ãæäŸããYOLO11 ã¢ãã«ã®ã©ã€ã³ããããã確èªãã ãããããã¯ãããªãã®ãããžã§ã¯ãã®èŠä»¶ã«æãé©ããã¢ãã«ãéžæããã®ã«åœ¹ç«ã¡ãŸãã
䜿çšæ¹æ³
from ultralytics import YOLO
# Load the YOLO11 model
model = YOLO("yolo11n.pt")
# Export the model to ONNX format
model.export(format="onnx") # creates 'yolo11n.onnx'
# Load the exported ONNX model
onnx_model = YOLO("yolo11n.onnx")
# Run inference
results = onnx_model("https://ultralytics.com/images/bus.jpg")
ãšã¯ã¹ããŒãããã»ã¹ã®è©³çŽ°ã«ã€ããŠã¯ãUltralytics ããã¥ã¡ã³ãã®ãšã¯ã¹ããŒãã«é¢ããããŒãžãã芧ãã ããã
ãšã¯ã¹ããŒããããYOLO11 ONNX ã¢ãã«ã®å±é
Ultralytics YOLO11 ã®ã¢ãã«ãONNX ãã©ãŒãããã«ãšã¯ã¹ããŒãããããšã«æåãããã次ã®ã¹ãããã¯ãããã®ã¢ãã«ãæ§ã ãªç°å¢ã«é 眮ããããšã§ããONNX ã¢ãã«ã®ãããã€ã«é¢ãã詳ãã説æã¯ã以äžã®ãªãœãŒã¹ãã芧ãã ããïŒ
-
ONNX ã©ã³ã¿ã€ã Python API ããã¥ã¡ã³ã:ãã®ã¬ã€ãã¯ãONNX Runtimeã䜿çšããŠONNX ã¢ãã«ãããŒãããå®è¡ããããã®éèŠãªæ å ±ãæäŸããŸãã
-
ãšããžããã€ã¹ãžã®å±é:ONNX ã¢ãã«ã®ãšããžããã€ã¹ãžã®å±éã«é¢ããããŸããŸãªäŸã«ã€ããŠã¯ããã¡ãã®ããã¥ã¡ã³ãããŒãžãã芧ãã ããã
-
ONNX GitHubã®ãã¥ãŒããªã¢ã«:ONNX ã¢ãã«ã®ããŸããŸãªã·ããªãªã§ã®äœ¿çšãšå®è£ ã®ããŸããŸãªåŽé¢ãã«ããŒããå æ¬çãªãã¥ãŒããªã¢ã«ã®ã³ã¬ã¯ã·ã§ã³ã
æŠèŠ
ãã®ã¬ã€ãã§ã¯ãUltralytics YOLO11 ã¢ãã«ãONNX ãã©ãŒãããã«ãšã¯ã¹ããŒãããŠãããŸããŸãªãã©ãããã©ãŒã ã§ã®çžäºéçšæ§ãšããã©ãŒãã³ã¹ãåäžãããæ¹æ³ãåŠã³ãŸããããŸããONNX Runtime ããã³ONNX é 眮ãªãã·ã§ã³ã«ã€ããŠã玹ä»ããŸããã
䜿ãæ¹ã®è©³çŽ°ã«ã€ããŠã¯ãONNX å ¬åŒããã¥ã¡ã³ããã芧ãã ããã
ãŸãããã®ä»ã®Ultralytics YOLO11 ã®çµ±åã«ã€ããŠè©³ãããç¥ãã«ãªãããå Žåã¯ãçµ±åã¬ã€ãã®ããŒãžãã芧ãã ãããæçšãªãªãœãŒã¹ãèŠèãããããèŠã€ãããŸãã
ããããã質å
Ultralytics ã䜿ã£ãŠãYOLO11 ã®ã¢ãã«ãONNX ãã©ãŒãããã«ãšã¯ã¹ããŒãããã«ã¯ïŒ
Ultralytics ã䜿çšããŠYOLO11 ã¢ãã«ãONNX ãã©ãŒãããã«ãšã¯ã¹ããŒãããã«ã¯ã以äžã®æé ã«åŸããŸãïŒ
䜿çšæ¹æ³
from ultralytics import YOLO
# Load the YOLO11 model
model = YOLO("yolo11n.pt")
# Export the model to ONNX format
model.export(format="onnx") # creates 'yolo11n.onnx'
# Load the exported ONNX model
onnx_model = YOLO("yolo11n.onnx")
# Run inference
results = onnx_model("https://ultralytics.com/images/bus.jpg")
詳ããã¯ã茞åºã«é¢ããææžãã芧ãã ããã
YOLO11 ã¢ãã«ã®ãããã€ã«ONNX Runtime ã䜿çšããå©ç¹ã¯äœã§ããïŒ
YOLO11 ã¢ãã«ã®å±éã«ONNX Runtime ã䜿çšãããšãããã€ãã®å©ç¹ãããïŒ
- ã¯ãã¹ãã©ãããã©ãŒã ã®äºææ§ïŒONNX ã©ã³ã¿ã€ã ã¯WindowsãmacOSãLinuxãªã©æ§ã ãªãã©ãããã©ãŒã ããµããŒãããŠãããç°ãªãç°å¢ã§ãã¢ãã«ãã¹ã ãŒãºã«åäœããããšãä¿èšŒããŸãã
- ããŒããŠã§ã¢ã¢ã¯ã»ã©ã¬ãŒã·ã§ã³ïŒONNX ã©ã³ã¿ã€ã ã¯ãCPUãGPUãå°çšã¢ã¯ã»ã©ã¬ãŒã¿ã®ããŒããŠã§ã¢åºæã®æé©åã掻çšããé«æ§èœãªæšè«ãæäŸããããšãã§ããã
- ãã¬ãŒã ã¯ãŒã¯ã®çžäºéçšæ§ïŒã®ãããªäžè¬çãªãã¬ãŒã ã¯ãŒã¯ã§åŠç¿ãããã¢ãã«ã¯ PyTorchãTensorFlow ã®ãããªäžè¬çãªãã¬ãŒã ã¯ãŒã¯ã§åŠç¿ãããã¢ãã«ã¯ãONNX 圢åŒã«ç°¡åã«å€æã§ããONNX Runtime ã䜿ã£ãŠå®è¡ã§ããã
詳ããã¯ãONNX ã©ã³ã¿ã€ã ã®ããã¥ã¡ã³ããã芧ãã ããã
ONNX ã«ãšã¯ã¹ããŒããããYOLO11 ã¢ãã«ã«ã¯ãã©ã®ãããªå±éãªãã·ã§ã³ããããŸããïŒ
YOLO11 ONNX ã«ãšã¯ã¹ããŒããããã¢ãã«ã¯ã以äžã®ãããªããŸããŸãªãã©ãããã©ãŒã ã«å±éã§ããïŒ
- CPUïŒCPU æšè«ãæé©åããããã®ONNX ã©ã³ã¿ã€ã ã®æŽ»çšã
- GPUïŒLeveragingNVIDIA CUDA for high-performanceGPU acceleration.
- ãšããžããã€ã¹ïŒãšããžããã€ã¹ãã¢ãã€ã«ããã€ã¹äžã§è»œéã¢ãã«ãå®è¡ãããªã¢ã«ã¿ã€ã ã§ããã€ã¹äžã§ã®æšè«ãè¡ãã
- ãŠã§ããã©ãŠã¶ïŒã€ã³ã¿ã©ã¯ãã£ããªãŠã§ãããŒã¹ã®ã¢ããªã±ãŒã·ã§ã³ã®ããã«ããŠã§ããã©ãŠã¶å ã§çŽæ¥ã¢ãã«ãå®è¡ããã
詳ããã¯ãã¢ãã«å±éãªãã·ã§ã³ã«é¢ããã¬ã€ããã芧ãã ããã
Ultralytics YOLO11 ã¢ãã«ã«ONNX ãã©ãŒãããã䜿çšããã®ã¯ãªãã§ããïŒ
Ultralytics YOLO11 ã¢ãã«ã«ONNX ãã©ãŒãããã䜿çšãããšãå€ãã®å©ç¹ãããïŒ
- çžäºéçšæ§ïŒONNX ã¯ãç°ãªãæ©æ¢°åŠç¿ãã¬ãŒã ã¯ãŒã¯éã§ã¢ãã«ãã·ãŒã ã¬ã¹ã«è»¢éããããšãå¯èœã«ããã
- ããã©ãŒãã³ã¹ã®æé©åïŒONNX ã©ã³ã¿ã€ã ã¯ãããŒããŠã§ã¢åºæã®æé©åãå©çšããããšã§ãã¢ãã«ã®ããã©ãŒãã³ã¹ãåäžãããããšãã§ããã
- æè»æ§:ONNX ã¯æ§ã ãªå±éç°å¢ããµããŒãããŠãããç°ãªããã©ãããã©ãŒã äžã§ãåãã¢ãã«ãå€æŽããããšãªã䜿çšããããšãã§ããŸãã
YOLO11 ã¢ãã«ã®ONNX ãžã®ãšã¯ã¹ããŒãã«é¢ããå æ¬çãªã¬ã€ããåç §ããŠãã ããã
YOLO11 ã®ã¢ãã«ãONNX ã«ãšã¯ã¹ããŒãããéã®åé¡ã®ãã©ãã«ã·ã¥ãŒãã£ã³ã°ã¯ã©ãããã°ããã§ããïŒ
YOLO11 ã¢ãã«ãONNX ã«ãšã¯ã¹ããŒãããéãäŸåé¢ä¿ã®äžäžèŽããµããŒããããŠããªãæäœãªã©ã®äžè¬çãªåé¡ãçºçããããšããããŸãããããã®åé¡ã解決ããã«ã¯
- å¿ èŠãªäŸåé¢ä¿ãæ£ããããŒãžã§ã³ã§ã€ã³ã¹ããŒã«ãããŠããããšã確èªããã
- ãµããŒããããŠãããªãã¬ãŒã¿ãŒãæ©èœã«ã€ããŠã¯ãONNX ã®å ¬åŒããã¥ã¡ã³ããã確èªãã ããã
- ãã³ããšãªããšã©ãŒã¡ãã»ãŒãžã確èªããUltralytics ãããããåé¡ãã¬ã€ããåç §ããŠãã ããã
åé¡ã解決ããªãå Žåã¯ãUltralytics ãµããŒãã«ãåãåãããã ããã