Skip to content

solution for jpegpy #57

Open
Open
@AbitGo

Description

@AbitGo

someone meet problem as "ImportError: cannot import name '_jpegpy' from partially initialized module 'lib.data_preprocess.utils.jpegpy' (most likely due to a circular import) (/home/dancer/project_xm/CADDM-master/lib/data_preprocess/utils/jpegpy/init.py)"

issue:#56 (comment)

but, it is so difficult for me to compile jpegpy.so, emmmm beacause i use windows.so i give a direct solution for this problem:
1.enter the file :"CADDM-master\lib\data_preprocess\utils\jpegpy":
2.replace the following code to originial code:

import imageio
import numpy as np
from io import BytesIO

def jpeg_encode(img: np.array, quality=80):
img_byte_arr = BytesIO()
imageio.imwrite(img_byte_arr, img, format='JPEG', quality=quality)
return img_byte_arr.getvalue()

def jpeg_decode(code: bytes):
img = imageio.imread(code)
return img

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions