Comments (1)
Here are the forward and test functions for the unified implementation of ResViT. The dataset format you want to use is the same as the many-to-one case.
def forward(self):
self.input_A[:, 2] = self.input_B[0]
self.input_B = torch.clone(self.input_A)
self.channel_no = np.random.randint(low=0, high=3)
self.input_A[:, self.channel_no] = -1
self.real_A = Variable(self.input_A)
self.fake_B = self.netG(self.real_A)
self.fake_B_adversarial = torch.clone(self.fake_B)
self.real_B = Variable(self.input_B)
for i in range(3):
if not i == self.channel_no:
self.fake_B_adversarial[:, i] = self.real_B[:, i]
# no backprop gradients
def test(self):
with torch.no_grad():
self.real_B3 = Variable(self.input_B[:,0])
self.input_A[:, 2] = self.input_B[0]
self.input_B = torch.clone(self.input_A)
self.real_A = Variable(self.input_A)
self.real_B1 = Variable(self.input_A[:,0])
self.real_B2 = Variable(self.input_A[:,1])
# many to T1
real_A_1 = torch.clone(self.real_A)
real_A_1[:,0] = -1
fake_B_1 = self.netG(real_A_1)
self.fake_B_1 = fake_B_1[:,0]
# many to T2
real_A_2 = torch.clone(self.real_A)
real_A_2[:, 1] = -1
fake_B_2 = self.netG(real_A_2)
self.fake_B_2 = fake_B_2[:, 1]
# many to PD
real_A_3 = torch.clone(self.real_A)
real_A_3[:, 2] = -1
fake_B_3 = self.netG(real_A_3)
self.fake_B_3 = fake_B_3[:, 2]
from resvit.
Related Issues (20)
- Plz explain on many to one case synthesis .How data should be organized HOT 1
- datasets HOT 1
- OSError: Failed to interpret file './model/vit_checkpoint/imagenet21k/R50+ViT-B_16.npz' as a pickle HOT 1
- Download pre-trained ViT models from Google Problem HOT 1
- Pixel-wise consistency loss between acquired and reconstructed source modalities based on an L1 distance HOT 2
- Datasets used in this paper HOT 1
- How to generate attention maps by ResViT? HOT 1
- Additional dependencies and deprecated functions HOT 1
- Pretrained models for the paper
- Data pre-processing HOT 1
- Encountering Runtime Errors with Color Image-to-Image Translation with Custom Channel Configuration
- integer division or modulo by zero HOT 1
- Hello,I have a question HOT 7
- Hello,I have a question HOT 3
- Data preprocessing HOT 1
- hi professor,I have a question about data size HOT 4
- A question about visdom in this code HOT 3
- Transformer_Discriminator HOT 1
- L1 Loss-term weights HOT 1
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 resvit.