MCPcopy Create free account
hub / github.com/drinkingcoder/FlowFormer-Official / __call__

Method __call__

core/utils/augmentor.py:119–145  ·  view source on GitHub ↗
(self, img1, img2, flow)

Source from the content-addressed store, hash-verified

117 return img1, img2, flow
118
119 def __call__(self, img1, img2, flow):
120 img1, img2 = self.color_transform(img1, img2)
121 img1, img2 = self.eraser_transform(img1, img2)
122 if self.pwc_aug:
123 th, tw = self.crop_size
124 schedule = [0.5, 1.] # initial coeff, final_coeff, half life
125 difficulty = np.random.uniform(0, 1)
126 schedule_coeff = schedule[0] + (schedule[1] - schedule[0]) * \
127 (2/(1+np.exp(-1.0986*difficulty)) - 1)
128 spatial_augmentor = flow_transforms.SpatialAug([th,tw],scale=[0.4,0.03,0.2],
129 rot=[0.4,0.03],
130 trans=[0.4,0.03],
131 squeeze=[0.3,0.], schedule_coeff=schedule_coeff, order=1, black=False)
132 flow = np.concatenate([flow, np.ones((flow.shape[0], flow.shape[1], 1))], axis=-1)
133 augmented, flow_valid = spatial_augmentor([img1, img2], flow)
134 flow = flow_valid[:,:,:2]
135 img1 = augmented[0]
136 img2 = augmented[1]
137
138 else:
139 img1, img2, flow = self.spatial_transform(img1, img2, flow)
140
141 img1 = np.ascontiguousarray(img1)
142 img2 = np.ascontiguousarray(img2)
143 flow = np.ascontiguousarray(flow)
144
145 return img1, img2, flow
146
147class SparseFlowAugmentor:
148 def __init__(self, crop_size, min_scale=-0.2, max_scale=0.5, do_flip=False):

Callers

nothing calls this directly

Calls 3

color_transformMethod · 0.95
eraser_transformMethod · 0.95
spatial_transformMethod · 0.95

Tested by

no test coverage detected