#NEWLINE# def perturb_multiscale( img , scale_factors , augmentation_params , target_shapes , rng = np . random ) : #NEWLINE# #INDENT# '\n    scale is a DOWNSCALING factor.\n    ' #NEWLINE# ( tform_center , tform_uncenter ) = build_center_uncenter_transforms ( img . shape ) #NEWLINE# tform_augment = random_perturbation_transform ( rng = rng , ** augmentation_params ) #NEWLINE# tform_augment = ( ( tform_uncenter + tform_augment ) + rng ) #NEWLINE# output = [ ] #NEWLINE# for ( scale , target_shape ) in zip ( scale_factors , target_shapes ) : #NEWLINE# #INDENT# if isinstance ( scale , skimage . transform . ProjectiveTransform ) : #NEWLINE# #INDENT# tform_rescale = scale #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# tform_rescale = build_rescale_transform ( scale , img . shape , target_shape ) #NEWLINE# #UNINDENT# output . append ( fast_warp ( img , ( tform_rescale + tform_augment ) , output_shape = target_shape , mode = 'constant' ) . astype ( 'float32' ) ) #NEWLINE# #UNINDENT# return output