Skip to content

Commit

Permalink
rngdet
Browse files Browse the repository at this point in the history
  • Loading branch information
mjyun01 committed Feb 12, 2024
1 parent 1e64358 commit 80d557b
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 22 deletions.
21 changes: 0 additions & 21 deletions official/projects/rngdet/tasks/rngdet.py
Original file line number Diff line number Diff line change
Expand Up @@ -364,34 +364,13 @@ def validation_step(self, inputs, model, metrics=None):
"""
features, labels = inputs

#======= visualize rotation for training images
# before rotation
roi_size =128
sat_roi = features['sat_roi']
historical_roi = features['historical_roi']
label_masks_roi = labels['label_masks_roi']
gt_coords = labels['gt_coords']
gt_masks = labels['gt_masks']

#make image
dst = Image.new('RGB',(roi_size*2+5,roi_size*2+5))
sat_ROI_tmp = sat_roi[0]*255
history_tmp = historical_roi[0, :, :, 0]*255
label_mask_tmp = label_masks_roi[0, :, :, 0]*255
gt_mask_tmp = gt_masks[0, :, :, 0]*255

sat = Image.fromarray(sat_ROI_tmp.numpy().astype(np.uint8)) #input
history = Image.fromarray(history_tmp.numpy().astype(np.uint8)) #input
label_mask = Image.fromarray(label_mask_tmp.numpy().astype(np.uint8)) #output
gt_mask = Image.fromarray(gt_mask_tmp.numpy().astype(np.uint8)) #output

dst.paste(sat,(0,0)) #original image
dst.paste(history,(0,roi_size))
dst.paste(label_mask,(roi_size,0))
dst.paste(gt_mask,(roi_size,roi_size))
draw = ImageDraw.Draw(dst)
dst.convert('RGB').save(f'./check_rot_before.png')

rot_index = np.random.randint(0, 4)
cos_theta = 0 if ( rot_index%2==1 ) else (1 if (rot_index==0) else -1)
sin_theta = 0 if ( rot_index%2==0 ) else (1 if (rot_index==1) else -1)
Expand Down
2 changes: 1 addition & 1 deletion official/projects/rngdet/tasks/rngdet_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
import pdb;
_NUM_EXAMPLES = 10

CITYSCALE_INPUT_PATH_BASE = 'FIX_ME'
CITYSCALE_INPUT_PATH_BASE = 'TF_RECORD_PATH'

def _gen_fn():
h = 128
Expand Down

0 comments on commit 80d557b

Please sign in to comment.