Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ImportError from image_utils #952

Open
alxhoff opened this issue Sep 28, 2023 · 4 comments
Open

ImportError from image_utils #952

alxhoff opened this issue Sep 28, 2023 · 4 comments

Comments

@alxhoff
Copy link

alxhoff commented Sep 28, 2023

Hi,

I hope I am correct here, a docker I have been using without problems for the past months started throwing an error today. The only difference I have noted recently on the docker I am using as my base image (tensorflow/tensorflow:latest-gpu) is that they have moved from python 3.10 to 3.11, so I have manually set python to Python 3.10.12 but the problem persists.

The error output is as follows

    sys.exit(main())
  File "/home/sources/TensorDSE/resources/model_summaries/CreateModelSummary.py", line 38, in main
    SummarizeGraph(args.model, args.outputdir, args.outputname)
  File "/home/sources/TensorDSE/resources/model_summaries/summarize.py", line 2, in SummarizeGraph
    from mltk.core import summarize_model
  File "/usr/local/lib/python3.10/dist-packages/mltk/core/__init__.py", line 7, in <module>
    from .tflite_model import *
  File "/usr/local/lib/python3.10/dist-packages/mltk/core/tflite_model/__init__.py", line 2, in <module>
    from .tflite_model import (
  File "/usr/local/lib/python3.10/dist-packages/mltk/core/tflite_model/tflite_model.py", line 13, in <module>
    from . import tflite_schema as _tflite_schema_fb
  File "/usr/local/lib/python3.10/dist-packages/mltk/core/tflite_model/tflite_schema.py", line 27, in <module>
    from tflite_support.schema_py_generated import *
  File "/usr/local/lib/python3.10/dist-packages/tflite_support/__init__.py", line 53, in <module>
    from tflite_support import task
  File "/usr/local/lib/python3.10/dist-packages/tflite_support/task/__init__.py", line 32, in <module>
    from . import vision
  File "/usr/local/lib/python3.10/dist-packages/tflite_support/task/vision/__init__.py", line 20, in <module>
    from tensorflow_lite_support.python.task.vision import image_classifier
  File "/usr/local/lib/python3.10/dist-packages/tensorflow_lite_support/python/task/vision/image_classifier.py", line 23, in <module>
    from tensorflow_lite_support.python.task.vision.core import tensor_image
  File "/usr/local/lib/python3.10/dist-packages/tensorflow_lite_support/python/task/vision/core/tensor_image.py", line 19, in <module>
    from tensorflow_lite_support.python.task.vision.core.pybinds import image_utils
ImportError: generic_type: cannot initialize type "StatusCode": an object with that name is already defined

To recreate the error minimally the docker image can be pulled and run using this Dockerfile.

wget https://github.com/alxhoff/TensorDSE/raw/master/resources/model_summaries/Dockerfile
docker build -t tensorflow/tensorflow:latest-gpu .
docker run -it tensorflow/tensorflow:latest-gpu /bin/bash 

and the minimal example should be there as test_summarize_model.py and should throw the error.

The code below is what is contained in test_summarize_model.py

from mltk.core import summarize_model
import wget

model_name = wget.download("https://github.com/alxhoff/TensorDSE/raw/master/resources/models/example_models/MNIST_full_quanitization.tflite")

summary = summarize_model(model_name, tflite=True)

print(summary)

If this is remotely the correct place to bring up an error like this please let me know what other information could be useful and a big thanks to anyone that takes the time to help.

Cheers,

Alex

@alxhoff
Copy link
Author

alxhoff commented Sep 28, 2023

I believe the problem is using a Tensorflow version > 2.13

@nathan-stewart
Copy link

Other discussion on this issue: ultralytics/ultralytics#5161 (comment)

@glenn-jocher
Copy link

@alxhoff did you find any solution to this problem? I've been able to reproduce this bug by simply attempting to import the package in Google Colab, nothing more.

Screenshot 2024-02-19 at 16 52 04

@alxhoff
Copy link
Author

alxhoff commented Feb 20, 2024

Hi @glenn-jocher,

sadly not, had to stop using that set up.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants