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

Circular Import Issue #21

Open
jeffreyianwilson opened this issue Jun 4, 2023 · 0 comments
Open

Circular Import Issue #21

jeffreyianwilson opened this issue Jun 4, 2023 · 0 comments

Comments

@jeffreyianwilson
Copy link

I am using the demo script verbatim in VS Code with Python 3.11 and I am getting a circular import error

ImportError: cannot import name 'patchify' from partially initialized module 'patchify' (most likely due to a circular import)

import numpy as np
from PIL import Image
from patchify import patchify
   
image = Image.open("C:\\Projects\\Python\\Roboflow\\patchify.jpg")
image = np.asarray(image)
patches = patchify(image, (512, 512, 3), step=512)
print(patches.shape)  # (6, 10, 1, 512, 512, 3)

for i in range(patches.shape[0]):
    for j in range(patches.shape[1]):
        patch = patches[i, j, 0]
        patch = Image.fromarray(patch)
        num = i * patches.shape[1] + j
        patch.save(f"patch_{num}.jpg")
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

1 participant