|
1871 | 1871 | "## Export model inference graph"
|
1872 | 1872 | ]
|
1873 | 1873 | },
|
1874 | | - { |
1875 | | - "cell_type": "markdown", |
1876 | | - "metadata": { |
1877 | | - "colab_type": "text", |
1878 | | - "id": "6rYr6VKH8_QU" |
1879 | | - }, |
1880 | | - "source": [ |
1881 | | - "The below code cell adds a line to the tf_utils.py file. This is a temporary fix to a [exporting issue](https://github.com/tensorflow/models/issues/8841) occuring when using the OD API with Tensorflow 2. This code will be removed as soon as the OD Team puts out a fix.\n", |
1882 | | - "\n", |
1883 | | - "All credit goes to Github user [Jacobsolawetz](https://github.com/Jacobsolawetz), who provided this [temporary fix](https://github.com/tensorflow/models/issues/8841#issuecomment-657647648)." |
1884 | | - ] |
1885 | | - }, |
1886 | | - { |
1887 | | - "cell_type": "code", |
1888 | | - "execution_count": 21, |
1889 | | - "metadata": { |
1890 | | - "colab": { |
1891 | | - "base_uri": "https://localhost:8080/", |
1892 | | - "height": 34 |
1893 | | - }, |
1894 | | - "colab_type": "code", |
1895 | | - "id": "Usv5FMT1xG1L", |
1896 | | - "outputId": "f3c95abe-ff6a-4f66-fb27-b6959b1cb0ab" |
1897 | | - }, |
1898 | | - "outputs": [ |
1899 | | - { |
1900 | | - "name": "stdout", |
1901 | | - "output_type": "stream", |
1902 | | - "text": [ |
1903 | | - "Overwriting /usr/local/lib/python3.6/dist-packages/tensorflow/python/keras/utils/tf_utils.py\n" |
1904 | | - ] |
1905 | | - } |
1906 | | - ], |
1907 | | - "source": [ |
1908 | | - "with open('/usr/local/lib/python3.6/dist-packages/tensorflow/python/keras/utils/tf_utils.py') as f:\n", |
1909 | | - " tf_utils = f.read()\n", |
1910 | | - "\n", |
1911 | | - "with open('/usr/local/lib/python3.6/dist-packages/tensorflow/python/keras/utils/tf_utils.py', 'w') as f:\n", |
1912 | | - " # Set labelmap path\n", |
1913 | | - " throw_statement = \"raise TypeError('Expected Operation, Variable, or Tensor, got ' + str(x))\"\n", |
1914 | | - " tf_utils = tf_utils.replace(throw_statement, \"if not isinstance(x, str):\" + throw_statement)\n", |
1915 | | - " f.write(tf_utils)" |
1916 | | - ] |
1917 | | - }, |
1918 | 1874 | {
|
1919 | 1875 | "cell_type": "code",
|
1920 | 1876 | "execution_count": 22,
|
|
0 commit comments