towhee-io / towhee

Towhee is a framework that is dedicated to making neural data processing pipelines simple and fast.
https://towhee.io
Apache License 2.0
3.21k stars 247 forks source link

[Bug]: image color of DataCollection output was wrong. #2656

Closed no251-1 closed 1 year ago

no251-1 commented 1 year ago

Is there an existing issue for this?

Current Behavior

The color of image was wrong.

Here is the code.

p_display = p_embed.output('img_path', 'img', 'vec')
DataCollection(p_display('./test/OM/*.JPG')).show()

image

here is the original image. images_74_ 219, 1596, 1203, 2529 _0

Expected Behavior

No response

Steps To Reproduce

No response

Environment

- Towhee version(e.g. v0.1.3 or 8b23a93): V1.1.0
- OS(Ubuntu or CentOS): Windows
- CPU/Memory: i5/32GB
- GPU: RX640
- Others:

Anything else?

I don't know why. Maybe it is related with my computer or CV2.

junjiejiangjjj commented 1 year ago

https://towhee.io/image-decode/cv2 ops.image_decode.cv2 () decodes to BGR by default and ops.image_decode.cv2 ('rgb') decodes to RGB

no251-1 commented 1 year ago

thanks. It works when i add 'rgb' into ops.image_decode('rgb').

p_embed = (
    pipe.input('src')
        .flat_map('src', 'img_path', load_image)
        .map('img_path', 'img', ops.image_decode('rgb'))
        .map('img', 'vec', ops.image_embedding.timm(model_name=MODEL, device=DEVICE))
)

but for the code below, i still don't know how to solve it.

p_search_img = (
    p_search_pre.map('pred', 'pred images', read_images)
                .output('img', 'pred images')
)
DataCollection(p_search_img('test/goldfish/*.JPEG')).show()
junjiejiangjjj commented 1 year ago

How do you define read_images, the rgb configuration should be set here.

stale[bot] commented 1 year ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. Rotten issues close after 30d of inactivity. Close the stale issues and pull requests after 7 days of inactivity. Reopen the issue with /reopen.