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

图像垂直翻转的问题 #513

Closed
dahaigui opened this issue Jul 10, 2024 · 19 comments
Closed

图像垂直翻转的问题 #513

dahaigui opened this issue Jul 10, 2024 · 19 comments
Labels
Fixed question Further information is requested

Comments

@dahaigui
Copy link

我使用Pillow将图像进行垂直翻转之后,使用图像查看器查看,图像已经翻转,但是在X-AnyLabeling软件中并没有翻转,这是为什么?

@CVHub520 CVHub520 added the question Further information is requested label Jul 10, 2024
@CVHub520
Copy link
Owner

Hey there! @dahaigui,

Thank you for reaching out and bringing this discrepancy to our attention. I have tested the function using Pillow to vertically flip images, and it appears to be functioning correctly on my end. When I view the flipped image using standard image viewers, the image is indeed flipped vertically as expected.

from PIL import Image

def flip_image_vertical(input_path, output_path):
    with Image.open(input_path) as img:
        flipped_img = img.transpose(Image.Transpose.FLIP_TOP_BOTTOM)
        flipped_img.save(output_path)

input_image_path = 'path/to/your/input/image.jpg'
output_image_path = 'path/to/your/output/image_flipped.jpg'

flip_image_vertical(input_image_path, output_image_path)

The issue you're experiencing seems to be specific to X-AnyLabeling software. This could be due to various reasons such as differences in how the software interprets image metadata or a potential bug within the software itself when handling flipped images.

To ensure that we're aligned with the latest updates and improvements, I recommend updating your codebase to use the latest version of X-AnyLabeling. This will allow us to benefit from any bug fixes and optimizations that may have been included in newer releases.

Please let me know if you require any further assistance or if there's anything else I can help you with.

image

image

@dahaigui
Copy link
Author

My code is as follows

def vertical_flip_image(image_path, output_path):
    image = Image.open(image_path)

    flipped_image = image.transpose(Image.FLIP_TOP_BOTTOM)

    flipped_image.save(output_path)

This doesn't seem to be much different from your code, but my image is not flipped in X-AnyLabeling, although when I view the image using the Image Tool, it is flipped.
image
image
image
image

@dahaigui
Copy link
Author

I'm using version 2.3.6, and I still have this problem. Could you please let me send you the picture via email?

@CVHub520
Copy link
Owner

I'm using version 2.3.6, and I still have this problem. Could you please let me send you the picture via email?

Yes. Please zip the images and send to the email: cv_hub@163.com

@dahaigui
Copy link
Author

I'm using version 2.3.6, and I still have this problem. Could you please let me send you the picture via email?

Yes. Please zip the images and send to the email: cv_hub@163.com

I just sent it to this email

@CVHub520
Copy link
Owner

Does this meet your expectations?

image

image

@dahaigui
Copy link
Author

Yes!Exactly!

@CVHub520
Copy link
Owner

As I mentioned above, please pull the latest source code and run it, do not use the GUI version.

@dahaigui
Copy link
Author

I am using the version 2.3.6, I'll try the 2.3.7 version of the source code right away.

@dahaigui
Copy link
Author

I'm using the latest version of the source code, but this problem still occurs.
image

@CVHub520
Copy link
Owner

This is not the latest version of the source code, but a release version that was published a few months ago. Please use the git clone method to pull the latest source code, or download it directly from here.

image

Release版本:
通常指的是项目维护者发布的稳定版本,这些版本在发布前经过了测试,旨在提供给用户一个稳定可靠的软件版本。
Release版本并不会包含最新的开发进展或最近的修复,因为它们是定期发布的。
用户可以通过项目页面上的 release 下载链接直接获取Release版本。

Git版本:
Git 是从项目的源代码仓库中克隆最新的开发版本。这个版本通常包含了最新的功能、修复和改进。
克隆的版本可能是开发中的,可能不如Release版本稳定,但它们提供了最新代码的访问。

@dahaigui
Copy link
Author

I met the same problem, maybe my dependencies are not updated. I will try to reinstall the environment.

@dahaigui
Copy link
Author

I updated my dependencies and still have this problem. Will this problem affect my use of this data to train the yolov8s-seg model?

@CVHub520
Copy link
Owner

The statement doesn't seem coherent, as the image loading process is not related to the system's env.

Incidentally, data augmentation is not advisable to be performed offline. Instead, it should be incorporated as a preprocessing step within the training framework. Therefore, I recommend annotating the original file without augmented images, such as flips, rotations, and other transformations.

@dahaigui
Copy link
Author

OK, thank you very much for your suggestion. I just changed a computer and tried it, and the display is normal. This problem may be caused by some bugs in my computer.

@CVHub520
Copy link
Owner

Thank you for your feedback!

I'm glad to hear that switching to a different computer resolved the display issue. It's possible that the problem was indeed related to specific bugs on your previous machine. Your update is helpful for us to understand the context and potential causes.

If you encounter any more issues or have further suggestions, please don't hesitate to let us know. Your input is valuable to us!

@dahaigui
Copy link
Author

I just discovered that when I packaged the pictures directly into a compressed package, which is the picture I sent to you yesterday, there was no such problem. However, when I packaged the picture folder I generated and then decompressed it on the computer I used this morning, the problem still existed. I will send you the picture folder again to see what the reason is.

@dahaigui
Copy link
Author

I found the problem, it might be caused by my json file. After I deleted the json file, I can view it normally.

@dahaigui
Copy link
Author

I have found the problem now, that is, the imagePath in my json file has not been modified

@CVHub520 CVHub520 added the Fixed label Aug 8, 2024
@CVHub520 CVHub520 closed this as completed Aug 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Fixed question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants