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

different result from local run and demo #31

Open
xingchen2022 opened this issue Dec 16, 2024 · 4 comments
Open

different result from local run and demo #31

xingchen2022 opened this issue Dec 16, 2024 · 4 comments

Comments

@xingchen2022
Copy link

Thanks for you wonderful work!
I have tried different scripts in reamMe and huggingface, but i can't get the same result like online demo(https://huggingface.co/spaces/Stable-X/StableNormal)

the online demo result like:
image

the local results as follows:
torch.hub.load("Stable-X/StableNormal", "StableNormal", trust_repo=True, yoso_version='yoso-normal-v0-3')
normal_mapv0-3

torch.hub.load("Stable-X/StableNormal", "StableNormal", trust_repo=True, yoso_version='yoso-normal-v1-0')
normal_mapv1-0

torch.hub.load("Stable-X/StableNormal", "StableNormal_turbo", trust_repo=True, yoso_version='yoso-normal-v0-3')
normal_map_turbov0-3

torch.hub.load("Stable-X/StableNormal", "StableNormal_turbo", trust_repo=True, yoso_version='yoso-normal-v1-0')
normal_map_turbov1-0

torch.hub.load("hugoycj/StableNormal", "StableNormal", trust_repo=True, yoso_version='yoso-normal-v1-5')
normal_mapv1-5

torch.hub.load("hugoycj/StableNormal", "StableNormal_turbo", trust_repo=True, yoso_version='yoso-normal-v1-5')
normal_map_turbov1_5

could you give me some hints? thank you in advance!

@xingchen2022
Copy link
Author

I wonder what's the version of yoso module is used in the online demo?
Very appreciate if you could give me some advice : ) @hugoycj

@hugoycj
Copy link
Collaborator

hugoycj commented Dec 19, 2024

@xingchen2022 Sorry for bothering you! I'm currently occupied with the new release version scheduled for the end of this month and don't have sufficient workload to address the issues in the current release.

The main diff between gradio and torch.hub versions is that torch.hub pads image to square before inference while gradio resizes directly, mainly a resolution difference. We avoid direct resizing as it may cause extra artifacts. For similar online demo performance, use cropping mode like this:

import torch
from PIL import Image

input_image = Image.open("path/to/your/image.jpg")
predictor = torch.hub.load("Stable-X/StableNormal", "StableNormal", trust_repo=True)
normal_image = predictor(input_image, mode='stable', preprocess='crop')
normal_image.save("output/normal_map.png")

It's worth noting that the yoso-normal-v1-5 version is still unstable at present. Hence, we don't recommend using the normal output from this version for supervision. Hope this helps!

@xingchen2022
Copy link
Author

@xingchen2022 Sorry for bothering you! I'm currently occupied with the new release version scheduled for the end of this month and don't have sufficient workload to address the issues in the current release.

The main diff between gradio and torch.hub versions is that torch.hub pads image to square before inference while gradio resizes directly, mainly a resolution difference. We avoid direct resizing as it may cause extra artifacts. For similar online demo performance, use cropping mode like this:

import torch
from PIL import Image

input_image = Image.open("path/to/your/image.jpg")
predictor = torch.hub.load("Stable-X/StableNormal", "StableNormal", trust_repo=True)
normal_image = predictor(input_image, mode='stable', preprocess='crop')
normal_image.save("output/normal_map.png")

It's worth noting that the yoso-normal-v1-5 version is still unstable at present. Hence, we don't recommend using the normal output from this version for supervision. Hope this helps!

@hugoycj Thank you for your help!
I tried using the cropping mode and got better results, like this:
normal_map

However, although the output resolution is the same, it seems that only the center square region is being predicted. How can I obtain the full-resolution result?

@xingchen2022
Copy link
Author

@xingchen2022 Sorry for bothering you! I'm currently occupied with the new release version scheduled for the end of this month and don't have sufficient workload to address the issues in the current release.

The main diff between gradio and torch.hub versions is that torch.hub pads image to square before inference while gradio resizes directly, mainly a resolution difference. We avoid direct resizing as it may cause extra artifacts. For similar online demo performance, use cropping mode like this:

import torch
from PIL import Image

input_image = Image.open("path/to/your/image.jpg")
predictor = torch.hub.load("Stable-X/StableNormal", "StableNormal", trust_repo=True)
normal_image = predictor(input_image, mode='stable', preprocess='crop')
normal_image.save("output/normal_map.png")

It's worth noting that the yoso-normal-v1-5 version is still unstable at present. Hence, we don't recommend using the normal output from this version for supervision. Hope this helps!

@hugoycj Apologies for the inconvenience, but I have a few more questions I'd like to ask:

  1. When will the new stable model be released?
  2. Will the new version primarily focus on better trade-offs between speed and accuracy, and provide options for pre-masking objects/scenes, as seen in the stable_turbo demo on torch.hub?
  3. Will the new version include full pre-cropping and post-processing functionalities for locally varying resolution images, allowing the generation of high-resolution normal vector maps for any resolution? Or will users still need to manually segment the image, process it, and then stitch the results together?
    Thank you for your brilliant work, and I look forward to the release of the new model! 💗

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

2 participants