YOLO ããããåé¡ã®ãã©ãã«ã·ã¥ãŒãã£ã³ã°
ã¯ããã«
ãã®ã¬ã€ãã¯ãUltralytics ã®ãããžã§ã¯ãã§YOLO11 ã䜿çšããŠãããšãã«ééããäžè¬çãªåé¡ã®ãã©ãã«ã·ã¥ãŒãã£ã³ã°ãè¡ãããã®å æ¬çãªæ¯æŽãšãªããŸããé©åãªã¬ã€ãã³ã¹ãããã°ããããã®åé¡ãç°¡åã«è§£æ±ºããããšãã§ãããããžã§ã¯ããäžå¿ èŠãªé 延ãªãã«è»éã«ä¹ãããšãä¿èšŒããŸãã
èŠããã ïŒ Ultralytics YOLO11 äžè¬çãªåé¡ïœã€ã³ã¹ããŒã«ãšã©ãŒãã¢ãã«ãã¬ãŒãã³ã°ã®åé¡
ããããåé¡
ã€ã³ã¹ããŒã«ãšã©ãŒ
ã€ã³ã¹ããŒã«ãšã©ãŒã¯ãäºææ§ã®ãªãããŒãžã§ã³ãäŸåé¢ä¿ã®æ¬ èœãäžé©åãªç°å¢èšå®ãªã©ãããŸããŸãªçç±ã§çºçããå¯èœæ§ããããŸãããŸãã以äžã®ããšã確èªããŠãã ããïŒ
-
æšå¥šãããŠããPython 3.8以éã䜿çšããŠããŸãã
-
æ£ããããŒãžã§ã³ã® PyTorch(1.8以é)ãã€ã³ã¹ããŒã«ãããŠããããšã確èªããŠãã ããã
-
ã³ã³ããªã¯ããé¿ãããããä»®æ³ç°å¢ã®å©çšãæ€èšããã
-
å ¬åŒã®ã€ã³ã¹ããŒã«ã¬ã€ãã«åŸã£ãŠã¹ããããã€ã¹ãããã§ã€ã³ã¹ããŒã«ããŸãã
ããã«ããŠãŒã¶ãŒãééããäžè¬çãªã€ã³ã¹ããŒã«ã®åé¡ãšãããããã®è§£æ±ºçãã玹ä»ããŸãïŒ
-
ã€ã³ããŒããšã©ãŒãŸãã¯äŸåé¢ä¿ã®åé¡ -YOLO11 ã®ã€ã³ããŒãäžã«ãšã©ãŒãçºçããå ŽåããŸãã¯äŸåé¢ä¿ã«é¢é£ããåé¡ãçºçããå Žåã¯ã以äžã®ãã©ãã«ã·ã¥ãŒãã£ã³ã°æé ãæ€èšããŠãã ããïŒ
-
æ°èŠã€ã³ã¹ããŒã«ïŒæ°èŠã€ã³ã¹ããŒã«ããå§ããããšã§ãäºæãã¬åé¡ã解決ããããšããããŸããç¹ã«ãUltralytics ã®ãããªã©ã€ãã©ãªã§ã¯ãã¢ããããŒãã«ãã£ãŠãã¡ã€ã«ããªãŒæ§é ãæ©èœã«å€æŽãå ããããå¯èœæ§ããããŸãã
-
å®æçãªã¢ããããŒãïŒã©ã€ãã©ãªã®ææ°ããŒãžã§ã³ã䜿çšããŠããããšã確èªããŠãã ãããå€ãããŒãžã§ã³ã¯æè¿ã®ã¢ããããŒããšäºææ§ããªããã³ã³ããªã¯ããåé¡ãçºçããå¯èœæ§ããããŸãã
-
äŸåé¢ä¿ããã§ãã¯ããïŒãã¹ãŠã®å¿ èŠãªäŸåé¢ä¿ãæ£ããã€ã³ã¹ããŒã«ãããäºææ§ã®ããããŒãžã§ã³ã§ããããšã確èªããŸãã
-
å€æŽç¹ã®ç¢ºèªæåã«å€ãããŒãžã§ã³ãã¯ããŒã³ãŸãã¯ã€ã³ã¹ããŒã«ããå ŽåãéèŠãªã¢ããããŒããã©ã€ãã©ãªã®æ§é ãæ©èœã«åœ±é¿ãäžããå¯èœæ§ãããããšã«æ³šæããŠãã ãããäž»èŠãªå€æŽç¹ãç解ããããã«ãåžžã«å ¬åŒããã¥ã¡ã³ããå€æŽå±¥æŽãåç §ããŠãã ããã
-
ã©ã€ãã©ãªãšäŸåé¢ä¿ãåžžã«ææ°ã«ä¿ã€ããšã¯ãã¹ã ãŒãºã§ãšã©ãŒã®ãªããšã¯ã¹ããªãšã³ã¹ã®ããã«éåžžã«éèŠã§ããããšãå¿ããªãã§ãã ããã
-
-
GPU äžã§YOLO11 ãå®è¡ãã -GPU äžã§YOLO11 ã®å®è¡ã«åé¡ãããå Žåã¯ã以äžã®ãã©ãã«ã·ã¥ãŒãã£ã³ã°æé ãæ€èšããŠãã ããïŒ
-
CUDA äºææ§ãšã€ã³ã¹ããŒã«ã確èªãã:GPU ãCUDA ãšäºææ§ããããCUDA ãæ£ããã€ã³ã¹ããŒã«ãããŠããããšã確èªããŠãã ãããã䜿çšããŠãã ããã
nvidia-smi
ã³ãã³ãã䜿çšããŠãNVIDIA GPU ãšCUDA ããŒãžã§ã³ã®ã¹ããŒã¿ã¹ã確èªããŠãã ããã -
PyTorch ãšCUDA ã®çµ±åããã§ãã¯:PyTorch ãCUDA ãå©çšã§ããããã«ããã
import torch; print(torch.cuda.is_available())
ãPython ã¿ãŒããã«ã§å®è¡ããããã'True'ãè¿ãã°ãPyTorch ã¯CUDA ã䜿ãããã«èšå®ãããŠããã -
ç°å¢ã®æå¹åïŒå¿ èŠãªããã±ãŒãžããã¹ãŠã€ã³ã¹ããŒã«ãããŠããæ£ããç°å¢ã«ããããšã確èªããã
-
ããã±ãŒãžãæŽæ°ããŠãã ããïŒå€ãããã±ãŒãžã¯ããªãã®GPU ãšäºææ§ããªããããããŸãããåžžã«æŽæ°ããŠãã ããã
-
ããã°ã©ã ã®æ§æïŒããã°ã©ã ãŸãã¯ã³ãŒããGPU ãYOLO11 ã§ã¯ãããã¯èšå®ãæ§æã«ãããããããªãã
-
ã¢ãã«ãã¬ãŒãã³ã°ã®åé¡
ãã®ã»ã¯ã·ã§ã³ã§ã¯ããã¬ãŒãã³ã°äžã«çŽé¢ããäžè¬çãªåé¡ãšãããããã®èª¬æãšè§£æ±ºçãåãäžããã
ã³ã³ãã£ã®ã¥ã¬ãŒã·ã§ã³èšå®ã®æ€èšŒ
åé¡:ã®ã³ã³ãã£ã®ã¥ã¬ãŒã·ã§ã³èšå®ãæ£ãããã©ããããããªãã .yaml
ãã¡ã€ã«ãã¢ãã«ãã¬ãŒãã³ã°äžã«æ£ããé©çšãããŠãããã©ããã確èªããã
ãœãªã¥ãŒã·ã§ã³:ã®ã³ã³ãã£ã®ã¥ã¬ãŒã·ã§ã³èšå®ã¯ .yaml
ãã¡ã€ã«ãé©çšããå¿
èŠãããã model.train()
é¢æ°ã䜿çšããŠãã ããããããã®èšå®ãæ£ããé©çšãããŠããããšã確èªããã«ã¯ã以äžã®æé ã«åŸã£ãŠãã ããïŒ
- ã®ãã¹ã確èªããŠãã ããã
.yaml
èšå®ãã¡ã€ã«ã¯æ£ããã - ãžã®ãã¹ãæž¡ããŠãã ããã
.yaml
ãã¡ã€ã«ãdata
ãåŒã³åºãéã®åŒæ°ã§ãããmodel.train()
以äžã®ããã«ïŒ
ãã«ãGPUã«ãããã¬ãŒãã³ã°ã®é«éå
課é¡ãã¬ãŒãã³ã°ãã·ã³ã°ã«GPU ã§é ããããè€æ°ã®GPUã䜿çšããŠããã»ã¹ãé«éåãããã
解決ç ããããµã€ãºã倧ããããããšã§ãã¬ãŒãã³ã°ãé«éåã§ããŸãããGPU ã¡ã¢ãªå®¹éãèæ ®ããããšãäžå¯æ¬ ã§ããè€æ°ã®GPUã§ãã¬ãŒãã³ã°ãé«éåããã«ã¯ã以äžã®æé ã«åŸããŸãïŒ
-
è€æ°ã®GPUãå©çšå¯èœã§ããããšã確èªããŠãã ããã
-
.yamlèšå®ãã¡ã€ã«ãä¿®æ£ããŠã䜿çšããGPUã®æ°ãæå®ããŸãïŒäŸïŒgpusïŒïŒ4.
-
ã¡ã¢ãªå¶éãè¶ ããããšãªãè€æ°ã®GPUããã«ã«æŽ»çšããããã«ãããããµã€ãºãé©å®å€§ããããŸãã
-
è€æ°ã®GPUãå©çšããããã«ãã¬ãŒãã³ã°ã³ãã³ããä¿®æ£ããïŒ
# Adjust the batch size and other settings as needed to optimize training speed
model.train(data="/path/to/your/data.yaml", batch=32, multi_scale=True)
é£ç¶ã¢ãã¿ãªã³ã°ã»ãã©ã¡ãŒã¿ãŒ
åé¡ãã¬ãŒãã³ã°äžã«ãæ倱ãšã¯å¥ã«ãã©ã®ãã©ã¡ãŒã¿ãŒãç¶ç¶çã«ã¢ãã¿ãŒãã¹ãããç¥ãããã
解決çæ倱ã¯ç£èŠãã¹ãéèŠãªææšã§ãããã¢ãã«ã®ããã©ãŒãã³ã¹ãæé©åããããã«ã¯ãä»ã®ææšã远跡ããããšãäžå¯æ¬ ã§ãããã¬ãŒãã³ã°äžã«ç£èŠãã¹ãäž»ãªææšã«ã¯ã以äžã®ãããªãã®ããããŸãïŒ
- 粟å¯
- ãªã³ãŒã«
- å¹³åå¹³å粟床ïŒmAPïŒ
ãããã®ã¡ããªã¯ã¹ã«ã¯ããã¬ãŒãã³ã°ãã°ããã¢ã¯ã»ã¹ããããTensorBoardãwandbã®ãããªããŒã«ã䜿ã£ãŠå¯èŠåããããšãã§ããŸãããããã®ã¡ããªã¯ã¹ã«åºã¥ããŠæ©æåæ¢ãå®æœããããšã§ãããè¯ãçµæãåŸãããšãã§ããŸãã
ãã¬ãŒãã³ã°ã®é²æã远跡ããããŒã«
åé¡ãã¬ãŒãã³ã°ã®é²æç¶æ³ã远跡ããããã®æšå¥šããŒã«ãæ¢ããŠããã
解決çãã¬ãŒãã³ã°ã®é²æç¶æ³ã远跡ããèŠèŠåããã«ã¯ã以äžã®ããŒã«ã®äœ¿çšãæ€èšããããšãã§ããŸãïŒ
- TensorBoardïŒTensorBoardã¯ãæ倱ã粟床ãªã©ã®ãã¬ãŒãã³ã°ã¡ããªã¯ã¹ãå¯èŠåããããã®äžè¬çãªéžæè¢ã§ããYOLO11 ãã¬ãŒãã³ã°ããã»ã¹ãšçµ±åããããšãã§ããŸãã
- Comet:Comet ã¯ãå®éšã®è¿œè·¡ãšæ¯èŒã®ããã®åºç¯ãªããŒã«ããããæäŸããŸããã¡ããªã¯ã¹ããã€ããŒãã©ã¡ãŒã¿ããããŠã¢ãã«ã®éã¿ãŸã§è¿œè·¡ããããšãã§ããŸããYOLO ã¢ãã«ãšã®çµ±åãç°¡åã§ãå®éšãµã€ã¯ã«ã®å®å šãªæŠèŠãæäŸããŸãã
- Ultralytics HUB:Ultralytics HUBã¯ãYOLO ã¢ãã«ã®ãã©ããã³ã°ã«ç¹åããç°å¢ãæäŸããã¡ããªã¯ã¹ãããŒã¿ã»ããã®ç®¡çãããã«ã¯ããŒã ãšã®ã³ã©ãã¬ãŒã·ã§ã³ãã¯ã³ã¹ãããã§è¡ãããã©ãããã©ãŒã ãæäŸãããYOLO ã«ç¹åããŠãããããããã«ã¹ã¿ãã€ãºããã远跡ãªãã·ã§ã³ãæäŸããã
ãããã®ããŒã«ã«ã¯ããããå©ç¹ãããããããããžã§ã¯ãã®å ·äœçãªããŒãºãèæ ®ããŠéžæãããšããã ããã
ãã¬ãŒãã³ã°ãè¡ãããŠãããã©ããã確èªããæ¹æ³GPU
åé¡ãã¬ãŒãã³ã°ãã°ã®'device'ã®å€ã'null'ã§ããããã¬ãŒãã³ã°ãGPU ã
解決æ¹æ³device'å€ã'null'ã§ããããšã¯ãéåžžããã¬ãŒãã³ã°ã»ããã»ã¹ãèªåçã«å©çšå¯èœãªGPU ã䜿çšããããã«èšå®ãããŠããããšãæå³ããŸãïŒããã¯ããã©ã«ãã®åäœã§ãïŒãç¹å®ã®GPU ã§ãã¬ãŒãã³ã°ãè¡ãããããã«ããã«ã¯ã.yaml æ§æãã¡ã€ã«ã§ã'device' å€ãGPU ã®ã€ã³ããã¯ã¹ïŒäŸãã°ãæåã®GPU ã®å Žå㯠'0' ïŒã«æåã§èšå®ããŸãïŒ
ããã«ããããã¬ãŒãã³ã°ããã»ã¹ãæå®ãããGPU ã«æ瀺çã«å²ãåœãŠããããCPU ã§ãã¬ãŒãã³ã°ãããå Žåã¯ã'device' ã 'cpu' ã«èšå®ããã
ãã¬ãŒãã³ã°ã®é²æç¶æ³ãå¹æçã«ã¢ãã¿ãŒããããã«ããrunsããã©ã«ãã§ãã°ãææšã確èªããŸãããã
å¹æçãªã¢ãã«ãã¬ãŒãã³ã°ã®ããã®äž»ãªèæ ®äºé
ã¢ãã«ãã¬ãŒãã³ã°ã«é¢ããåé¡ã«çŽé¢ããŠããå Žåãçæãã¹ãç¹ãããã€ãæããŠã¿ããã
ããŒã¿ã»ããã»ãã©ãŒããããšã©ãã«
-
éèŠæ§æ©æ¢°åŠç¿ã¢ãã«ã®åºç€ã¯ãåŠç¿ãããããŒã¿ã®è³ªãšåœ¢åŒã«ããã
-
æšå¥šã«ã¹ã¿ã ã»ããŒã¿ã»ãããšããã«é¢é£ããã©ãã«ããæåŸ ããããã©ãŒãããã«åŸã£ãŠããããšã確èªããŠãã ãããã¢ãããŒã·ã§ã³ãæ£ç¢ºã§é«å質ã§ããããšã確èªããããšã¯æ¥µããŠéèŠã§ããäžæ£ç¢ºãªã¢ãããŒã·ã§ã³ãå£æªãªã¢ãããŒã·ã§ã³ã¯ãã¢ãã«ã®åŠç¿ããã»ã¹ãçãããäºæž¬äžå¯èœãªçµæãæãå¯èœæ§ããããŸãã
ã¢ãã«ã®åæ
-
éèŠæ§ã¢ãã«ã®åæãéæããããšã¯ãã¢ãã«ãèšç·ŽããŒã¿ããååã«åŠç¿ããããšãä¿èšŒããã
-
æšå¥šã¢ãã«ãããŒãããããã¬ãŒãã³ã°ããå Žåãã¢ãã«ãæºè¶³ã®ããã¬ãã«ã«åæããããšã確èªããããšãéèŠã§ãããã®ããã«ã¯ãæ¢åã®ã¢ãã«ã埮調æŽããå Žåããããããå€ãã®ãšããã¯ã§ãããé·ããã¬ãŒãã³ã°æéãå¿ èŠã«ãªããããããŸããã
åŠç¿çãšããããµã€ãº
-
éèŠã§ããïŒãããã®ãã€ããŒãã©ã¡ãŒã¿ã¯ãåŠç¿äžã«ã¢ãã«ãã©ã®ããã«éã¿ãæŽæ°ãããã決å®ããäžã§æ¥µããŠéèŠãªåœ¹å²ãæããã
-
æšå¥šéžæããåŠç¿ã¬ãŒããšãããã»ãµã€ãºãç¹å®ã®ããŒã¿ã»ããã«æé©ãã©ãããå®æçã«è©äŸ¡ãããããŒã¿ã»ããã®ç¹æ§ãšèª¿åããŠããªããã©ã¡ãŒã¿ã¯ãã¢ãã«ã®ããã©ãŒãã³ã¹ã劚ããå¯èœæ§ãããã
ã¯ã©ã¹ååž
-
éèŠæ§ããŒã¿ã»ããå ã®ã¯ã©ã¹ã®ååžã¯ãã¢ãã«ã®äºæž¬åŸåã«åœ±é¿ãäžããŸãã
-
æšå¥šããŒã¿ã»ããå ã®ã¯ã©ã¹ååžãå®æçã«è©äŸ¡ããŸããããã¯ã©ã¹ã®ãã©ã³ã¹ãæªããšãã¢ãã«ãããåªå¢ãªã¯ã©ã¹ã«ãã€ã¢ã¹ãããããªã¹ã¯ããããŸãããã®ãã€ã¢ã¹ã¯æ··åè¡åã§æããã«ãªãããšããããããã§ã¯ã¢ãã«ãå€æ°æŽŸã®ã¯ã©ã¹ãåªå¢ã«äºæž¬ãããããããŸããã
äºåèšç·Žãããéã¿ãšã®ã¯ãã¹ãã§ãã¯
-
éèŠæ§äºåã«èšç·Žãããéã¿ã掻çšããããšã§ãç¹ã«ããŒã¿ãéãããŠããå Žåã«ãã¢ãã«ãã¬ãŒãã³ã°ã®ç¢ºããªåºçºç¹ãæäŸããããšãã§ããã
-
æšå¥šèšºæã®ã¹ããããšããŠãåãããŒã¿ã䜿ã£ãŠã¢ãã«ããã¬ãŒãã³ã°ããŸãããäºåã«ãã¬ãŒãã³ã°ããéã¿ã§åæåããããšãæ€èšããŠãã ããããã®ã¢ãããŒãã§æ··åè¡åãããŸã圢æãããå ŽåãããŒããããã¢ãã«ã¯ãããªããã¬ãŒãã³ã°ã調æŽãå¿ èŠãããããªãããšã瀺åããŸãã
ã¢ãã«äºæž¬ã«é¢ããåé¡
ãã®ã»ã¯ã·ã§ã³ã§ã¯ãã¢ãã«ã®äºæž¬äžã«çŽé¢ããäžè¬çãªåé¡ãåãäžããã
YOLO11 ã«ã¹ã¿ã ã¢ãã«ã§ããŠã³ãã£ã³ã°ããã¯ã¹ã®äºæž¬ãåŸã
åé¡ã«ã¹ã¿ã YOLO11 ã¢ãã«ã§äºæž¬ãå®è¡ããå ŽåãããŠã³ãã£ã³ã°ããã¯ã¹åº§æšã®ãã©ãŒããããšèŠèŠåã«èª²é¡ããããŸãã
解決ç
- 座æšåœ¢åŒ ïŒYOLO11 ã§ã¯ã å€æ¥æ 座æšã絶察 ã 㯠ã»ã«å€ã§äžã ã ããŸããã ã ã ãçžå¯Ÿåº§æš ïŒ0 ã ã 1 㟠ã§ïŒ ã«å€æã ã ã«ã¯ã ç»å寞æ³ã§å² ã å¿ èŠãã ã ãŸããã ãš ãã°ã ç»å㵠〠㺠ã 640x640 ãš ã 㟠ã ã ã ããããããšã次ã®ããã«ãªããŸãïŒ
# Convert absolute coordinates to relative coordinates
x1 = x1 / 640 # Divide x-coordinates by image width
x2 = x2 / 640
y1 = y1 / 640 # Divide y-coordinates by image height
y2 = y2 / 640
- ãã¡ã€ã«åïŒãã¡ã€ã«åïŒäºæž¬ããŠããç»åã®ãã¡ã€ã«åãååŸããã«ã¯ãäºæž¬ã«ãŒãå ã®çµæãªããžã§ã¯ãããçŽæ¥ç»åãã¡ã€ã«ãã¹ã«ã¢ã¯ã»ã¹ããŸãã
YOLO11 äºæž¬ã«ããããªããžã§ã¯ãã®ãã£ã«ã¿ãªã³ã°
åé¡ Ultralytics ã©ã€ãã©ãªã䜿çšããŠYOLO11 ãå®è¡ããéãäºæž¬çµæã«ç¹å®ã®ãªããžã§ã¯ãã®ã¿ããã£ã«ã¿ãªã³ã°ããŠè¡šç€ºããæ¹æ³ã«é¢ããåé¡ã
解決çç¹å®ã®ã¯ã©ã¹ãæ€åºããã«ã¯ãclass åŒæ°ã䜿çšããŠãåºåã«å«ãããã¯ã©ã¹ãæå®ããŸããäŸãã°ãè»ã ããæ€åºããå ŽåïŒ'cars'ãã¯ã©ã¹ã»ã€ã³ããã¯ã¹2ãæã£ãŠãããšä»®å®ïŒïŒ
é«ç²ŸåºŠã®ææšãç解ããYOLO11
åé¡ YOLO11 ã«ãããããã¯ã¹ç²ŸåºŠããã¹ã¯ç²ŸåºŠãæ··åè¡å粟床ã®éãã«é¢ããæ··ä¹±ã
ãœãªã¥ãŒã·ã§ã³ããã¯ã¹ç²ŸåºŠã¯ãIoU(Intersection over Union)ãææšãšããŠãäºæž¬ãããããŠã³ãã£ã³ã°ããã¯ã¹ã®ç²ŸåºŠããå®éã®ã°ã©ã³ããã¥ã«ãŒã¹ããã¯ã¹ãšæ¯èŒããŠæž¬å®ããŸãããã¹ã¯ç²ŸåºŠã¯ããã¯ã»ã«åäœã®ãªããžã§ã¯ãåé¡ã«ãããŠãäºæž¬ãããã»ã°ã¡ã³ããŒã·ã§ã³ãã¹ã¯ãšã°ã©ã³ããã¥ã«ãŒã¹ãã¹ã¯ã®äžèŽåºŠãè©äŸ¡ããŸããäžæ¹ãã³ã³ãã¥ãŒãžã§ã³ã»ãããªã¯ã¹ã®ç²ŸåºŠã¯ããã¹ãŠã®ã¯ã©ã¹ã«ãããå šäœçãªåé¡ç²ŸåºŠã«çŠç¹ãåœãŠãäºæž¬ã®å¹ŸäœåŠç粟床ã¯èæ ®ããŸãããã¯ã©ã¹äºæž¬ãééã£ãŠããŠããããŠã³ãã£ã³ã°ã»ããã¯ã¹ã幟äœåŠçã«æ£ç¢ºïŒtrue positiveïŒã§ããããšãããããããããã¯ã¹ç²ŸåºŠãšæ··åè¡å粟床ã®éãã«ã€ãªããããšã«æ³šæããããšãéèŠã§ãããããã®ã¡ããªã¯ã¹ã¯ãã¢ãã«ã®æ§èœã®ç°ãªãåŽé¢ãè©äŸ¡ããæ§ã ãªã¿ã¹ã¯ã§ç°ãªãè©äŸ¡ã¡ããªã¯ã¹ã®å¿ èŠæ§ãåæ ããŠããŸãã
ãªããžã§ã¯ãã®å¯žæ³ã®æœåºYOLO11
èª²é¡ YOLO11 ã«ãããŠãæ€åºããããªããžã§ã¯ãã®é·ããšé«ããååŸããããšãå°é£ãç¹ã«ãç»åå ã§è€æ°ã®ãªããžã§ã¯ããæ€åºãããå Žåã
解決æ¹æ³ããŠã³ãã£ã³ã°ããã¯ã¹ã®å¯žæ³ãååŸããã«ã¯ããŸãUltralytics YOLO11 ã¢ãã«ã䜿ã£ãŠç»åå ã®ãªããžã§ã¯ããäºæž¬ããã次ã«ãäºæž¬çµæããããŠã³ãã£ã³ã°ããã¯ã¹ã®å¹ ãšé«ãã®æ å ±ãæœåºããŸãã
from ultralytics import YOLO
# Load a pre-trained YOLO11 model
model = YOLO("yolo11n.pt")
# Specify the source image
source = "https://ultralytics.com/images/bus.jpg"
# Make predictions
results = model.predict(source, save=True, imgsz=320, conf=0.5)
# Extract bounding box dimensions
boxes = results[0].boxes.xywh.cpu()
for box in boxes:
x, y, w, h = box
print(f"Width of Box: {w}, Height of Box: {h}")
é åã®èª²é¡
GPU é åã®åé¡
åé¡ãã«ãGPU ç°å¢ã§ã¢ãã«ããããã€ãããšãäºæããªãã¡ã¢ãªäœ¿çšãGPUéã§äžè²«æ§ã®ãªãçµæãªã©ãäºæããªãåäœãçºçããããšããããŸãã
解決çããã©ã«ãã®GPU åæåããã§ãã¯ããŠãã ãããPyTorch ã®ãããªããã€ãã®ãã¬ãŒã ã¯ãŒã¯ã¯ãæå®ããã GPU ã«ç§»è¡ããåã«ãããã©ã«ãã®GPU ã§CUDA æäœãåæåãããããããŸãããäºæããªãããã©ã«ãã®åæåãåé¿ããã«ã¯ããããã€ãšäºæž¬äžã«GPU ãçŽæ¥æå®ããŸãããã®åŸãGPU å©çšçãšã¡ã¢ãªäœ¿çšéãç£èŠããããŒã«ã䜿çšããŠããªã¢ã«ã¿ã€ã ã§ç°åžžãç¹å®ããŸãããŸãããã¬ãŒã ã¯ãŒã¯ãŸãã¯ã©ã€ãã©ãªã®ææ°ããŒãžã§ã³ã䜿çšããŠããããšã確èªããŸãã
ã¢ãã«å€æ/ãšã¯ã¹ããŒãã®åé¡
åé¡æ©æ¢°åŠç¿ã¢ãã«ãç°ãªããã©ãŒãããããã©ãããã©ãŒã ã«å€æãŸãã¯ãšã¯ã¹ããŒãããéçšã§ããŠãŒã¶ãŒããšã©ãŒãäºæãã¬åäœã«ééããå¯èœæ§ãããã
解決ç
-
äºææ§ã®ãã§ãã¯ïŒã©ã€ãã©ãªãšãã¬ãŒã ã¯ãŒã¯ã®ããŒãžã§ã³ãäºãã«äºææ§ãããããšã確èªããŠãã ãããããŒãžã§ã³ãäžäžèŽã®å Žåãå€ææã«äºæãã¬ãšã©ãŒãçºçããå¯èœæ§ããããŸãã
-
ç°å¢ã®ãªã»ããïŒJupyterãColabã®ãããªã€ã³ã¿ã©ã¯ãã£ãç°å¢ã䜿çšããŠããå Žåãå€§å¹ ãªå€æŽãã€ã³ã¹ããŒã«ãè¡ã£ãåŸã¯ãç°å¢ã®åèµ·åãæ€èšããŠãã ãããåã¹ã¿ãŒãããããšã§ãæ ¹æ¬çãªåé¡ã解決ããããšããããŸãã
-
å ¬åŒããã¥ã¡ã³ãïŒå€æã«äœ¿çšããããŒã«ãã©ã€ãã©ãªã®å ¬åŒããã¥ã¡ã³ããåžžã«åç §ããŠãã ãããå€ãã®å Žåãã¢ãã«ã®ãšã¯ã¹ããŒãã«é¢ããå ·äœçãªã¬ã€ãã©ã€ã³ããã¹ããã©ã¯ãã£ã¹ãèšèŒãããŠããŸãã
-
ã³ãã¥ããã£ã»ãµããŒãïŒã©ã€ãã©ãªããã¬ãŒã ã¯ãŒã¯ã®å ¬åŒãªããžããªã§ãä»ã®ãŠãŒã¶ãŒããåæ§ã®åé¡ãå ±åãããŠããªãã確èªããŠãã ããããã£ã¹ã«ãã·ã§ã³ã®ã¹ã¬ããã§ãã¡ã³ãããã³ãã¥ããã£ã解決çãåé¿çãæäŸããŠãããããããŸããã
-
å®æçã«ã¢ããããŒãããïŒããŒã«ãã©ã€ãã©ãªã®ææ°ããŒãžã§ã³ã䜿çšããŠããããšã確èªããŠãã ãããéçºè ã¯ãæ¢ç¥ã®ãã°ãä¿®æ£ããããæ©èœãæ¹åãããããã¢ããããŒããé »ç¹ã«ãªãªãŒã¹ããŠããŸãã
-
段éçã«ãã¹ãããïŒå®å šãªå€æãè¡ãåã«ãå°èŠæš¡ãªã¢ãã«ãããŒã¿ã»ããã§ããã»ã¹ããã¹ãããæœåšçãªåé¡ãæ©æã«ç¹å®ããã
ã³ãã¥ããã£ãšãµããŒã
å¿ãåãããã人ã ã®ã³ãã¥ããã£ãšé¢ããããšã§ãYOLO11 ã§ã®çµéšãšæåãå€§å¹ ã«åäžããå¯èœæ§ãããã以äžã¯ã圹ã«ç«ã€ãšæããããã£ã³ãã«ããªãœãŒã¹ã§ãã
ãã«ããåŸãããã®ãã©ãŒã©ã ãšãã£ã³ãã«
GitHub IssuesïŒGitHub ã®YOLO11 ãªããžããªã«ã¯Issues ã¿ããããã質åããã°å ±åãæ°æ©èœã®ææ¡ãã§ããŸããã³ãã¥ããã£ãšã¡ã³ãããŒã¯ããã§æŽ»çºã«æŽ»åããŠãããç¹å®ã®åé¡ã§å©ããåŸãã«ã¯çµ¶å¥œã®å Žæã§ãã
Ultralytics DiscordãµãŒããŒ: Ultralytics ã«ã¯DiscordãµãŒããŒããããä»ã®ãŠãŒã¶ãŒãéçºè ãšäº€æµããããšãã§ããŸãã
å ¬åŒææžãšãªãœãŒã¹
Ultralytics YOLO11 ããã¥ã¡ã³ã å ¬åŒããã¥ã¡ã³ãã§ã¯ãYOLO11 ã®å æ¬çãªæŠèŠãšãã€ã³ã¹ããŒã«ã䜿çšæ¹æ³ããã©ãã«ã·ã¥ãŒãã£ã³ã°ã«é¢ããã¬ã€ããæäŸããŠããŸãã
ãããã®ãªãœãŒã¹ã¯ãYOLO11 ãããžã§ã¯ãã®ãã©ãã«ã·ã¥ãŒãã£ã³ã°ãæ¹åãYOLO11 ã³ãã¥ããã£ã®ä»ã®äººã ãšã®ã€ãªããã®ããã®åŒ·åºãªåºç€ãšãªãã¯ãã§ãã
çµè«
ãã©ãã«ã·ã¥ãŒãã£ã³ã°ã¯ã©ã®ãããªéçºããã»ã¹ã«ãããŠãäžå¯æ¬ ãªéšåã§ãããæ£ããç¥èã身ã«ã€ããããšã§ãåé¡è§£æ±ºã«è²»ããæéãšåŽåãå€§å¹ ã«åæžããããšãã§ãããæ¬ã¬ã€ãã¯ãUltralytics ãšã³ã·ã¹ãã å ã®YOLO11 ã¢ãã«ã®ãŠãŒã¶ãŒãçŽé¢ããæãäžè¬çãªèª²é¡ã«å¯ŸåŠããããšãç®çãšããŠããŸãããããã®äžè¬çãªåé¡ãç解ã察åŠããããšã§ããããžã§ã¯ããããåæ»ã«é²ããã³ã³ãã¥ãŒã¿ããžã§ã³ã¿ã¹ã¯ã§ããè¯ãçµæãåŸãããšãã§ããŸãã
Ultralytics ã³ãã¥ããã£ã¯è²ŽéãªãªãœãŒã¹ã§ããããšãå¿ããªãã§ãã ããã仲éã®éçºè ãå°é家ãšé¢ããããšã§ãæšæºçãªææžã§ã¯ã«ããŒãããŠããªããããªããããªãæŽå¯ã解決çãåŸãããšãã§ããŸããã³ãã¥ããã£ã®éåç¥ã«è²¢ç®ããããã«ãåžžã«åŠã³ãå®éšããçµéšãå ±æããŸãããã
ããããŒã»ãã©ãã«ã·ã¥ãŒãã£ã³ã°
ããããã質å
YOLO11 ã§ã®ã€ã³ã¹ããŒã«ã»ãšã©ãŒã解決ããã«ã¯ïŒ
ã€ã³ã¹ããŒã«ãšã©ãŒã¯ãäºææ§ã®åé¡ãäŸåé¢ä¿ã®æ¬ èœãåå ã§ããããšããããããŸããPython 3.8以éã䜿çšããPyTorch 1.8以éãã€ã³ã¹ããŒã«ãããŠããããšã確èªããŠãã ãããã³ã³ããªã¯ããé¿ããããã«ä»®æ³ç°å¢ã䜿çšããããšã¯æçã§ããã¹ããããã€ã¹ãããã®ã€ã³ã¹ããŒã«ã¬ã€ãã«ã€ããŠã¯ãå ¬åŒã€ã³ã¹ããŒã«ã¬ã€ãã«åŸã£ãŠãã ãããã€ã³ããŒããšã©ãŒãçºçããå Žåã¯ãæ°èŠã€ã³ã¹ããŒã«ãè©Šãããã©ã€ãã©ãªãææ°ããŒãžã§ã³ã«æŽæ°ããŠãã ããã
GPU ã§YOLO11 ã¢ãã«ã®ãã¬ãŒãã³ã°ãé ãã®ã¯ãªãã§ããïŒ
ããããµã€ãºã倧ãããã¡ã¢ãªãäžååãªããã1ã€ã®GPU ã§ã®ãã¬ãŒãã³ã°ãé
ããªãå¯èœæ§ããããŸãããã¬ãŒãã³ã°ãé«éåããã«ã¯ãè€æ°ã®GPUã䜿çšããŸããã·ã¹ãã ã«è€æ°ã®GPUãå©çšå¯èœã§ããããšã確èªã .yaml
èšå®ãã¡ã€ã«ã§GPUã®æ°ãæå®ããŸãã gpus: 4
.ããããµã€ãºãé©å®å€§ããããŠãã¡ã¢ãªå¶éãè¶
ããããšãªãGPUããã«æŽ»çšããŸããã³ãã³ãäŸïŒ
ç§ã®YOLO11 ã¢ãã«ãGPU ã§ãã¬ãŒãã³ã°ããŠããããšã確èªããã«ã¯ã©ãããã°ããã§ããïŒ
ãã¬ãŒãã³ã°ãã°ã«ãdeviceãã®å€ããnullããšè¡šç€ºãããŠããå Žåã¯ãéåžžããã¬ãŒãã³ã°ããã»ã¹ãèªåçã«å©çšå¯èœãªGPU ã䜿çšããããã«èšå®ãããŠããããšãæå³ããŸããç¹å®ã®GPU ãæ瀺çã«å²ãåœãŠãã«ã¯ã'device' å€ã次ã®ããã«èšå®ããŸãã .yaml
èšå®ãã¡ã€ã«ãåç
§ããŠãã ãããäŸãã°
ããã«ããããã¬ãŒãã³ã°ããã»ã¹ãæåã®GPU ã«èšå®ãããŸãããåç
§ããŠãã ããã nvidia-smi
ã³ãã³ãã§CUDA ã®ã»ããã¢ããã確èªããã
YOLO11 ãã¢ãã«ãã¬ãŒãã³ã°ã®é²æç¶æ³ãã©ã®ããã«ç¢ºèªã§ããŸããïŒ
ãã¬ãŒãã³ã°ã®é²æç¶æ³ã®è¿œè·¡ãšå¯èŠåã¯ãTensorBoardã®ãããªããŒã«ã§å¹ççã«ç®¡çã§ããã CometãUltralytics HUBã®ãããªããŒã«ã§å¹ççã«ç®¡çã§ããããããã®ããŒã«ã§ã¯ãæ倱ã粟床ããªã³ãŒã«ãmAPãªã©ã®ã¡ããªã¯ã¹ãèšé²ããå¯èŠåããããšãã§ããããããã®ã¡ããªã¯ã¹ã«åºã¥ããŠæ©æåæ¢ãå®æœããããšã§ãããè¯ããã¬ãŒãã³ã°ææãéæããããšãã§ããã
YOLO11 ãç§ã®ããŒã¿ã»ãã圢åŒãèªèããªãå Žåãã©ãããã°ããã§ããïŒ
ããŒã¿ã»ãããšã©ãã«ãæåŸ ããããã©ãŒãããã«é©åããŠããããšã確èªããã泚éãæ£ç¢ºã§é«å質ã§ããããšã確èªãããäœããã®åé¡ã«çŽé¢ããå Žåã¯ããããŒã¿åéãšæ³šéãã®ãã¹ããã©ã¯ãã£ã¹ãåç §ããŠãã ãããããŒã¿ã»ããåºæã®ã¬ã€ãã³ã¹ã«ã€ããŠã¯ãããã¥ã¡ã³ãã®ããŒã¿ã»ããã»ã¯ã·ã§ã³ãã芧ãã ããã