Skip to content

Commit

Permalink
Fix resize arg to data-manager
Browse files Browse the repository at this point in the history
  • Loading branch information
Rasmus Diederichsen committed Mar 3, 2018
1 parent 8b38f32 commit 2e23c4d
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 9 deletions.
21 changes: 15 additions & 6 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,16 +33,25 @@ def main():
help='Length of the sequences used for training the RNN.')
parser.add_argument('-r', '--use-dropout', action='store_true', default=False,
help='Use dropout (during training)')
parser.add_argument('-w', '--width', type=int, required=False, default=0,
help='Resize images to long edge')
args = parser.parse_args()
if args.use_dropout:
print('Use dropout')

dm = DataManager(
dataset_path=args.dataset,
batch_size=args.batch_size,
sequence_length=args.sequence_length,
debug=True,
resize_to_width=640)
if args.width == 0:
dm = DataManager(
dataset_path=args.dataset,
batch_size=args.batch_size,
sequence_length=args.sequence_length,
debug=True)
else:
dm = DataManager(
dataset_path=args.dataset,
batch_size=args.batch_size,
sequence_length=args.sequence_length,
debug=True,
resize_to_width=args.width)

image_shape = dm.getImageShape()

Expand Down
2 changes: 1 addition & 1 deletion preprocess_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@


def main():
parser = ArgumentParser('Preprocess robot data vor DeepVO')
parser = ArgumentParser('Preprocess robot data vor DeepVO, This process is destructive.')
parser.add_argument('-d', '--data', type=str, required=True,
help='Path to dataset (a folder with "images" and "poses" subfolders.)')
parser.add_argument('-f', '--to-float', required=False, default=False,
Expand Down
4 changes: 2 additions & 2 deletions utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -287,13 +287,13 @@ def loadImage(self, id):
def saveImage(self, id, img):
np.save(self.image_file_template % id, img)

def loadImages(self, ids, resize_imgs=True):
def loadImages(self, ids):
num_images = len(ids)
images = np.empty([num_images, self.H, self.W, self.C], dtype=self.dtype)
for i in range(0, num_images):
# right colors:
img = self.loadImage(ids[i])
if resize_imgs:
if img.shape != (self.H, self.W, self.C):
images[i] = resize(img, output_shape=(self.H, self.W))
else:
images[i] = img
Expand Down

0 comments on commit 2e23c4d

Please sign in to comment.