Comments (4)
Yes, it is not easy to run the remaining operations on batches. This is also the reason why, during testing, we only process one image at a time.
from hairmapper.
Hi omermosa!
You can input a batch of latent codes to HairMapper. But there are some modifications:
In single_mapper.py, Line 40
x = bias_act.bias_act(x, b, act=self.activation,dim=2) # x = bias_act.bias_act(x, b, act=self.activation)
Line 82-91
#x = x.squeeze(0)
# Main layers.
for idx in range(self.num_layers):
layer = getattr(self, f'fc{idx}')
x = layer(x) # W
#W_latent = torch.clone(x.unsqueeze(0))
return x
then you can input a batch of latent codes to HairMapper like this:
codes = []
for code_path in code_list:
code = np.load(code_path)
codes.append(code)
codes = np.concatenate(codes, axis=0) # shape: [batch size, 18, 512]
mapper_input = codes.copy()
mapper_input_tensor = torch.from_numpy(mapper_input).cuda().float()
print('mapper_input_tensor shape: ', mapper_input_tensor.shape)
edited_latent_codes_debug = codes.copy()
mapper_out = mapper(mapper_input_tensor)
print('mapper_out shape: ', mapper_out.shape, 'alpha', alpha)
edited_latent_codes_debug[:, :8, :] += alpha * mapper_out.to('cpu').detach().numpy()
Good luck!
from hairmapper.
That is great; thank you so much!
I guess there is nothing to do to make the rest of the operations (getting hair mask and seamless clone ) run on batches right? since they involve opencv operations,
from hairmapper.
Yes, makes sense. Thank you very much!
from hairmapper.
Related Issues (20)
- Is it possible to provide online demo or obtain test results by https request? HOT 1
- more about blending the clean face with some hairstyle templates HOT 6
- How to blend other hair style? HOT 2
- About the latent space of stylegan2 and stylegan2-ada. HOT 7
- About 'keeping the rest of the layers unchanged'. HOT 3
- Bald should work on full image HOT 9
- Color cast in the result images HOT 4
- AssertionError : Stylegan_ada HOT 2
- Output Color is changed HOT 7
- Resize error for face parsing mask HOT 3
- Results on horizontal flipped images HOT 3
- id_loss is not active HOT 2
- Which model is being used to test 3D face reconstruction result HOT 2
- How to test other images? HOT 2
- Very Important Issue - Leftover hair after using align image code. How can i train even if i imcrease more croppin area till chest level so that neck, cloth, shoulder get good Reconstruction? HOT 5
- What about beard? HOT 16
- How is the file StyleGAN2-ada-Generator.pth generated? HOT 9
- About loss hair and loss face different from paper
- About video hair removing HOT 7
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from hairmapper.