{"id":1679,"date":"2024-07-27T15:04:31","date_gmt":"2024-07-27T06:04:31","guid":{"rendered":"http:\/\/www.ecobioinfo.com\/?p=1679"},"modified":"2024-07-27T16:57:31","modified_gmt":"2024-07-27T07:57:31","slug":"%e6%b7%b1%e5%b1%a4%e5%ad%a6%e7%bf%92%e3%80%80tensorflow-object-detection-api-%e3%82%b5%e3%83%b3%e3%83%97%e3%83%ab%e3%83%97%e3%83%ad%e3%82%b0%e3%83%a9%e3%83%a0%ef%bc%93","status":"publish","type":"post","link":"https:\/\/www.ecobioinfo.com\/?p=1679","title":{"rendered":"\u6df1\u5c64\u5b66\u7fd2\u3000TensorFlow Object Detection API \u30b5\u30f3\u30d7\u30eb\u30d7\u30ed\u30b0\u30e9\u30e0\uff13"},"content":{"rendered":"<p>\uff08<a href=\"https:\/\/www.ecobioinfo.com\/?p=1658\">\u524d\u56de<\/a>\u306e\u7d9a\u304d\u3067\u3059\uff09<\/p>\n<p>\u4eca\u5ea6\u306f\u30ab\u30e1\u30e9\u753b\u50cf\u306e\u51e6\u7406\u3068\u52d5\u753b\u306e\u51e6\u7406\u306e\u30b5\u30f3\u30d7\u30eb\u3092\u4f5c\u6210\u3057\u307e\u3057\u305f\u3002<\/p>\n<p>\u958b\u767a\u3068\u52d5\u753b\u78ba\u8a8d\u306e\u74b0\u5883\u306f\u300c<a href=\"https:\/\/www.ecobioinfo.com\/?p=1605\">\u6df1\u5c64\u5b66\u7fd2\u3000Windwos10 \u306b TensorFlow Object Detection API \u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb<\/a>\u300d<br \/>\n\u300c<a href=\"https:\/\/www.ecobioinfo.com\/?p=1590\">Ubuntu 20.04 \u306b TensorFlow Object Detection API \u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb<\/a>\u300d\u3068\u540c\u3058\u3067\u3059\u3002<\/p>\n<p>\uff08\u3053\u306e\u30d7\u30ed\u30b0\u30e9\u30e0\u306e\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u691c\u51fa\u90e8\u5206\u306e\u51e6\u7406\u306f <a href=\"https:\/\/tensorflow-object-detection-api-tutorial.readthedocs.io\/en\/latest\/index.html\">TensorFlow 2 Object Detection API tutorial \u306e Example <\/a>\u3092\u53c2\u8003\u306b\u3057\u3066\u4f5c\u6210\u3055\u308c\u3066\u3044\u307e\u3059\uff09<br \/>\n\uff08\u7df4\u7fd2\u306e\u305f\u3081\u306e\u30b5\u30f3\u30d7\u30eb\u30d7\u30ed\u30b0\u30e9\u30e0\u3067\u3059\u3002\u8a73\u7d30\u306e\u52d5\u4f5c\u78ba\u8a8d\u306f\u884c\u3063\u3066\u3044\u307e\u305b\u3093\u3002\uff09<\/p>\n<p>(1)\u6982\u8981<br \/>\n\u2460\u30ab\u30e1\u30e9\u753b\u50cf\u304b\u3089\u691c\u51fa\u3059\u308b\u30b5\u30f3\u30d7\u30eb\u30d7\u30ed\u30b0\u30e9\u30e0<br \/>\nPC\u306b\u63a5\u7d9a\u3057\u305f\u30ab\u30e1\u30e9\u306e\u753b\u50cf\u304b\u3089\u3001\u7279\u5b9a\u306e\u52d5\u7269\u3092\u691c\u51fa\u3057\u3066\u52d5\u753b\u3068\u3057\u3066\u4fdd\u5b58\u3059\u308b\u3002<\/p>\n<p>\u2461\u52d5\u753b\u304b\u3089\u691c\u51fa\u3059\u308b\u30b5\u30f3\u30d7\u30eb\u30d7\u30ed\u30b0\u30e9\u30e0<br \/>\n\u9078\u629e\u3055\u308c\u305f\u52d5\u753b\u30d5\u30a1\u30a4\u30eb\u304b\u3089\u3001\u7279\u5b9a\u306e\u52d5\u7269\u3092\u691c\u51fa\u3057\u3066\u52d5\u753b\u3068\u3057\u3066\u4fdd\u5b58\u3059\u308b\u3002<\/p>\n<p>(2)\u30d7\u30ed\u30b0\u30e9\u30e0<\/p>\n<p>Python\u30d7\u30ed\u30b0\u30e9\u30e0\uff08\u30c6\u30ad\u30b9\u30c8\u30d5\u30a1\u30a4\u30eb UTF-8\uff09<\/p>\n<p>\u2460\u30ab\u30e1\u30e9\u753b\u50cf\u304b\u3089\u691c\u51fa\u3059\u308b\u30b5\u30f3\u30d7\u30eb\u30d7\u30ed\u30b0\u30e9\u30e0<br \/>\n<a href=\"https:\/\/www.ecobioinfo.com\/usr\/ai\/od\/camerasample.py\">camerasample.py<\/a><\/p>\n<p>\u2461\u52d5\u753b\u304b\u3089\u691c\u51fa\u3059\u308b\u30b5\u30f3\u30d7\u30eb\u30d7\u30ed\u30b0\u30e9\u30e0<br \/>\n<a href=\"https:\/\/www.ecobioinfo.com\/usr\/ai\/od\/moviesample.py\">moviesample.py<\/a><\/p>\n<p>(3)\u89e3\u8aac<\/p>\n<p>\u2460\u30ab\u30e1\u30e9\u753b\u50cf\u304b\u3089\u691c\u51fa\u3059\u308b\u30b5\u30f3\u30d7\u30eb\u30d7\u30ed\u30b0\u30e9\u30e0<\/p>\n<p>\u30ab\u30e1\u30e9\u51e6\u7406\u306fOpenCV\u306e\u6a5f\u80fd\u3092\u4f7f\u3063\u3066\u3044\u307e\u3059\u3002<br \/>\n\u30d1\u30e9\u30e1\u30fc\u30bf\u306f\u3068\u308a\u3042\u3048\u305a\uff10\u306b\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n<p>camerasample.py<\/p>\n<p>def openCamera() :<br \/>\n\u30fb\u30fb\u30fb<br \/>\n&nbsp;&nbsp;src = cv2.VideoCapture(0)<br \/>\n\u30fb\u30fb\u30fb<\/p>\n<p>\u5bfe\u8c61\u306e\u52d5\u7269\u306f mscoco_label_map.pbtxt \u306e\u4e2d\u304b\u3089\u9078\u629e\u3057\u3066\u5b9a\u7fa9\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n<p># \u9078\u629e\u5bfe\u8c61\u3068\u306a\u308b\u30af\u30e9\u30b9<br \/>\n# mscoco_label_map.pbtxt\u304b\u3089\u52d5\u7269\u3092\u9078\u629e\u3059\u308b<br \/>\nTARGET_CLASSES = {<br \/>\n    16: &#8220;bird&#8221;    ,  # \u9ce5<br \/>\n    17: &#8220;cat&#8221;     ,  # \u732b<br \/>\n    18: &#8220;dog&#8221;     ,  # \u72ac<br \/>\n    19: &#8220;horse&#8221;   ,  # \u99ac<br \/>\n    20: &#8220;sheep&#8221;   ,  # \u7f8a<br \/>\n    21: &#8220;cow&#8221;     ,  # \u725b<br \/>\n    22: &#8220;elephant&#8221;,  # \u8c61<br \/>\n    23: &#8220;bear&#8221;    ,  # \u718a<br \/>\n    24: &#8220;zebra&#8221;   ,  # \u7e1e\u99ac<br \/>\n    25: &#8220;giraffe&#8221;    # \u9e92\u9e9f<br \/>\n    }<\/p>\n<p>\u30d3\u30c7\u30aa\u30d1\u30e9\u30e1\u30fc\u30bf\u306f\u74b0\u5883\u3084\u76ee\u7684\u306b\u5408\u308f\u305b\u3066\u3044\u5909\u66f4\u3057\u3066\u304f\u3060\u3055\u3044\u3002<br \/>\n\u52d5\u753b\u306e\u901f\u3055\u306f\u9069\u5f53\u306b 1 FPS \u3068\u3057\u3066\u3042\u308a\u307e\u3059\u3002<br \/>\n\u4fdd\u5b58\u3059\u308b\u52d5\u753b\u306e\u30b3\u30fc\u30c7\u30a3\u30c3\u30af\u306e\u5019\u88dc\u306f\u4ee5\u4e0b\u306e\u901a\u308a\u3067\u3059\u3002<\/p>\n<p># \u52d5\u753b\u66f8\u304d\u8fbc\u307f\u7528\u306e\u30b3\u30fc\u30c7\u30a3\u30c3\u30af \uff08\u52d5\u4f5c\u74b0\u5883\u306b\u4f9d\u5b58\u3057\u307e\u3059\uff09<br \/>\nCODEC = [[*&#8217;MJPG&#8217;], &#8216;avi&#8217;]<br \/>\n#CODEC = [[*&#8217;DIV3&#8242;], &#8216;avi&#8217;]<br \/>\n#CODEC = [[*&#8217;MP4V&#8217;], &#8216;mp4&#8242;]<br \/>\n#CODEC = [[*&#8217;mp4v&#8217;], &#8216;mov&#8217;]<\/p>\n<p># \u52d5\u753b\u306e\u901f\u3055 fps<br \/>\nFPS   = 1<\/p>\n<p>\u30c7\u30fc\u30bf\u3068\u30e2\u30c7\u30eb\u306e\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u306f\u30c7\u30d5\u30a9\u30eb\u30c8\u306e&#8217;data&#8217;\u3068\u3057\u3066\u3044\u307e\u3059\u3002<br \/>\nBASE_DIR = &#8216;data&#8217;<br \/>\nDATA_DIR = os.path.join(os.getcwd(), BASE_DIR)<\/p>\n<p>\u2461\u52d5\u753b\u304b\u3089\u691c\u51fa\u3059\u308b\u30b5\u30f3\u30d7\u30eb\u30d7\u30ed\u30b0\u30e9\u30e0<\/p>\n<p>\u57fa\u672c\u7684\u306b\u306f\u30ab\u30e1\u30e9\u3068\u540c\u3058\u3067 OpenCV \u306e\u6a5f\u80fd\u3092\u5229\u7528\u3057\u3066\u3044\u307e\u3059\u3002<br \/>\n\u30ab\u30e1\u30e9\u51e6\u7406\u306e\u4ee3\u308f\u308a\u306b\u52d5\u753b\u30d5\u30a1\u30a4\u30eb\u306e\u9078\u629e\u753b\u9762\u304c\u958b\u304d\u307e\u3059\u3002<\/p>\n<p>moviesample.py<\/p>\n<p>def selectVideo(defaultDir = &#8220;.\/&#8221;) :<br \/>\n\u30fb\u30fb\u30fb<br \/>\n&nbsp;&nbsp;# \u52d5\u753b\u30d5\u30a1\u30a4\u30eb\u9078\u629e<br \/>\n&nbsp;&nbsp;filepath = filedialog.askopenfilename(title=&#8221;\u5143\u52d5\u753b\u30d5\u30a1\u30a4\u30eb\u9078\u629e&#8221;, filetypes=MOVIE_FILETYPE, initialdir=defaultDir)<br \/>\n&nbsp;&nbsp;print(filepath)<br \/>\n&nbsp;&nbsp;if len(filepath) == 0 :<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;print(&#8216;Canceled.&#8217;)<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;return video, filepath<br \/>\n\u30fb\u30fb\u30fb<br \/>\n&nbsp;&nbsp;&nbsp;video = cv2.VideoCapture(filepath)<br \/>\n\u30fb\u30fb\u30fb<\/p>\n<p>(3)\u52d5\u4f5c\u78ba\u8a8d<\/p>\n<p>\u2460\u30ab\u30e1\u30e9\u753b\u50cf\u304b\u3089\u691c\u51fa\u3059\u308b\u30b5\u30f3\u30d7\u30eb\u30d7\u30ed\u30b0\u30e9\u30e0<br \/>\n\u3068\u308a\u3042\u3048\u305a\u624b\u5143\u306b\u3042\u3063\u305f\u9ce5\u985e\u56f3\u9451\u3067\u8a66\u3057\u3066\u3057\u307e\u3057\u305f\u3002<\/p>\n<p><a href=\"https:\/\/www.ecobioinfo.com\/wordpress\/wp-content\/uploads\/2024\/07\/sample_20240526104255.avi\">\u51fa\u529b\u7d50\u679cAVI\u30d5\u30a1\u30a4\u30eb(353KB)<br \/>\n<\/a><\/p>\n<p>\u2461\u52d5\u753b\u304b\u3089\u691c\u51fa\u3059\u308b\u30b5\u30f3\u30d7\u30eb\u30d7\u30ed\u30b0\u30e9\u30e0<\/p>\n<p>\u52d5\u753b\u304b\u3089\u9ce5\u3092\u691c\u51fa\u3057\u3066\u307f\u307e\u3057\u305f\u3002<\/p>\n<p><a href=\"https:\/\/www.ecobioinfo.com\/wordpress\/wp-content\/uploads\/2024\/07\/sample_20240623113257.avi\">\u51fa\u529b\u7d50\u679cAVI\u30d5\u30a1\u30a4\u30eb\uff0832MB\uff09<\/a><\/p>\n<p>\uff082024\/07\/27 Shin Onda\uff09<\/p>\n","protected":false},"excerpt":{"rendered":"\uff08\u524d\u56de\u306e\u7d9a\u304d\u3067\u3059\uff09 \u4eca\u5ea6\u306f\u30ab\u30e1\u30e9\u753b\u50cf\u306e\u51e6\u7406\u3068\u52d5\u753b\u306e\u51e6\u7406\u306e\u30b5\u30f3\u30d7\u30eb\u3092\u4f5c\u6210\u3057\u307e\u3057\u305f\u3002 \u958b\u767a\u3068\u52d5\u753b\u78ba\u8a8d\u306e\u74b0\u5883\u306f\u300c\u6df1\u5c64\u5b66\u7fd2\u3000Windwos10 \u306b TensorFlow Object Detection API \u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u300d &#8230;","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[7],"tags":[],"class_list":["post-1679","post","type-post","status-publish","format-standard","hentry","category-ai_ecobio"],"_links":{"self":[{"href":"https:\/\/www.ecobioinfo.com\/index.php?rest_route=\/wp\/v2\/posts\/1679","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.ecobioinfo.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.ecobioinfo.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.ecobioinfo.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.ecobioinfo.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1679"}],"version-history":[{"count":16,"href":"https:\/\/www.ecobioinfo.com\/index.php?rest_route=\/wp\/v2\/posts\/1679\/revisions"}],"predecessor-version":[{"id":1701,"href":"https:\/\/www.ecobioinfo.com\/index.php?rest_route=\/wp\/v2\/posts\/1679\/revisions\/1701"}],"wp:attachment":[{"href":"https:\/\/www.ecobioinfo.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1679"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.ecobioinfo.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1679"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.ecobioinfo.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1679"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}