fad73753f836de5cdd08d8e23d26c1170d19b386,src/dataset_unpair.py,dataset_unpair,__getitem__,#dataset_unpair#,21
Before Change
def __getitem__(self, index):
crop_img = self.load_img(self.images[index], flip=self.flip, random_crop=True)
raw_data = crop_img.transpose((2, 0, 1))
data = ((torch.FloatTensor(raw_data) / 255.0) - 0.5) * 2
return data
def load_img(self, img_name, flip=False, random_crop=False):
if self.input_dim == 3:
img = cv2.cvtColor(cv2.imread(img_name), cv2.COLOR_BGR2RGB)
After Change
def __getitem__(self, index):
if self.dataset_size == self.A_size:
data_A = self.load_img(self.A[index], self.input_dim_A)
data_B = self.load_img(self.B[random.randint(0, self.B_size - 1)], self.input_dim_B)
else:
data_A = self.load_img(self.A[random.randint(0, self.A_size - 1)], self.input_dim_A)
data_B = self.load_img(self.B[index], self.input_dim_B)
return data_A, data_B
def load_img(self, img_name, input_dim):
img = Image.open(img_name).convert("RGB")
img = self.transforms(img)
In pattern: SUPERPATTERN
Frequency: 3
Non-data size: 5
Instances
Project Name: HsinYingLee/DRIT
Commit Name: fad73753f836de5cdd08d8e23d26c1170d19b386
Time: 2018-04-09
Author: hytseng0509@gmail.com
File Name: src/dataset_unpair.py
Class Name: dataset_unpair
Method Name: __getitem__
Project Name: danforthcenter/plantcv
Commit Name: ee7dc09812df5dded34adcde4267d9c754e3b655
Time: 2019-09-11
Author: haleyschuhl@gmail.com
File Name: plantcv/plantcv/hyperspectral/read_data.py
Class Name:
Method Name: read_data
Project Name: explosion/thinc
Commit Name: f2fc17c740d609e7fd9118093f7fad7824d3415e
Time: 2019-06-03
Author: daras.giannhs@gmail.com
File Name: thinc/neural/_classes/multiheaded_attention.py
Class Name: MultiHeadedAttention
Method Name: _scaled_dot_prod