Ultralytics VSã³ãŒãæ¡åŒµ
Ultralytics YOLO ã䜿ã£ããµã³ãã«ã³ãŒãã20ç§ä»¥å
ã«å®è¡ïŒð
ç¹åŸŽãšå©ç¹
ããŒã¿ãµã€ãšã³ãã£ã¹ããæ©æ¢°åŠç¿ãšã³ãžãã¢ã¯ãUltralytics ã䜿ã£ãŠã³ã³ãã¥ãŒã¿ããžã§ã³ã¢ããªã±ãŒã·ã§ã³ãæ§ç¯ããŠããŸããïŒ
åãã³ãŒãã®ãããã¯ãç¹°ãè¿ãæžãã®ãå«ã§ããïŒ
â exportãpredictãtrainãtrackãvalã¡ãœããã®åŒæ°ãããã©ã«ãå€ããã€ãå¿ããŠããŸãããïŒ
â Ultralytics ã䜿ãå§ããããšæã£ãŠããŠãã³ãŒãäŸãåç §ãããå®è¡ãããããç°¡åãªæ¹æ³ãããã°ãšæã£ãŠããŸãããïŒ
Ultralytics â éçºãµã€ã¯ã«ãéãããã§ããïŒ
ããããªããVisual Studio Codeã䜿ã£ãŠããŠãäžèšã®ããããã«ãã¯ãããšçãããªããUltralytics-snippets extension for VS Codeã圹ã«ç«ã€ïŒæ¡åŒµæ©èœã®è©³çŽ°ãã€ã³ã¹ããŒã«æ¹æ³ã䜿çšæ¹æ³ã«ã€ããŠã¯ããã¡ãããèªã¿ãã ããã
Ultralytics ã³ãã¥ããã£
ãã®æ¡åŒµæ©èœãæ§ç¯ããã€ã³ã¹ãã¬ãŒã·ã§ã³ã¯ãUltralytics ã³ãã¥ããã£ããåŸãŸãããåããããªãããã¯ãäŸã«é¢ããã³ãã¥ããã£ããã®è³ªåãããã®ãããžã§ã¯ãã®éçºãåŸæŒãããŸãããããã«ãUltralytics ããŒã ã®äœäººãã VS Code ã䜿çšããŠãããããç§ãã¡ãäœæ¥ãå éãããããŒã«ãšã㊠VS Code ã䜿çšããŠããŸãã
ãªãVSã³ãŒããªã®ãïŒ
Visual Studio Codeã¯äžçäžã®éçºè ã«éåžžã«äººæ°ãããã2021幎ã2022幎ã2023幎ã2024幎ã®Stack Overflow Developer Surveyã§æã人æ°ã®ãããœãããŠã§ã¢ã«ã©ã³ã¯ã€ã³ããŠããŸããVS Codeã®é«åºŠãªã«ã¹ã¿ãã€ãºæ§ããã«ãã€ã³æ©èœãå¹ åºãäºææ§ãæ¡åŒµæ§ã«ãããå€ãã®éçºè ãVisual Studio Codeã䜿çšããŠããããšã¯é©ãããšã§ã¯ãããŸãããããåºãéçºè ã³ãã¥ããã£ããUltralytics DiscordãDiscourseãRedditãGitHubã³ãã¥ããã£ã§ã®äººæ°ãèãããšãã¯ãŒã¯ãããŒãåçåããçç£æ§ãé«ããã®ã«åœ¹ç«ã€VS Codeãšã¯ã¹ãã³ã·ã§ã³ãæ§ç¯ããã®ã¯çã«ããªã£ãŠãããšèšããŸãã
ã³ãŒãéçºã«äœã䜿ã£ãŠããŸããïŒDiscourseã³ãã¥ããã£æ祚ã«åå ããŠãç§ãã¡ã«æããŠãã ããïŒãã®éã«ãç§ãã¡ã®ãæ°ã«å ¥ãã®ã³ã³ãã¥ãŒã¿ããžã§ã³ãæ©æ¢°åŠç¿ãAIãéçºè ã®ããŒã ããã§ãã¯ããããããªãã®ãæ°ã«å ¥ããæçš¿ããŠãã ããïŒ
æ¡åŒµæ©èœã®ã€ã³ã¹ããŒã«
泚
VS Codeã®ãšã¯ã¹ãã³ã·ã§ã³ãã€ã³ã¹ããŒã«ã§ããããããã³ãŒãç°å¢ ã§ãªããã°ãªããªãã Ultralytics-snippets æ¡åŒµæ©èœãšäºææ§ããããŸãããã®æ¡åŒµæ©èœãå
¬éããåŸ ããªãã ã¯VS Codeã®æ¡åŒµæ©èœãšäºææ§ããããŸãã詳ãã㯠neovim
ã€ã³ã¹ããŒã«ã»ã¯ã·ã§ã³ Readmeã® Ultralytics-ã¹ããããã»ã¬ããžããª.
VSã³ãŒãã§ã®ã€ã³ã¹ããŒã«
-
VS Codeã®Extensionsã¡ãã¥ãŒã«ç§»åããããCtrl+Shiftâ+xã®ã·ã§ãŒãã«ããã䜿ããUltralytics-snippetsãæ€çŽ¢ããã
-
ã€ã³ã¹ããŒã«ãã¿ã³ãã¯ãªãã¯ããŸãã
VS Code Extension Marketplaceããã€ã³ã¹ããŒã«ãã
-
VS Code Extension Marketplaceã«ã¢ã¯ã»ã¹ããUltralytics-snippetsãæ€çŽ¢ããããVS Code Marketplaceã®æ¡åŒµæ©èœããŒãžã«çŽæ¥ã¢ã¯ã»ã¹ããŠãã ããã
-
ã€ã³ã¹ããŒã«ãã¿ã³ãã¯ãªãã¯ãããã©ãŠã¶ã§VS Codeã»ãã·ã§ã³ãèµ·åããŸãã
-
ããã³ããã«åŸã£ãŠæ¡åŒµæ©èœãã€ã³ã¹ããŒã«ããŸãã
Visual Studio Code Extension Marketplaceã®ããŒãž Ultralytics-ã¹ãããã
Ultralytics-Snippets Extensionã®äœ¿çš
-
ð€ã€ã³ããªãžã§ã³ããªã³ãŒãè£å®ïŒ Ultralytics API ã«åãããŠèª¿æŽãããé«åºŠãªã³ãŒãè£å®ãµãžã§ã¹ ãã«ãããã³ãŒããããéãæ£ç¢ºã«èšè¿°ã§ããŸãã
-
âéçºã¹ããŒãã®åäž:ç¹°ãè¿ãã®ã³ãŒãã£ã³ã°äœæ¥ããªãããããããããã«ããããã³ãŒããããã¯ã®ã¹ããããã掻çšããããšã§ãæéãç¯çŽã§ããŸãã
-
á¬ã³ãŒãå質ã®åäžïŒã€ã³ããªãžã§ã³ããªã³ãŒãè£å®æ©èœã«ãããããã¯ãªãŒã³ã§äžè²«æ§ã®ããããšã©ãŒã®ãªãã³ãŒããæžãããšãã§ããŸãã
-
áã¯ãŒã¯ãããŒã®åçåïŒäžè¬çãªã¿ã¹ã¯ãèªååããããšã§ããããžã§ã¯ãã®ã³ã¢ããžãã¯ã«éäžã§ããŸãã
æŠèŠ
æ¡åŒµæ©èœã¯ èšèªã¢ãŒã ã¯Python ðçšã«èšå®ãããŠããŸããããã¯ãä»ã®ãã¡ã€ã«ã¿ã€ãã§äœæ¥ããŠãããšãã«ã¹ãããããæ¿å
¥ãããªãããã«ããããã§ãããã¹ãŠã®ã¹ãããã㯠ultra
ãšå
¥åããã ãã§ããã ultra
ãã€ã³ã¹ããŒã«ãããšã䜿çšå¯èœãªã¹ããããã®ãªã¹ãã衚瀺ãããŸãããŸããVSã³ãŒã ã³ãã³ããã¬ãã 䜿çšã㊠Ctrl+ã·ãã+p ãšããã³ãã³ããå®è¡ããã Snippets: Insert Snippet
.
ã³ãŒãã»ã¹ããããã»ãã£ãŒã«ã
å€ãã®ã¹ããããã«ã¯ãããã©ã«ãã®ãã¬ãŒã¹ãã«ãå€ãååãæã€ããã£ãŒã«ããããããŸããäŸãã° äºæž¬ ãšããååã®Python å€æ°ã«ä¿åããããšãã§ããã r
, results
, detections
, preds
ã¹ããããã« "ãã£ãŒã«ã "ãå«ãŸããã®ã¯ãã®ããã ã䜿çšæ¹æ³ ã¿ã ã¹ãããããæ¿å
¥ãããåŸãããŒããŒããã¯ãªãã¯ãããšãã«ãŒãœã«ããã£ãŒã«ãéãçŽ æ©ã移åããŸããäžæŠãã£ãŒã«ããéžæããããšãæ°ããå€æ°åãå
¥åãããšããã®ã€ã³ã¹ã¿ã³ã¹ãå€æŽãããã ãã§ãªãããã®å€æ°ã®ã¹ããããã»ã³ãŒãå
ã®ä»ã®ã€ã³ã¹ã¿ã³ã¹ããã¹ãŠå€æŽãããŸãïŒ
ã¹ãããããæ¿å
¥ããåŸãååãå€æŽãã model
ãšã㊠world_model
ã¯ãã¹ãŠã®ã€ã³ã¹ã¿ã³ã¹ãæŽæ°ããŸãããæŒãã ã¿ã 次ã®ãã£ãŒã«ãã«ç§»åãããšããããããŠã³ã¡ãã¥ãŒãéããã¢ãã«ã¹ã±ãŒã«ãéžæããããšãã§ããŸãã world
ãŸã㯠worldv2
ã¢ãã«ã®ããªãšãŒã·ã§ã³ã
ã³ãŒãã»ã¹ããããã®å®æ
ããã«çãã·ã§ãŒãã«ãã
ã¹ããããã®æ¥é èŸããã¹ãŠå ¥åããå¿ èŠã¯ãããŸããããã¹ããããã®å é ããå ¥åãå§ããå¿ èŠããããŸãããäžã®ç»åã®äŸãã芧ãã ããã
ã¹ããããã«ã¯å¯èœãªéã説æçãªååãä»ããããŠããããããã§ã¯å
¥åããããšãå€ããªãã移åãç®çã§ããã°éå¹æã ã ããéã.幞ããªããšã«ãVS Codeã§ã¯ããŠãŒã¶ãŒã¯ ultra.example-yolo-predict
, example-yolo-predict
, yolo-predict
ããã㯠ex-yolo-p
ããã§ãç®çã®ã¹ããããã»ãªãã·ã§ã³ã«å°éããïŒæå³ããã¹ããããã å®éã« ultra.example-yolo-predict-kwords
ããããããŒããŒãã®ç¢å°ã䜿ã â ãŸã㯠â ãæŒããŠç®çã®ã¹ããããããã€ã©ã€ãã ãå
¥åããã ãŸã㯠ã¿ã ã¯æ£ããã³ãŒãã»ãããã¯ãæ¿å
¥ããã
ã¿ã€ãã³ã° ex-yolo-p
æå¿ ãŸã æ£ããã¹ããããã«ãã©ãçãã
ã¹ããããã»ã«ããŽãªãŒ
ãããã¯ãUltralytics-snippets æ¡åŒµæ©èœã§å©çšå¯èœãªçŸåšã®ã¹ããããã«ããŽãªã§ããä»åŸãè¿œå ãããäºå®ã§ãã®ã§ãæŽæ°ã確èªããæ¡åŒµæ©èœã®èªåæŽæ°ãæå¹ã«ããŠãã ãããã¹ããããã足ããªããšæããããè¿œå ããªã¯ãšã¹ãããããšãã§ããŸãã
ã«ããŽãªãŒ | éå§ãã¬ãã£ãã¯ã¹ | 説æ |
---|---|---|
äŸ | ultra.examples |
Ultralytics ãåŠã¶ããããŸãã¯äœ¿ãå§ããããã®ãµã³ãã«ã³ãŒãã§ããäŸã¯ãããã¥ã¡ã³ããŒã·ã§ã³ã»ããŒãžã®ã³ãŒãã®ã³ããŒããŸãã¯é¡äŒŒã®ãã®ã§ãã |
ã¯ã¯ãã°ã¹ | ultra.kwargs |
trainãtrackãpredictãvalã¡ãœããã®ã¹ãããããããã¹ãŠã®ããŒã¯ãŒãåŒæ°ãšããã©ã«ãå€ãšãšãã«è¿œå ããããšã§ãéçºãã¹ããŒãã¢ããã |
èŒžå ¥ | ultra.imports |
äžè¬çãªUltralytics ãªããžã§ã¯ããçŽ æ©ãã€ã³ããŒãããã¹ããããã |
ã¢ãã« | ultra.yolo |
ããŸããŸãªåæåã®ããã®ã³ãŒããããã¯ãæ¿å
¥ãã ã¢ãã« (yolo , sam , rtdetr ãªã©ïŒãããããããŠã³èšå®ãªãã·ã§ã³ãå«ãã |
çµæ | ultra.result |
æšè«çµæãæ±ãéã®äžè¬çãªæäœã®ã³ãŒããããã¯ã |
ãŠãŒãã£ãªã㣠| ultra.util |
Ultralytics ããã±ãŒãžã«çµã¿èŸŒãŸããŠããäžè¬çãªãŠãŒãã£ãªãã£ã«çŽ æ©ãã¢ã¯ã»ã¹ã§ããŸãããããã®ãŠãŒãã£ãªãã£ã®è©³çŽ°ã«ã€ããŠã¯ãã·ã³ãã«ãŠãŒãã£ãªãã£ã®ããŒãžãã芧ãã ããã |
å®äŸã§åŠã¶
ã«ã€ã㊠ultra.examples
ã¹ããããã¯ãUltralytics YOLO ã®åºæ¬çãªäœ¿ãæ¹ãåŠã³ãã人ã«äŸ¿å©ã§ããã¹ããããã®äŸã¯ãäžåºŠæ¿å
¥ãããšå®è¡ãããããã«ãªã£ãŠããŸãïŒããããããŠã³ã®ãªãã·ã§ã³ããããŸãïŒãã¹ããããã®äŸãšããŠã以äžã®ã¢ãã¡ãŒã·ã§ã³ããããŸãã ããã ãã®ããŒãžã§ã¯ãã¹ãããããæ¿å
¥ãããåŸããã¹ãŠã®ã³ãŒããéžæããã以äžã䜿çšããŠã€ã³ã¿ã©ã¯ãã£ãã«å®è¡ãããã ã·ãã+ãå
¥åããã.
äŸ
ã§ã®ã¢ãã¡ã·ã§ãŒã®ããã«ã ããã ãã®ããŒãžã®ã¹ãããã ultra.example-yolo-predict
ãã¯ãªãã¯ããŠã次ã®ã³ãŒãäŸãæ¿å
¥ããŸããäžæŠæ¿å
¥ããããšãèšå®å¯èœãªãªãã·ã§ã³ã¯ã¢ãã«ã®ã¹ã±ãŒã«ã ãã§ãïŒ n
, s
, m
, l
ããã㯠x
.
éçºã®å é
以å€ã®ã¹ãããããç®æãã ultra.examples
ã¯ãUltralytics ã䜿ã£ãéçºãããç°¡åãã€è¿
éã«ããããã®ãã®ã§ãããå€ãã®ãããžã§ã¯ãã§ãã䜿ãããã³ãŒããããã¯ã¯ Results
ã¢ãã«ã䜿çšããçµæ äºæž¬ ã¡ãœããã䜿çšããããã® ultra.result-loop
ã¹ããããã¯ãããå©ããããšãã§ããã
äŸ
ã䜿çšããŠããã ultra.result-loop
ã¯ä»¥äžã®ããã©ã«ãã³ãŒãïŒã³ã¡ã³ããå«ãïŒãæ¿å
¥ããã
ããããUltralytics ã¯å€æ°ã® æ¥åå
容ã〠æšè«çµæãæ±ã ä»ã«ã Results
å±æ§ã«ã¢ã¯ã»ã¹ããããšãã§ããŸãã ã¹ããããã»ãã£ãŒã«ã ã¯å匷ãã ããã
ã¿ã㧠boxes
ãã£ãŒã«ããéžæãããšãããããããŠã³ã¡ãã¥ãŒã衚瀺ãããå¿
èŠã«å¿ããŠå¥ã®å±æ§ãéžæã§ããã
ããŒã¯ãŒã
æ§ã
ãªããŒã¯ãŒãåŒæ°ããããUltralytics æ¥åå
容 ãã㊠ã¢ãŒã!ããã¯èŠããŠããããšãããããããããšã§ããããããã®è°è«ã save_frame
ãŸã㯠save_frames
(ããã¯ééããªã save_frames
ãšããã§ïŒããã㧠ultra.kwargs
ã¹ããããã圹ã«ç«ã€ïŒ
äŸ
ãæ¿å
¥ããã äºæž¬ ã¡ãœããã¯ããã¹ãŠã® æšè«åŒæ°äœ¿çšãã ultra.kwargs-predict
ããã«ããã以äžã®ã³ãŒãïŒã³ã¡ã³ããå«ãïŒãæ¿å
¥ãããã
model.predict(
source=src, # (str, optional) source directory for images or videos
imgsz=640, # (int | list) input images size as int or list[w,h] for predict
conf=0.25, # (float) minimum confidence threshold
iou=0.7, # (float) intersection over union (IoU) threshold for NMS
vid_stride=1, # (int) video frame-rate stride
stream_buffer=False, # (bool) buffer incoming frames in a queue (True) or only keep the most recent frame (False)
visualize=False, # (bool) visualize model features
augment=False, # (bool) apply image augmentation to prediction sources
agnostic_nms=False, # (bool) class-agnostic NMS
classes=None, # (int | list[int], optional) filter results by class, i.e. classes=0, or classes=[0,2,3]
retina_masks=False, # (bool) use high-resolution segmentation masks
embed=None, # (list[int], optional) return feature vectors/embeddings from given layers
show=False, # (bool) show predicted images and videos if environment allows
save=True, # (bool) save prediction results
save_frames=False, # (bool) save predicted individual video frames
save_txt=False, # (bool) save results as .txt file
save_conf=False, # (bool) save results with confidence scores
save_crop=False, # (bool) save cropped images with results
stream=False, # (bool) for processing long videos or numerous images with reduced memory usage by returning a generator
verbose=True, # (bool) enable/disable verbose inference logging in the terminal
)
ãã®ã¹ããããã«ã¯ããã¹ãŠã®ããŒã¯ãŒãåŒæ°ã®ãã£ãŒã«ããããããããã« model
ãã㊠src
ã³ãŒãå
ã§å¥ã®å€æ°ã䜿çšããå Žåã«åããŠãããŒã¯ãŒãåŒæ°ãå«ãåè¡ã«ã¯ãåèã®ããã«ç°¡åãªèª¬æãå«ãŸããŠããã
ãã¹ãŠã®ã³ãŒãã»ã¹ãããã
å©çšå¯èœãªã¹ããããã確èªããã«ã¯ããšã¯ã¹ãã³ã·ã§ã³ãããŠã³ããŒãããŠã€ã³ã¹ããŒã«ããè©ŠããŠã¿ãã®ãäžçªã§ãïŒããèå³ããããäºåã«äžèŠ§ãèŠãŠã¿ããå Žåã¯ãVS CodeããŒã±ãããã¬ã€ã¹ã® ã¬ãã æ¡åŒµæ©èœã®ããŒãžã«ã¢ã¯ã»ã¹ããå©çšå¯èœãªãã¹ãŠã®ã¹ããããã®ããŒãã«ãèŠãããšãã§ããŸãã
çµè«
Ultralytics-Snippets extension for VS Code ã¯ãããŒã¿ãµã€ãšã³ãã£ã¹ããæ©æ¢°åŠç¿ãšã³ãžãã¢ãUltralytics YOLO ã䜿çšããŠã³ã³ãã¥ãŒã¿ããžã§ã³ã¢ããªã±ãŒã·ã§ã³ãããå¹ççã«æ§ç¯ã§ããããã«èšèšãããŠããŸãããã«ãæžã¿ã®ã³ãŒãã¹ãããããšæçšãªäŸãæäŸããããšã§ãé©æ°çãªãœãªã¥ãŒã·ã§ã³ã®äœæãšããæãéèŠãªããšã«éäžã§ããããã«ããŸããVS Code ããŒã±ãããã¬ã€ã¹ã®æ¡åŒµæ©èœããŒãžã«ã¢ã¯ã»ã¹ããã¬ãã¥ãŒãæ®ãããšã§ããã£ãŒãããã¯ãå ±æããŠãã ãããâ
ããããã質å
æ°ããã¹ããããããªã¯ãšã¹ãããã«ã¯ïŒ
æ°ããã¹ããããã¯ãUltralytics-Snippetsãªããžããªã® Issues ã䜿ã£ãŠãªã¯ãšã¹ãã§ããŸãã
Ultralytics-延é·æéã¯ãããã§ããïŒ
100ïŒ ç¡æã ïŒ
ã³ãŒãã»ã¹ããããã®ãã¬ãã¥ãŒã衚瀺ãããªãã®ã¯ãªãã§ããïŒ
VS Codeã§ã¯ãCtrl+SpaceãšããããŒã®çµã¿åããã§ããã¬ãã¥ãŒã»ãŠã£ã³ããŠã«è¡šç€ºãããæ å ±ãå¢ããããæžããããããããšãã§ããŸããã³ãŒãã»ã¹ããããã®æ¥é èŸãå ¥åãããšãã«ã¹ããããã»ãã¬ãã¥ãŒã衚瀺ãããªãå Žåã¯ããã®ããŒã®çµã¿åããã䜿çšãããšãã¬ãã¥ãŒã衚瀺ãããããã«ãªããŸãã
Ultralytics ã®æ¡åŒµæ©èœæšå¥šãç¡å¹ã«ããã«ã¯ïŒ
VS Codeã䜿çšããŠããŠãUltralytics-snippetsãšã¯ã¹ãã³ã·ã§ã³ã®ã€ã³ã¹ããŒã«ãä¿ãã¡ãã»ãŒãžã衚瀺ãããããã«ãªãããã®ã¡ãã»ãŒãžã衚瀺ãããããªãå Žåããã®ã¡ãã»ãŒãžãç¡å¹ã«ããæ¹æ³ã2ã€ãããŸãã
-
Ultralytics-snippetsãã€ã³ã¹ããŒã«ãããšãã¡ãã»ãŒãžã衚瀺ãããªããªããŸãðïŒ
-
ã䜿çšããããšãã§ããã
yolo settings vscode_msg False
ãã¯ãªãã¯ãããšãæ¡åŒµæ©èœãã€ã³ã¹ããŒã«ããªããŠãã¡ãã»ãŒãžã衚瀺ãããªããªããŸãã詳ãã㯠Ultralytics èšå® ã«ããã ã¯ã€ãã¯ã¹ã¿ãŒã ã®ããŒãžãã芧ããã ãããã
æ°ããUltralytics ã³ãŒãã¹ããããã®ã¢ã€ãã¢ãããã®ã§ãããã©ãããã°è¿œå ã§ããŸããïŒ
Ultralytics-snippetsãªããžããªã«ã¢ã¯ã»ã¹ããIssue ãŸã㯠Pull Request ãéããŠãã ããïŒ
Ultralytics-Snippets Extensionãã¢ã³ã€ã³ã¹ããŒã«ããã«ã¯ïŒ
ä»ã®VS Codeæ¡åŒµæ©èœãšåæ§ã«ãVS Codeã®æ¡åŒµæ©èœã¡ãã¥ãŒã«ç§»åããŠã¢ã³ã€ã³ã¹ããŒã«ã§ããŸããã¡ãã¥ãŒããUltralytics-snippets æ¡åŒµæ©èœãæ¢ããæ¯è»ã¢ã€ã³ã³ () ãã¯ãªãã¯ãããã¢ã³ã€ã³ã¹ããŒã«ããã¯ãªãã¯ããŠæ¡åŒµæ©èœãåé€ããŸãã