Skip to content

Commit

Permalink
Fix crop RoIs for 1-image datasets
Browse files Browse the repository at this point in the history
  • Loading branch information
soupault committed Aug 31, 2018
1 parent 0380cc8 commit 75af796
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions Dataset/crop_rois_your_dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import numpy as np
import argparse


if __name__ == "__main__":
parser = argparse.ArgumentParser()
parser.add_argument("--data_dir", default='../../DICOM_TEST/imgs/')
Expand All @@ -11,12 +12,15 @@
args = parser.parse_args()

os.makedirs(args.save_dir, exist_ok=True)
detections = np.loadtxt(args.detections, dtype=str)

detections = np.loadtxt(args.detections, dtype=str, ndmin=2)

for i in range(detections.shape[0]):
fname, bbox = detections[i][0], detections[i][1:].astype(int)
# read KL grades for this file somewhere
# ATTENTION: these grades are FAKE and you need to retrieve them depending on the filename
fname, bbox = detections[i][0], detections[i][1:].astype(np.int)

# ATTENTION: the KL grades specified below are FAKE and you need to
# retrieve the correct values by yourself (e.g. extract
# from the filenames or pass from metadata dataframe)

process_file(i, fname, args.data_dir, args.save_dir, bbox, 5, 5)
print(fname, bbox)

0 comments on commit 75af796

Please sign in to comment.