-
Notifications
You must be signed in to change notification settings - Fork 6.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
1. Added one_direction_test_model that generates the outputs in only …
…one direction 2. Changed the option naming from ntrain to max_dataset_size
- Loading branch information
Taesung Park
committed
Apr 27, 2017
1 parent
af7420f
commit e5b2fd6
Showing
7 changed files
with
71 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
from torch.autograd import Variable | ||
from collections import OrderedDict | ||
import util.util as util | ||
from .base_model import BaseModel | ||
from . import networks | ||
|
||
|
||
class OneDirectionTestModel(BaseModel): | ||
def name(self): | ||
return 'OneDirectionTestModel' | ||
|
||
def initialize(self, opt): | ||
BaseModel.initialize(self, opt) | ||
|
||
nb = opt.batchSize | ||
size = opt.fineSize | ||
self.input_A = self.Tensor(nb, opt.input_nc, size, size) | ||
|
||
assert(not self.isTrain) | ||
self.netG_A = networks.define_G(opt.input_nc, opt.output_nc, | ||
opt.ngf, opt.which_model_netG, | ||
opt.norm, opt.use_dropout, | ||
self.gpu_ids) | ||
which_epoch = opt.which_epoch | ||
AtoB = self.opt.which_direction == 'AtoB' | ||
which_network = 'G_A' if AtoB else 'G_B' | ||
self.load_network(self.netG_A, which_network, which_epoch) | ||
|
||
print('---------- Networks initialized -------------') | ||
networks.print_network(self.netG_A) | ||
print('-----------------------------------------------') | ||
|
||
def set_input(self, input): | ||
AtoB = self.opt.which_direction == 'AtoB' | ||
input_A = input['A' if AtoB else 'B'] | ||
self.input_A.resize_(input_A.size()).copy_(input_A) | ||
self.image_paths = input['A_paths' if AtoB else 'B_paths'] | ||
|
||
def test(self): | ||
self.real_A = Variable(self.input_A) | ||
self.fake_B = self.netG_A.forward(self.real_A) | ||
|
||
#get image paths | ||
def get_image_paths(self): | ||
return self.image_paths | ||
|
||
def get_current_visuals(self): | ||
real_A = util.tensor2im(self.real_A.data) | ||
fake_B = util.tensor2im(self.fake_B.data) | ||
return OrderedDict([('real_A', real_A), ('fake_B', fake_B)]) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters