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

Tensorflow compatibility with pyinstaller #66421

Open
Bhavi-cd opened this issue Apr 25, 2024 · 2 comments
Open

Tensorflow compatibility with pyinstaller #66421

Bhavi-cd opened this issue Apr 25, 2024 · 2 comments
Assignees
Labels
subtype:windows Windows Build/Installation Issues TF 2.16 type:support Support issues

Comments

@Bhavi-cd
Copy link

Issue type

Support

Have you reproduced the bug with TensorFlow Nightly?

No

Source

source

TensorFlow version

2.16.1

Custom code

Yes

OS platform and distribution

Windows

Mobile device

No response

Python version

3.11.9

Bazel version

No response

GCC/compiler version

No response

CUDA/cuDNN version

No response

GPU model and memory

No response

Current behavior?

I have encountered a problem while running my custom trained YOLOv8-obb model for object detection using an executable (.exe) file generated with PyInstaller. The model loads properly, but when attempting to perform inference, the code halts without providing any output.

Steps to Reproduce:

Compile YOLOv8-obb model with custom training data.
Generate an executable file using PyInstaller.
Run the executable file on a machine with compatible dependencies.
Attempt object detection using the executable.

Standalone code to reproduce the issue

##current behavior 

After running the executable, I expect the object detection process to proceed smoothly and provide the desired output, identifying objects in the input images or videos.

## Actual Behavior 

Upon running the executable, the model loads successfully but fails to perform inference. The code halts without providing any output, leaving the object detection process incomplete.

`PyInstaller :6.6.0`
`Ultralytics: 8.2.2`

    I have tried running the code directly without PyInstaller to ensure it's not an issue with the model or code itself.
    I have checked for any missing dependencies or compatibility issues between PyInstaller and the YOLOv8-obb model.    I have tried running the code directly without PyInstaller to ensure it's not an issue with the model or code itself.
    I have checked for any missing dependencies or compatibility issues between PyInstaller and the YOLOv8-obb model.

Relevant log output

import logging
from logging.handlers import RotatingFileHandler
import time
from ultralytics import YOLO
import cv2

# Configure logging with rotation
log_formatter = logging.Formatter('%(asctime)s %(levelname)s %(message)s')
file_handler = RotatingFileHandler(r'log_files\test_log_test.log', maxBytes=1024 * 1024 * 5, backupCount=5)  # Rotate every 5MB, keep 5 backups
file_handler.setFormatter(log_formatter)
logger = logging.getLogger('test_log_test')
logger.setLevel(logging.INFO)
logger.addHandler(file_handler)

cnt = 0
while True:
    cnt+=1
    try:
        logger.info(cnt)
        logger.info("service test working")
        time.sleep(10)

        model = YOLO(r"weights\best(100epoch).pt")
        model.fuse()
        logger.info("yolo done")

        img_path = r"test_image.jpg"
        img = cv2.imread(img_path)
        logger.info("reading image")
        cv2.imwrite(r"test_image_output.jpg",img)
        logger.info("writing image")
        results = model.predict(img_path)

        logger.info("prediction doness")
    except Exception as e:
        # Log error
        logger.error(f"Error occurred : {e}")




# Logs

124851 WARNING: Failed to collect submodules for 'keras.src.backend.torch' because importing 'keras.src.backend.torch' raised: AttributeError: module 'torch' has no attribute 'float8_e4m3fn'

@Venkat6871
Copy link

Hi @Bhavi-cd ,

  • Ensure that the version of PyTorch used by Ultralytics (indirectly through YOLO) is compatible with the other components in your environment. If possible, try downgrading or upgrading PyTorch to a version that is known to work well with YOLOv8-obb and your other dependencies.
  • Verify if the version of Ultralytics (8.2.2) you are using is compatible with the specific version of YOLOv8-obb you have trained. Sometimes, newer or older versions of object detection frameworks like YOLO may not work seamlessly with the corresponding versions of their supporting libraries. And et us know if the issue still persists?

Thank you!

@Venkat6871 Venkat6871 added the stat:awaiting response Status - Awaiting response from author label Apr 26, 2024
@Bhavi-cd
Copy link
Author

Hi @Venkat6871
I have tried downgrading the version, also when I run the .py file it is running perfectly but when I convert it to .exe these problem occur.

@google-ml-butler google-ml-butler bot removed the stat:awaiting response Status - Awaiting response from author label Apr 26, 2024
@Venkat6871 Venkat6871 added the subtype:windows Windows Build/Installation Issues label Apr 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
subtype:windows Windows Build/Installation Issues TF 2.16 type:support Support issues
Projects
None yet
Development

No branches or pull requests

2 participants