TF SavedModel 圢åŒã«ãšã¯ã¹ããŒãããæ¹æ³ãç解ãããYOLO11
æ©æ¢°åŠç¿ã¢ãã«ã®ãããã€ã¯é£ãããããããªããTF SavedModel ã¯ãTensorFlow ãäžè²«ããæ¹æ³ã§æ©æ¢°åŠç¿ã¢ãã«ãããŒãããããã«äœ¿çšããŠãããªãŒãã³ãœãŒã¹ã®æ©æ¢°åŠç¿ãã¬ãŒã ã¯ãŒã¯ã§ããããã¯ãTensorFlow ã¢ãã«çšã®ã¹ãŒãã±ãŒã¹ã®ãããªãã®ã§ãæã¡éã³ãç°¡åã§ãããŸããŸãªããã€ã¹ãã·ã¹ãã ã§äœ¿çšããããšãã§ããŸãã
ã¢ãã«ããTF SavedModel ã«ãšã¯ã¹ããŒãããæ¹æ³ãåŠã¶ããšãã§ããŸãã Ultralytics YOLO11ãã®ã¬ã€ãã§ã¯ãã¢ãã«ã 圢åŒã«å€æããæ¹æ³ã説æããŸãããã®ã¬ã€ãã§ã¯ãã¢ãã«ãTF SavedModel 圢åŒã«å€æããæ¹æ³ã説æããç°ãªãããã€ã¹äžã§ã¢ãã«ãçšããŠæšè«ãå®è¡ããããã»ã¹ãç°¡çŽ åããŸãã
ãªãTF SavedModel ã«ãšã¯ã¹ããŒãããå¿ èŠãããã®ã§ããïŒ
TensorFlow SavedModel ãã©ãŒãããã¯ãGoogle ã«ãã£ãŠéçºãããTensorFlow ãšã³ã·ã¹ãã ã®äžéšã§ãããTensorFlow ã¢ãã«ãã·ãŒã ã¬ã¹ã«ä¿åããã·ãªã¢ã©ã€ãºããããã«èšèšãããŠãããããã¯ãã¢ãŒããã¯ãã£ãéã¿ãããã«ã¯ã³ã³ãã€ã«æ å ±ãªã©ãã¢ãã«ã®å®å šãªè©³çŽ°ãã«ãã»ã«åãããããã«ãããç°ãªãç°å¢éã§ã¢ãã«ãå ±æãå±éããã¬ãŒãã³ã°ç¶ç¶ããããšã容æã«ãªããŸãã
TF SavedModel ã«ã¯ãäºææ§ãšããéèŠãªå©ç¹ããããTensorFlow ServingãTensorFlow LiteãTensorFlow.jsãšããŸãæ©èœããããã®äºææ§ã«ããããŠã§ããã¢ãã€ã«ã¢ããªã±ãŒã·ã§ã³ãå«ãããŸããŸãªãã©ãããã©ãŒã ã§ã¢ãã«ãå ±æãããããããã€ãããããããšã容æã«ãªããŸããTF SavedModel ãã©ãŒãããã¯ãç 究ã«ãçç£ã«ã䟿å©ã§ããã¢ãã«ã管çããçµ±äžãããæ¹æ³ãæäŸããã©ã®ãããªã¢ããªã±ãŒã·ã§ã³ã«ã察å¿ã§ããããã«ããŸãã
TF SavedModelsã®äž»ãªæ©èœ
以äžã¯ãTF SavedModel ãAIéçºè ã«ãšã£ãŠçŽ æŽãããéžæè¢ãšãªãäž»ãªç¹åŸŽã§ããïŒ
-
移æ€æ§ïŒTF SavedModel ã¯ãèšèªã«äŸåããªããå埩å¯èœãªãå¯éãããçŽååãã©ãŒããããæäŸãããããã«ãããããäžäœã®ã·ã¹ãã ãããŒã«ã§TensorFlow ã¢ãã«ã®çæãå©çšãå€æãå¯èœã«ãªããŸããSavedModelsã¯ãç°ãªããã©ãããã©ãŒã ãç°å¢éã§ç°¡åã«å ±æãããããã€ããããšãã§ããŸãã
-
å°å ¥ã®å®¹æãïŒTF SavedModel ã¯ãèšç®ã°ã©ããåŠç¿æžã¿ãã©ã¡ãŒã¿ãå¿ èŠãªã¡ã¿ããŒã¿ã1ã€ã®ããã±ãŒãžã«ãã³ãã«ããŠããããããã¯ãã¢ãã«ãæ§ç¯ããå ã®ã³ãŒããå¿ èŠãšããããšãªããç°¡åã«ããŒãããŠæšè«ã«äœ¿çšããããšãã§ããããã®ãããTensorFlow ã¢ãã«ã®å±éã¯ãããŸããŸãªå®éçšç°å¢ã«ãããŠç°¡åã§å¹ççãªãã®ãšãªãã
-
ã¢ã»ãã管çïŒTF SavedModel ã¯ãããã£ãã©ãªãŒããšã³ãããã£ã³ã°ãã«ãã¯ã¢ããããŒãã«ãªã©ã®å€éšã¢ã»ããã®ã€ã³ã¯ã«ãŒãããµããŒãããŸãããããã®ã¢ã»ããã¯ãã°ã©ãå®çŸ©ãå€æ°ãšäžç·ã«ä¿åãããã¢ãã«ãããŒãããããšãã«å©çšã§ããããã«ãªããŸãããã®æ©èœã¯ãå€éšãªãœãŒã¹ã«äŸåããã¢ãã«ã®ç®¡çãšé åžãç°¡çŽ åããŸãã
é åãªãã·ã§ã³TF SavedModel
TF SavedModel ãã©ãŒãããã«YOLO11 ã¢ãã«ããšã¯ã¹ããŒãããããã»ã¹ã«å ¥ãåã«ããã®ãã©ãŒãããã䜿çšãããå žåçãªå±éã·ããªãªãããã€ãæ¢ã£ãŠã¿ãŸãããã
TF SavedModel ã«ã¯ãæ©æ¢°åŠç¿ã¢ãã«ãå±éããããã®ããŸããŸãªãªãã·ã§ã³ãçšæãããŠããïŒ
-
TensorFlow ãµãŒãã³ã° TensorFlow Serving: Servingã¯ããããã¯ã·ã§ã³ç°å¢åãã«èšèšããããæè»ã§é«æ§èœãªãµãŒãã³ã°ã·ã¹ãã ã§ããTF SavedModelsããã€ãã£ãã«ãµããŒãããã¯ã©ãŠããã©ãããã©ãŒã ããªã³ãã¬ãã¹ãµãŒããŒããšããžããã€ã¹ãžã®ã¢ãã«ã®ãããã€ãšæäŸã容æã«ããŸãã
-
ã¯ã©ãŠããã©ãããã©ãŒã ïŒ Google Cloud Platform (GCP)ãAmazon Web Services (AWS)ãMicrosoft Azure ãªã©ã®äž»èŠãªã¯ã©ãŠããããã€ããŒã¯ãTF SavedModels ãå«ãTensorFlow ã¢ãã«ã®ãããã€ãšå®è¡ã®ããã®ãµãŒãã¹ãæäŸããŠããŸãããããã®ãµãŒãã¹ã¯ãã¹ã±ãŒã©ãã«ã§ç®¡çãããã€ã³ãã©ã¹ãã©ã¯ãã£ãæäŸãããããã¢ãã«ã®ãããã€ãšã¹ã±ãŒãªã³ã°ãç°¡åã«è¡ãããšãã§ããŸãã
-
ã¢ãã€ã«ããã³çµã¿èŸŒã¿ããã€ã¹ïŒ TensorFlow ã¢ãã€ã«ãçµèŸŒã¿ãIoTããã€ã¹äžã§æ©æ¢°åŠç¿ã¢ãã«ãå®è¡ããããã®è»œéãœãªã¥ãŒã·ã§ã³ã§ããLiteã¯ãTF SavedModelsãTensorFlow Liteãã©ãŒãããã«å€æããããšããµããŒãããŸããããã«ãããã¹ããŒããã©ã³ãã¿ãã¬ãããããã€ã³ã³ããšããžããã€ã¹ãŸã§ãå¹ åºãããã€ã¹ã«ã¢ãã«ãå±éããããšãã§ããŸãã
-
TensorFlow ã©ã³ã¿ã€ã ïŒ TensorFlow ã©ã³ã¿ã€ã
tfrt
)ãå®è¡ããããã®é«æ§èœã©ã³ã¿ã€ã ã§ããã TensorFlow ã°ã©ãã衚瀺ããŸããC++ç°å¢ã§TF SavedModelsãããŒãããŠå®è¡ããããã®äœã¬ãã«APIãæäŸãããTensorFlow ã©ã³ã¿ã€ã ã¯ãæšæºã®TensorFlow ã©ã³ã¿ã€ã ãšæ¯èŒããŠãããåªããããã©ãŒãã³ã¹ãæäŸãããäœé 延æšè«ãæ¢åã® C++ ã³ãŒãããŒã¹ãšã®ç·å¯ãªçµ±åãå¿ èŠãšããå±éã·ããªãªã«é©ããŠããŸãã
YOLO11 ã¢ãã«ã®ãšã¯ã¹ããŒãTF SavedModel
YOLO11 ã¢ãã«ãTF SavedModel ãã©ãŒãããã«ãšã¯ã¹ããŒãããããšã§ãæ§ã ãªãã©ãããã©ãŒã ãžã®é©å¿æ§ãšå±éã®ãããããåäžããŸãã
ã€ã³ã¹ããŒã«
å¿ èŠãªããã±ãŒãžãã€ã³ã¹ããŒã«ããã«ã¯ã以äžãå®è¡ããïŒ
ã€ã³ã¹ããŒã«ããã»ã¹ã«é¢ãã詳现ãªèª¬æãšãã¹ããã©ã¯ãã£ã¹ã«ã€ããŠã¯ãUltralytics ã€ã³ã¹ããŒã«ã¬ã€ããã芧ãã ãããYOLO11 ã«å¿ èŠãªããã±ãŒãžãã€ã³ã¹ããŒã«ããéã«ãäœããã®åé¡ãçºçããå Žåã¯ã解決çããã³ãã«ã€ããŠãããããåé¡ã¬ã€ããåç §ããŠãã ããã
䜿çšæ¹æ³
䜿ãæ¹ã®èª¬æã«å ¥ãåã«ãUltralytics YOLO11 ã®å šã¢ãã«ããšã¯ã¹ããŒãã«å¯Ÿå¿ããŠããããšã確èªããŠãããŸããã ã
䜿çšæ¹æ³
from ultralytics import YOLO
# Load the YOLO11 model
model = YOLO("yolo11n.pt")
# Export the model to TF SavedModel format
model.export(format="saved_model") # creates '/yolo11n_saved_model'
# Load the exported TF SavedModel model
tf_savedmodel_model = YOLO("./yolo11n_saved_model")
# Run inference
results = tf_savedmodel_model("https://ultralytics.com/images/bus.jpg")
ãµããŒããããŠãããšã¯ã¹ããŒããªãã·ã§ã³ã®è©³çŽ°ã«ã€ããŠã¯ãUltralytics é 眮ãªãã·ã§ã³ã®ããã¥ã¡ã³ãããŒãžãåç §ããŠãã ããã
ãšã¯ã¹ããŒããããYOLO11 TF SavedModel ã¢ãã«ã®å±é
YOLO11 ã¢ãã«ãTF SavedModel ãã©ãŒãããã«ãšã¯ã¹ããŒããããã次ã¯ããããããã€ããŸããTF GraphDef ã¢ãã«ãå®è¡ããããã®æåã®ã¹ããããšããŠãYOLO("./yolo11n_saved_model") ã¡ãœããã䜿çšããããšããå§ãããŸãã
ããããTF SavedModel ã¢ãã«ã®é åã«é¢ãã詳ãã説æã«ã€ããŠã¯ã以äžã®ãªãœãŒã¹ãã芧ãã ããïŒ
-
TensorFlow ãµãŒãã¹:TensorFlow Servingã䜿ã£ãŠTF SavedModel ã¢ãã«ããããã€ããæ¹æ³ã«ã€ããŠã®éçºè åãããã¥ã¡ã³ãã§ãã
-
Node.js ã§TensorFlow SavedModel ãå®è¡ãã:TensorFlow TensorFlow SavedModel ãå€æããã«çŽæ¥Node.jsã§å®è¡ããããã°èšäºã
-
ã¯ã©ãŠããžã®å±é:TensorFlow SavedModel ã¢ãã«ã Cloud AI Platform äžã«ãããã€ããããšã«é¢ããTensorFlow ããã°èšäºã
æŠèŠ
ãã®ã¬ã€ãã§ã¯ãUltralytics YOLO11 ã¢ãã«ãTF SavedModel ãã©ãŒãããã«ãšã¯ã¹ããŒãããæ¹æ³ã«ã€ããŠèª¬æããŸããTF SavedModel ã«ãšã¯ã¹ããŒãããããšã§ãYOLO11 ã¢ãã«ãããŸããŸãªãã©ãããã©ãŒã äžã§æé©åãå±éãæ¡åŒµããæè»æ§ãåŸãããŸãã
䜿ãæ¹ã®è©³çŽ°ã«ã€ããŠã¯ãTF SavedModel å ¬åŒããã¥ã¡ã³ããã芧ãã ããã
Ultralytics YOLO11 ãä»ã®ãã©ãããã©ãŒã ããã¬ãŒã ã¯ãŒã¯ãšçµ±åããããã®è©³çŽ°ã«ã€ããŠã¯ãçµ±åã¬ã€ãã®ããŒãžããã§ãã¯ããããšããå¿ããªããããªãã®ãããžã§ã¯ãã§YOLO11 ãæ倧éã«æŽ»çšããããã®çŽ æŽããããªãœãŒã¹ãæºèŒã§ãã
ããããã質å
Ultralytics YOLO ã¢ãã«ãTensorFlow SavedModel 圢åŒã«ãšã¯ã¹ããŒãããã«ã¯ã©ãããã°ããã§ããïŒ
Ultralytics YOLO ã¢ãã«ãTensorFlow SavedModel ãã©ãŒãããã«ãšã¯ã¹ããŒãããã®ã¯ç°¡åã§ãããã®ããã«ã¯ãPython ãŸãã¯CLI ã®ããããã䜿çšããããšãã§ããŸãïŒ
YOLO11 ãžã®ãšã¯ã¹ããŒãTF SavedModel
from ultralytics import YOLO
# Load the YOLO11 model
model = YOLO("yolo11n.pt")
# Export the model to TF SavedModel format
model.export(format="saved_model") # creates '/yolo11n_saved_model'
# Load the exported TF SavedModel for inference
tf_savedmodel_model = YOLO("./yolo11n_saved_model")
results = tf_savedmodel_model("https://ultralytics.com/images/bus.jpg")
詳现ã«ã€ããŠã¯ãUltralytics Exportã®ããã¥ã¡ã³ããåç §ããŠãã ããã
ãªãTensorFlow SavedModel ãã©ãŒãããã䜿ãå¿ èŠãããã®ã§ããïŒ
TensorFlow SavedModel ãã©ãŒãããã¯ãã¢ãã«å±éã«ããã€ãã®å©ç¹ãããããïŒ
- 移æ€æ§ïŒèšèªã«äŸåããªããã©ãŒããããæäŸãããããç°ãªãç°å¢éã§ã®ã¢ãã«ã®å ±æãå±éã容æã§ãã
- äºææ§ïŒ TensorFlow ServingãTensorFlow LiteãTensorFlow.jsã®ãããªããŒã«ãšã·ãŒã ã¬ã¹ã«çµ±åãããŸãããããã¯ããŠã§ããã¢ãã€ã«ã¢ããªã±ãŒã·ã§ã³ãå«ãããŸããŸãªãã©ãããã©ãŒã äžã§ã¢ãã«ãå±éããããã«äžå¯æ¬ ã§ãã
- å®å šãªã«ãã»ã«åïŒã¢ãã«ã®ã¢ãŒããã¯ãã£ãéã¿ãã³ã³ãã€ã«æ å ±ããšã³ã³ãŒãããå ±æãšãã¬ãŒãã³ã°ã®ç¶ç¶ã容æã«ããŸãã
ãã®ä»ã®å©ç¹ãšå±éãªãã·ã§ã³ã«ã€ããŠã¯ãUltralytics YOLO ã¢ãã«ã®å±éãªãã·ã§ã³ãã芧ãã ããã
TF SavedModel ã®å žåçãªå±éã·ããªãªã¯ïŒ
TF SavedModel ãå«ãæ§ã ãªç°å¢ã§å±éããããšãã§ããïŒ
- TensorFlow ãµãŒãã³ã°ã¹ã±ãŒã©ãã«ã§é«æ§èœãªã¢ãã«ãµãŒãã³ã°ãå¿ èŠãšãããããã¯ã·ã§ã³ç°å¢ã«æé©ã
- ã¯ã©ãŠããã©ãããã©ãŒã ïŒ Google Cloud Platform (GCP)ãAmazon Web Services (AWS)ãMicrosoft Azureãªã©ã®äž»èŠãªã¯ã©ãŠããµãŒãã¹ããµããŒãããã¹ã±ãŒã©ãã«ãªã¢ãã«å±éãå®çŸããŸãã
- ã¢ãã€ã«ããã³çµã¿èŸŒã¿ããã€ã¹ïŒ TF SavedModelsã®å€æã«TensorFlow Liteã䜿çšããããšã§ãã¢ãã€ã«ããã€ã¹ãIoTããã€ã¹ããã€ã¯ãã³ã³ãããŒã©ãžã®å±éãå¯èœã«ãªããŸãã
- TensorFlow ã©ã³ã¿ã€ã ïŒäœã¬ã€ãã³ã·ãŒã§ããåªããããã©ãŒãã³ã¹ãå¿ èŠãšããC++ç°å¢åãã
詳现ãªå±éãªãã·ã§ã³ã«ã€ããŠã¯ã TensorFlow ã¢ãã«ã®å±éã«é¢ããå ¬åŒã¬ã€ããã芧ãã ããã
YOLO11 ã¢ãã«ããšã¯ã¹ããŒãããããã«å¿ èŠãªããã±ãŒãžã¯ãã©ã®ããã«ã€ã³ã¹ããŒã«ã§ããŸããïŒ
YOLO11 ã¢ãã«ã®ãšã¯ã¹ããŒãã«ã¯ ultralytics
ããã±ãŒãžãäœæããŸããã¿ãŒããã«ã§ä»¥äžã®ã³ãã³ããå®è¡ããïŒ
ãã詳现ãªã€ã³ã¹ããŒã«æé ãšãã¹ããã©ã¯ãã£ã¹ã«ã€ããŠã¯ãUltralytics ã€ã³ã¹ããŒã«ã¬ã€ããåç §ããŠãã ãããåé¡ãçºçããå Žåã¯ãããããåé¡ã¬ã€ããåç §ããŠãã ããã
TensorFlow SavedModel ãã©ãŒãããã®äž»ãªç¹åŸŽã¯äœã§ããïŒ
TF SavedModel ãã©ãŒãããã¯ã以äžã®ãããªç¹åŸŽããããAIéçºè ã«ãšã£ãŠæçã§ããïŒ
- 移æ€æ§ïŒããŸããŸãªç°å¢ã§ã®å ±æãšå±éã容æã«ãªããŸãã
- å°å ¥ã®å®¹æãïŒèšç®ã°ã©ããåŠç¿æžã¿ãã©ã¡ãŒã¿ãã¡ã¿ããŒã¿ãåäžã®ããã±ãŒãžã«ã«ãã»ã«åããããŒããšæšè«ãç°¡çŽ åã
- è³ç£ç®¡çïŒèªåœã®ãããªå€éšã¢ã»ããããµããŒãããã¢ãã«ã®ããŒãæã«å©çšã§ããããã«ããŸãã
詳ããã¯ã TensorFlow ã®å ¬åŒããã¥ã¡ã³ããã芧ãã ããã