Skip to content
This repository has been archived by the owner on Aug 19, 2023. It is now read-only.

Update visualize.py #77

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions visualize.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def main(args=None):
if parser.dataset == 'coco':
dataset_val = CocoDataset(parser.coco_path, set_name='val2017', transform=transforms.Compose([Normalizer(), Resizer()]))
elif parser.dataset == 'csv':
dataset_val = CSVDataset(train_file=parser.csv_train, class_list=parser.csv_classes, transform=transforms.Compose([Normalizer(), Resizer()]))
dataset_val = CSVDataset(train_file=parser.csv_val, class_list=parser.csv_classes, transform=transforms.Compose([Normalizer(), Resizer()]))
else:
raise ValueError('Dataset type not understood (must be csv or coco), exiting.')

Expand Down Expand Up @@ -67,7 +67,7 @@ def draw_caption(image, box, caption):
st = time.time()
scores, classification, transformed_anchors = retinanet(data['img'].cuda().float())
print('Elapsed time: {}'.format(time.time()-st))
idxs = np.where(scores>0.5)
idxs = np.where(scores.cpu()>0.5)
img = np.array(255 * unnormalize(data['img'][0, :, :, :])).copy()

img[img<0] = 0
Expand Down Expand Up @@ -95,4 +95,4 @@ def draw_caption(image, box, caption):


if __name__ == '__main__':
main()
main()