Skip to content
Open
Show file tree
Hide file tree
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
4 changes: 2 additions & 2 deletions download.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ wget http://www.vlfeat.org/matconvnet/models/imagenet-vgg-verydeep-19.mat -P dat
wget http://msvocds.blob.core.windows.net/coco2014/train2014.zip -P image/
wget http://msvocds.blob.core.windows.net/coco2014/val2014.zip -P image/

unzip captions_train-val2014.zip -d data/
unzip data/captions_train-val2014.zip -d data/
unzip image/train2014.zip -d image/
rm image/train2014.zip
unzip image/val2014.zip -d image/
rm image/val2014.zip
rm image/val2014.zip
3 changes: 1 addition & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,4 @@ scipy
scikit-image
hickle
Pillow


pandas
8 changes: 4 additions & 4 deletions resize.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,12 @@ def main():
num_images = len(image_files)
for i, image_file in enumerate(image_files):
with open(os.path.join(folder, image_file), 'r+b') as f:
with Image.open(f) as image:
image = resize_image(image)
image.save(os.path.join(resized_folder, image_file), image.format)
image = Image.open(f)
image = resize_image(image)
image.save(os.path.join(resized_folder, image_file), image.format)
if i % 100 == 0:
print 'Resized images: %d/%d' %(i, num_images)


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