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

UnboundLocalError: local variable 'tri' referenced before assignment #16

Closed
zhanghm1995 opened this issue Apr 21, 2022 · 3 comments
Closed

Comments

@zhanghm1995
Copy link

zhanghm1995 commented Apr 21, 2022

Hello, thank your for sharing this amazing work.

When I run the python singleImage.py -f img command, I got the error that:

Process the image:  img/sample_1.jpg
Traceback (most recent call last):
  File "singleImage.py", line 129, in <module>
    main(args)
  File "singleImage.py", line 106, in main
    render(img_ori, vertices_lst, alpha=0.6, wfp=f'inference_output/rendering_overlay/{name}.jpg')
  File "~/SynergyNet/utils/render.py", line 42, in render
    overlap = render_app(ver, tri, overlap, texture=tex)
UnboundLocalError: local variable 'tri' referenced before assignment

I found that it is because the connectivity argument is None by default, but I don't know how to set it to a correct value.

@zhanghm1995
Copy link
Author

I solved this problem.

@cuizhanyuan
Copy link

I got the same error that.Can you tell me how to solve this problem?@zhanghm1995

@yddr
Copy link

yddr commented May 25, 2022

Modify utils/render.py file.

def render(img, ver_lst, alpha=0.6, wfp=None, tex=None, connectivity=None):
# save solid mesh rendering and alpha overlaying on images
global tri
if not connectivity is None:
tri = _to_ctype(connectivity.T).astype(np.int32)

I solved this problem using this way.

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

3 participants