{"id":2026,"date":"2025-12-12T12:45:23","date_gmt":"2025-12-12T03:45:23","guid":{"rendered":"http:\/\/www.ecobioinfo.com\/?p=2026"},"modified":"2025-12-12T12:45:23","modified_gmt":"2025-12-12T03:45:23","slug":"%e6%b7%b1%e5%b1%a4%e5%ad%a6%e7%bf%92%e3%80%80ubuntu-24-04-tensorflow-object-detection-api-%e3%82%92%e3%82%a4%e3%83%b3%e3%82%b9%e3%83%88%e3%83%bc%e3%83%ab","status":"publish","type":"post","link":"https:\/\/www.ecobioinfo.com\/?p=2026","title":{"rendered":"\u6df1\u5c64\u5b66\u7fd2\u3000Ubuntu 24.04  TensorFlow Object Detection API \u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb"},"content":{"rendered":"<p>\u300c<a href=\"https:\/\/www.ecobioinfo.com\/?p=1590\">\u6df1\u5c64\u5b66\u7fd2\u3000Ubuntu 20.04 \u306b TensorFlow Object Detection API \u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb<\/a>\u300d \u306e TensorFlow Object Detection API \u3092\u65b0\u3057\u304f\u69cb\u7bc9\u3057\u305f Ubuntu24.04 \u306e\u74b0\u5883\uff08\u300c<a href=\"https:\/\/www.ecobioinfo.com\/?p=1862\">\u6df1\u5c64\u5b66\u7fd2\u3000Ubuntu 24.04 \u306b Tensorflow GPU \u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb<\/a>\u300d\uff09\u3067\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3057\u3066\u307f\u307e\u3057\u305f\u304c\u3001\u4e92\u63db\u554f\u984c\u306a\u3069\u304c\u3042\u308a\u96e3\u822a\u3057\u307e\u3057\u305f\u3002<\/p>\n<p>\u3010\u4e92\u63db\u554f\u984c\u306e\u767a\u751f\u3057\u305f\u30d0\u30fc\u30b8\u30e7\u30f3\u3011<br \/>\nUbuntu 24.04<br \/>\nPyTorch 2.9.0<br \/>\nPython 3.12.3<br \/>\nTernsorFlow(GPU) 2.20.0<br \/>\nCUDA 12.6 <\/p>\n<p>\u3053\u306e\u74b0\u5883\u3068\u30d0\u30fc\u30b8\u30e7\u30f3\u3067\u516c\u5f0f\u30c1\u30e5\u30fc\u30c8\u30ea\u30a2\u30eb\uff08<a href=\"https:\/\/tensorflow-object-detection-api-tutorial.readthedocs.io\/en\/latest\/install.html\">https:\/\/tensorflow-object-detection-api-tutorial.readthedocs.io\/en\/latest\/install.html<\/a>\uff09\u306e TensorFlow Object Detection API Installation \u4ee5\u964d\u306e\u624b\u9806\u3067 Object Detection API \u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3092\u3057\u307e\u3057\u305f\u304c\u3001\u6700\u5f8c\u306e\u30c6\u30b9\u30c8\u30d7\u30ed\u30b0\u30e9\u30e0(model_builder_tf2_test.py)\u306e\u5b9f\u884c\u3067\u30a8\u30e9\u30fc\u304c\u767a\u751f\u3057\u307e\u3057\u305f\u3002<\/p>\n<p>AttributeError: module &#8216;keras._tf_keras.keras.layers&#8217; has no attribute &#8216;experimental&#8217;<\/p>\n<p>\u3053\u306e\u30a8\u30e9\u30fc\u306e\u5bfe\u51e6\u306b\u3064\u3044\u3066\u306f\u4e0b\u8a18\u306e\u30b5\u30a4\u30c8\u3092\u53c2\u8003\u306b\u3057\u307e\u3057\u305f\u3002<\/p>\n<p><a href=\"https:\/\/github.com\/tensorflow\/tensorflow\/issues\/64349\">https:\/\/github.com\/tensorflow\/tensorflow\/issues\/64349<\/a><br \/>\nhow to solve this error ? : AttributeError: module &#8216;keras._tf_keras.keras.layers&#8217; has no attribute &#8216;experimental&#8217;  #64349<\/p>\n<p>\u4ed6\u306b\u3082 Numpy \u306e\u4e92\u63db\u554f\u984c\u3082\u3042\u308a\u307e\u3057\u305f\u306e\u3067\u3001\u3068\u308a\u3048\u3042\u305a\u306f Anaconda\u4eee\u60f3\u74b0\u5883, TensorFlow 2.16.0 \u672a\u6e80\u306e\u53e4\u3044\u30d0\u30fc\u30b8\u30e7\u30f3\u304c\u826f\u3055\u305d\u3046\u3067\u3059\u3002\uff08\u305f\u3060\u3057\u3001\u53e4\u3044\u30d0\u30fc\u30b8\u30e7\u30f3\u306e\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u306e\u5f71\u97ff\u3067pytorch\u74b0\u5883\u5074\u306b\u5f71\u97ff\u304c\u3042\u3063\u305f\u5834\u5408\u3001pytorch\u5074\u3092\u518d\u8a2d\u5b9a\u3059\u308b\u3053\u3068\u306b\u306a\u308b\u53ef\u80fd\u6027\u304c\u3042\u308a\u307e\u3059\u3002\uff09<\/p>\n<p>\u3010\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3057\u305f\u30d0\u30fc\u30b8\u30e7\u30f3\u3011<br \/>\nUbuntu 24.04<br \/>\nAnaconda 4.10.1<br \/>\nPython 3.9.25<br \/>\nTernsorFlow(GPU) 2.15.1<br \/>\nCUDA 13.0<\/p>\n<p>\u57fa\u672c\u7684\u306a\u624b\u9806\u306f\u30ea\u30f3\u30af\u5148\u306e\u516c\u5f0f\u30c1\u30e5\u30fc\u30c8\u30ea\u30a2\u30eb\u306b\u6cbf\u3063\u3066\u3044\u307e\u3059\u3002<br \/>\nTensorFlow 2 Object Detection API tutorial<br \/>\n<a href=\"https:\/\/tensorflow-object-detection-api-tutorial.readthedocs.io\/en\/latest\/install.html\">https:\/\/tensorflow-object-detection-api-tutorial.readthedocs.io\/en\/latest\/install.html<\/a><\/p>\n<p>1. Anaconda \u306e\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb<\/p>\n<p>TensorFlow Object Detection API \u306e\u516c\u5f0f\u30c1\u30e5\u30fc\u30c8\u30ea\u30a2\u30eb\u30b5\u30a4\u30c8\u306e\u30ea\u30f3\u30af\u304b\u3089\u30a4\u30f3\u30b9\u30c8\u30fc\u30e9\u3092\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9\u3057\u3066\u5b9f\u884c<\/p>\n<p>\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9\u3057\u305f\u30a4\u30f3\u30b9\u30c8\u30fc\u30e9\uff08<a href=\"https:\/\/repo.anaconda.com\/archive\/\">https:\/\/repo.anaconda.com\/archive\/<\/a>\uff09<br \/>\nAnaconda3-2021.05-Linux-x86_64.sh<\/p>\n<p>\u5b9f\u884c<br \/>\n<code><br \/>\n~$ chmod 777 .\/Anaconda3-2021.05-Linux-x86_64.sh<br \/>\n~$ .\/Anaconda3-2021.05-Linux-x86_64.sh<br \/>\n<\/code><br \/>\n\u30bf\u30fc\u30df\u30ca\u30eb\u518d\u8d77\u52d5<br \/>\n<code><br \/>\n\u78ba\u8a8d<br \/>\n~$ conda -V<br \/>\nconda 4.10.1<br \/>\n<\/code><\/p>\n<p>Anaconda\u4eee\u60f3\u74b0\u5883\u3067 python 3.9 \u3092\u6307\u5b9a<br \/>\n<code><br \/>\n~$ conda create -n tfod pip python=3.9<br \/>\n~$ conda activate tfod<\/p>\n<p>\u78ba\u8a8d<br \/>\n(tfod):~$ python -V<br \/>\nPython 3.9.25<br \/>\n<\/code><\/p>\n<p>\u4ee5\u964d\u306f\u4eee\u60f3\u74b0\u5883\u3067\u306e\u4f5c\u696d\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<p>2. TensorFlow GPU \u30a4\u30f3\u30b9\u30c8\u30fc\u30eb<br \/>\n\u4eee\u60f3\u74b0\u5883\u306b\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb<br \/>\n<code><br \/>\n(tfod):~\/anaconda3\/envs\/tfod$ pip install \"tensorflow[and-cuda]==2.15.1\"<\/p>\n<p>\u30d0\u30fc\u30b8\u30e7\u30f3\u306e\u78ba\u8a8d<br \/>\nPython \u5b9f\u884c<br \/>\n>>> import tensorflow as tf<br \/>\n>>> print(tf.__version__)<br \/>\n2.15.1<br \/>\n<\/code><\/p>\n<p>\u516c\u5f0f\u30b5\u30a4\u30c8\u306e\u901a\u308a\u306e\u78ba\u8a8d\u3092\u5b9f\u884c<br \/>\n<code><br \/>\n(tfod):~\/anaconda3\/envs\/tfod$ python -c \"import tensorflow as tf;print(tf.reduce_sum(tf.random.normal([1000, 1000])))\"<\/p>\n<p>\u5b9f\u884c\u7d50\u679c--------------------<br \/>\n(\u4e2d\u7565)<br \/>\n2025-12-10 14:06:44.983239: I tensorflow\/core\/common_runtime\/gpu\/gpu_device.cc:1929] Created device \/job:localhost\/replica:0\/task:0\/device:GPU:0 with 7197 MB memory:  -> device: 0, name: NVIDIA GeForce GTX 1070, pci bus id: 0000:01:00.0, compute capability: 6.1<br \/>\ntf.Tensor(-712.41534, shape=(), dtype=float32)<br \/>\n---------------------------<br \/>\n<\/code><\/p>\n<p>\u6b63\u5e38\u306b\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3055\u308c\u307e\u3057\u305f\u3002<\/p>\n<p>3. GPU \u8a2d\u5b9a<br \/>\nGPU\u306e\u30c9\u30e9\u30a4\u30d0\u7b49\u306b\u3064\u3044\u3066\u306f\u300c<a href=\"https:\/\/www.ecobioinfo.com\/?p=1862\">\u6df1\u5c64\u5b66\u7fd2\u3000Ubuntu 24.04 \u306b Tensorflow GPU \u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb<\/a>\u300d\u3067\u8a2d\u5b9a\u6e08\u307f<br \/>\n<code><br \/>\n\u78ba\u8a8d<br \/>\nPython \u5b9f\u884c<br \/>\n>>> import tensorflow as tf<br \/>\n>>> tf.config.list_physical_devices('GPU')<br \/>\n[PhysicalDevice(name='\/physical_device:GPU:0', device_type='GPU')]<br \/>\n<\/code><\/p>\n<p>4. TensorFlow Object Detection API \u30a4\u30f3\u30b9\u30c8\u30fc\u30eb<br \/>\n4.1 TensorFlow Model Garden \u3092\u53d6\u5f97<\/p>\n<p>\u4eee\u60f3\u74b0\u5883\u3067 TensorFlow Model Garden \u3092 git\u3067\u53d6\u5f97<br \/>\n<code><br \/>\n(tfod) :~\/anaconda3\/envs\/tfod$ git clone https:\/\/github.com\/tensorflow\/models.git<\/p>\n<p>\u78ba\u8a8d<br \/>\n(tfod):~\/anaconda3\/envs\/tfod$ ls models<br \/>\nAUTHORS             CONTRIBUTING.md  README.md    docs      research<br \/>\nCODEOWNERS          ISSUES.md        SECURITY.md  official  tensorflow_models<br \/>\nCODE_OF_CONDUCT.md  LICENSE          community    orbit<br \/>\n<\/code><\/p>\n<p>4.2 Protobuf \u30a4\u30f3\u30b9\u30c8\u30fc\u30eb<br \/>\n\u4eca\u56de\u306f\u3001pip \u3067\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3057\u3066\u307f\u307e\u3057\u305f\u3002<br \/>\n<code><br \/>\n(tfod):~\/anaconda3\/envs\/tfod$ python -m pip install --upgrade pip setuptools<br \/>\n(tfod):~\/anaconda3\/envs\/tfod$ pip install protobuf<br \/>\n<\/code><br \/>\nmodels\/research\/\u306b\u79fb\u52d5\u3057\u3066\u3001\u30c1\u30e5\u30fc\u30c8\u30ea\u30a2\u30eb\u306b\u66f8\u3044\u3066\u3042\u308b\u30b3\u30de\u30f3\u30c9\u5b9f\u884c\u3002<br \/>\n<code><br \/>\n(tfod):~\/anaconda3\/envs\/tfod\/models\/research$ protoc object_detection\/protos\/*.proto --python_out=.<br \/>\n<\/code><\/p>\n<p>4.3 COCO API \u30a4\u30f3\u30b9\u30c8\u30fc\u30eb<br \/>\n<code><br \/>\n(tfod) :~\/anaconda3\/envs\/tfod$ git clone https:\/\/github.com\/cocodataset\/cocoapi.git<br \/>\n(tfod) :~\/anaconda3\/envs\/tfod$ cd cocoapi\/PythonAPI<br \/>\n(tfod) :~\/anaconda3\/envs\/tfod$ make<\/p>\n<p>\u5b9f\u884c\u7d50\u679c\uff08make\u3067\u30a8\u30e9\u30fc\uff09--------------------<br \/>\n(\u4e2d\u7565)<br \/>\ncc1: fatal error: pycocotools\/_mask.c: \u305d\u306e\u3088\u3046\u306a\u30d5\u30a1\u30a4\u30eb\u3084\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u306f\u3042\u308a\u307e\u305b\u3093<br \/>\ncompilation terminated.<br \/>\nerror: command '\/usr\/bin\/gcc' failed with exit code 1<br \/>\nmake: *** [Makefile:3: all] \u30a8\u30e9\u30fc 1<br \/>\n---------------------------<br \/>\n<\/code><br \/>\nmake\u3067\u30a8\u30e9\u30fc\u304c\u767a\u751f\u3057\u307e\u3057\u305f\u3002<br \/>\n\u30a8\u30e9\u30fc\u5bfe\u51e6\u306e\u53c2\u8003<br \/>\n<a href=\"https:\/\/cocoinit23.com\/no-such-file-or-directory-pycocotools-_mask-c\/\">https:\/\/cocoinit23.com\/no-such-file-or-directory-pycocotools-_mask-c\/<\/a><br \/>\ncython\u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb<br \/>\n<code><br \/>\n(tfod):~\/anaconda3\/envs\/tfod$ pip install cython<br \/>\n<\/code><br \/>\nmake\u3092\u518d\u5b9f\u884c\u3057\u3066\u30a8\u30e9\u30fc\u306a\u3057<\/p>\n<p>pycocotools\u3092\u30b3\u30d4\u30fc<br \/>\n<code><br \/>\n(tfod) :~\/anaconda3\/envs\/tfod\/cocoapi\/PythonAPI$ cp -r pycocotools ~\/anaconda3\/envs\/tfod\/models\/research\/<br \/>\n<\/code><\/p>\n<p>\u30bf\u30fc\u30df\u30ca\u30eb\u518d\u8d77\u52d5<\/p>\n<p>4.4 Object Detection API \u30a4\u30f3\u30b9\u30c8\u30fc\u30eb<br \/>\nmodels\/research\u306b\u79fb\u52d5<br \/>\n<code><br \/>\n(tfod) :~\/anaconda3\/envs\/tfod\/models\/research$ cp object_detection\/packages\/tf2\/setup.py .<br \/>\n<\/code><br \/>\n\u30d0\u30fc\u30b8\u30e7\u30f3\u3092 2.16.0 \u672a\u6e80\u306b\u3059\u308b\u305f\u3081\u306b setup.py \u3092\u4e0b\u8a18\u306e\u3088\u3046\u306b\u5909\u66f4\u3057\u307e\u3057\u305f\u3002<br \/>\n<code><br \/>\n\u5143   'tf-models-official>=2.5.1',<br \/>\n\u4fee\u6b63 'tf-models-official>=2.5.1,<2.16.0',\n<\/code><\/p>\n<p>\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u5b9f\u884c<br \/>\n<code><br \/>\n(tfod) :~\/anaconda3\/envs\/tfod\/models\/research$ python -m pip install .<br \/>\n<\/code><\/p>\n<p>4.5 \u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u306e\u30c6\u30b9\u30c8<br \/>\n<code><br \/>\n(tfod) :~\/anaconda3\/envs\/tfod\/models\/research$ python object_detection\/builders\/model_builder_tf2_test.py<\/p>\n<p>\u5b9f\u884c\u7d50\u679c--------------------<br \/>\n(\u4e2d\u7565)<br \/>\nINFO:tensorflow:time(__main__.ModelBuilderTF2Test.test_unknown_ssd_feature_extractor): 0.0s<br \/>\nI1210 14:53:06.966625 128757106296320 test_util.py:2574] time(__main__.ModelBuilderTF2Test.test_unknown_ssd_feature_extractor): 0.0s<br \/>\n[       OK ] ModelBuilderTF2Test.test_unknown_ssd_feature_extractor<br \/>\n----------------------------------------------------------------------<br \/>\nRan 24 tests in 27.476s<\/p>\n<p>OK (skipped=1)<br \/>\n---------------------------<br \/>\n<code><\/p>\n<p>\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u51fa\u6765\u307e\u3057\u305f\u3002<\/p>\n<p>\uff1c\uff1c\u30b5\u30f3\u30d7\u30eb\u5b9f\u884c\uff1e\uff1e<br \/>\n\u4ee5\u4e0b\u306e\u30da\u30fc\u30b8\u306e\u30b5\u30f3\u30d7\u30eb\u3092 JupyterNotebook \u3067\u5b9f\u884c\u3057\u3066\u307f\u307e\u3057\u305f\u3002<\/p>\n<p>Object Detection From TF2 Saved Model<br \/>\n<a href=\"https:\/\/tensorflow-object-detection-api-tutorial.readthedocs.io\/en\/latest\/auto_examples\/plot_object_detection_saved_model.html#sphx-glr-auto-examples-plot-object-detection-saved-model-py\">https:\/\/tensorflow-object-detection-api-tutorial.readthedocs.io\/en\/latest\/auto_examples\/plot_object_detection_saved_model.html#sphx-glr-auto-examples-plot-object-detection-saved-model-py<\/a><\/p>\n<p>\u4eee\u60f3\u74b0\u5883\u306b jupyter notebook \u30a4\u30f3\u30b9\u30c8\u30fc\u30eb<br \/>\n<code><br \/>\n(tfod) :~\/anaconda3\/envs\/tfod$pip install jupyter<br \/>\n<code><\/p>\n<p>\u516c\u5f0f\u30da\u30fc\u30b8\u306e\u30b5\u30f3\u30d7\u30eb\u3092 Jupyter notebook \u306b\u30b3\u30d4\u30fc\u30da\u30fc\u30b9\u30c8\u3057\u3066\u9806\u6b21\u5b9f\u884c<br \/>\n\uff08\u7d50\u679c\u306e\u753b\u50cf\u3092\u8868\u793a\u3055\u305b\u308b\u305f\u3081\u30b5\u30f3\u30d7\u30eb\u30bd\u30fc\u30b9\u306b %matplotlib inline \u3092\u8ffd\u52a0\u3057\u307e\u3057\u305f\uff09<\/p>\n<p>\u5b9f\u884c\u7d50\u679c<br \/>\n<a href=\"http:\/\/www.ecobioinfo.com\/?attachment_id=2032\" rel=\"attachment wp-att-2032\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.ecobioinfo.com\/wordpress\/wp-content\/uploads\/2025\/12\/ObjectdetectionAPIinstall\u30b5\u30f3\u30d7\u30eb\u7d50\u679c-234x300.png\" alt=\"ObjectdetectionAPIinstall\u30b5\u30f3\u30d7\u30eb\u7d50\u679c\" width=\"234\" height=\"300\" class=\"alignnone size-medium wp-image-2032\" srcset=\"https:\/\/www.ecobioinfo.com\/wordpress\/wp-content\/uploads\/2025\/12\/ObjectdetectionAPIinstall\u30b5\u30f3\u30d7\u30eb\u7d50\u679c-234x300.png 234w, https:\/\/www.ecobioinfo.com\/wordpress\/wp-content\/uploads\/2025\/12\/ObjectdetectionAPIinstall\u30b5\u30f3\u30d7\u30eb\u7d50\u679c.png 600w\" sizes=\"auto, (max-width: 234px) 100vw, 234px\" \/><\/a><\/p>\n<p>\u6b63\u5e38\u306b\u52d5\u4f5c\u3057\u307e\u3057\u305f\u3002<\/p>\n<p>\uff082025\/12\/12 Shin Onda\uff09<\/p>\n","protected":false},"excerpt":{"rendered":"\u300c\u6df1\u5c64\u5b66\u7fd2\u3000Ubuntu 20.04 \u306b TensorFlow Object Detection API \u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u300d \u306e TensorFlow Object Detection API \u3092\u65b0\u3057\u304f\u69cb\u7bc9\u3057\u305f Ubunt &#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-2026","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\/2026","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=2026"}],"version-history":[{"count":19,"href":"https:\/\/www.ecobioinfo.com\/index.php?rest_route=\/wp\/v2\/posts\/2026\/revisions"}],"predecessor-version":[{"id":2046,"href":"https:\/\/www.ecobioinfo.com\/index.php?rest_route=\/wp\/v2\/posts\/2026\/revisions\/2046"}],"wp:attachment":[{"href":"https:\/\/www.ecobioinfo.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=2026"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.ecobioinfo.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=2026"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.ecobioinfo.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=2026"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}