-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
tkinter causes CustomObjectDetection module import failure in Google Cloud Function #803
Comments
Yeah I noticed the same thing too @EdwinAguirre92 ! In fact, I assume the rest of the Image references in the functions/classes that follow are from the PIL import, rather than the tkinter import. Perhaps tkinter isn't necessary after all - I ended up actually using a different package than ImageAI for my current project, but removing tkinter could be helpful for future projects. |
Any updates on this? I am facing the same issue on AWS Lambda. |
To resolve the issue with ImageAI and make the object detection scalable, efficient, and cloud-compatible, replace CustomObjectDetection with a streamlined TensorFlow-based YOLO implementation: def run_detection(image_path, model_path, output_path):
def postprocess_predictions(predictions, original_shape): def annotate_image(image, detections, output_path): Replace the old ObjectDetection block with: |
What kind of device are you using? |
trim.BE3FE30B-0F27-43DE-AB9C-7145B3976C32.MOV |
Good afternoon,
I'm trying to upload a trained Custom Object Detection model to Google Cloud Storage and run inference using a Cloud Function. However, when I upload my function to the Google Cloud Platform, importing the CustomObjectDetection module fails. I think this is because one of the required packages is tkinter, which might not work in a cloud/headless platform? But I can't figure out why tkinter/a GUI would be required for imageai. Any help toward resolving this would be greatly appreciated! My code and the full stack trace of my error is below:
`import numpy as np
from imageai.Detection.Custom import CustomObjectDetection
def predict(self):
return "hello world"`
Deployment failure:
Function failed on loading user code. This is likely due to a bug in the user code. Error message: Traceback (most recent call last):
File "/layers/google.python.pip/pip/bin/functions-framework", line 8, in
sys.exit(_cli())
File "/layers/google.python.pip/pip/lib/python3.9/site-packages/click/core.py", line 1128, in call
return self.main(*args, **kwargs)
File "/layers/google.python.pip/pip/lib/python3.9/site-packages/click/core.py", line 1053, in main
rv = self.invoke(ctx)
File "/layers/google.python.pip/pip/lib/python3.9/site-packages/click/core.py", line 1395, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/layers/google.python.pip/pip/lib/python3.9/site-packages/click/core.py", line 754, in invoke
return __callback(*args, **kwargs)
File "/layers/google.python.pip/pip/lib/python3.9/site-packages/functions_framework/_cli.py", line 37, in _cli
app = create_app(target, source, signature_type)
File "/layers/google.python.pip/pip/lib/python3.9/site-packages/functions_framework/init.py", line 288, in create_app
spec.loader.exec_module(source_module)
File "", line 850, in exec_module
File "", line 228, in _call_with_frames_removed
File "/workspace/main.py", line 2, in
from imageai.Detection.Custom import CustomObjectDetection
File "/layers/google.python.pip/pip/lib/python3.9/site-packages/imageai/Detection/init.py", line 2, in
from tkinter import Image
File "/layers/google.python.runtime/python/lib/python3.9/tkinter/init.py", line 37, in
import _tkinter # If this fails your Python may not be configured for Tk
ImportError: libBLT.2.5.so.8.6: cannot open shared object file: No such file or directory
. Please visit https://cloud.google.com/functions/docs/troubleshooting for in-depth troubleshooting documentation.
The text was updated successfully, but these errors were encountered: