commit c8e3010d4b6ea00d088498918b58fd77e3187acf
parent f46c2664a61aa01f06b80ac1bb098f41c0aea35b
Author: Marcel <MTRNord@users.noreply.github.com>
Date: Wed, 5 Oct 2016 22:06:46 +0200
Update download-image-by-link.py
Diffstat:
1 file changed, 1 insertion(+), 22 deletions(-)
diff --git a/scripts/download-image-by-link.py b/scripts/download-image-by-link.py
@@ -7,7 +7,7 @@ import numpy as np
import os
def store_raw_images():
- neg_images_link = '//image-net.org/api/text/imagenet.synset.geturls?wnid=n04096066'
+ neg_images_link = '//image-net.org/api/text/imagenet.synset.geturls?wnid=n07942152'
neg_image_urls = urllib.request.urlopen(neg_images_link).read().decode()
pic_num = 1
@@ -42,27 +42,6 @@ def find_uglies():
os.remove(current_image_path)
except Exception as e:
print(str(e))
-
-def store_raw_images():
- neg_images_link = '//image-net.org/api/text/imagenet.synset.geturls?wnid=n07942152'
- neg_image_urls = urllib.request.urlopen(neg_images_link).read().decode()
- pic_num = 953
-
- if not os.path.exists('neg'):
- os.makedirs('neg')
-
- for i in neg_image_urls.split('\n'):
- try:
- print(i)
- urllib.request.urlretrieve(i, "neg/"+str(pic_num)+".jpg")
- img = cv2.imread("neg/"+str(pic_num)+".jpg",cv2.IMREAD_GRAYSCALE)
- # should be larger than samples / pos pic (so we can place our image on it)
- resized_image = cv2.resize(img, (100, 100))
- cv2.imwrite("neg/"+str(pic_num)+".jpg",resized_image)
- pic_num += 1
-
- except Exception as e:
- print(str(e))
def create_pos_n_neg():
for file_type in ['neg']: