tensorflow / tensorflow/tflite-support

ImportError from image_utils

Open
#952 4 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C++
Stars
441
Forks
146
PR merge metrics
No merged PRs in 30d

Description

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

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with resources/model_summaries/Dockerfile and test_summarize_model.py, then reproduce the failure at the mltk.core.summarize_model import described in the traceback. Done should mean the minimal example imports successfully and prints the model summary without the StatusCode ImportError.

Written by the indexing model from the issue text.

Assessment

Tech stack
docker, python
Domain
machine-learning
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.