towhee-io/towhee

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

no251-1 opened this issue · 4 comments

Is there an existing issue for this?

  • I have searched the existing issues

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.

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

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()

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

stale commented

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.