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

how to adjust selection #300

Open
schwarzwals opened this issue Apr 4, 2022 · 3 comments
Open

how to adjust selection #300

schwarzwals opened this issue Apr 4, 2022 · 3 comments

Comments

@schwarzwals
Copy link

schwarzwals commented Apr 4, 2022

first of all, you guys did an amazing job ! i'm shocked about the accuracy of this U2NET !
I would like to know if i can adjust the selection or somehow fine tune it so it doesn't bite into the person in my situation(see the picture attached)
Screen Shot 2022-04-04 at 22 48 50

`
# processing
image = transform.resize(img, (320, 320), mode='constant')

tmpImg = np.zeros((image.shape[0], image.shape[1], 3))

tmpImg[:, :, 0] = (image[:, :, 0]-0.485)/0.229
tmpImg[:, :, 1] = (image[:, :, 1]-0.456)/0.224
tmpImg[:, :, 2] = (image[:, :, 2]-0.406)/0.225

tmpImg = tmpImg.transpose((2, 0, 1))
tmpImg = np.expand_dims(tmpImg, 0)
image = torch.from_numpy(tmpImg)

image = image.type(torch.FloatTensor)
image = Variable(image)

d1, d2, d3, d4, d5, d6, d7 = net(image)
pred = d1[:, 0, :, :]
ma = torch.max(pred)
mi = torch.min(pred)
dn = (pred-mi)/(ma-mi)
pred = dn`
@xuebinqin
Copy link
Owner

xuebinqin commented Apr 4, 2022 via email

@schwarzwals
Copy link
Author

so there's no way to leave more space around the person ? we talk about few pixels...
also...if I need to generate only a mask...would that speed up the process ? and how am I doing ? a short example would help.
Thank you very much again !

@xuebinqin
Copy link
Owner

xuebinqin commented Apr 6, 2022 via email

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