Commit ad4c142b by Alexander Pivovarov Committed by Tianqi Chen

Change cat image extension to png to match its download URL (#1800)

parent 31bb62bc
...@@ -179,6 +179,7 @@ perf ...@@ -179,6 +179,7 @@ perf
*.h5 *.h5
synset.txt synset.txt
cat.jpg cat.jpg
cat.png
docs.tgz docs.tgz
cat.png cat.png
*.mlmodel *.mlmodel
......
...@@ -25,7 +25,7 @@ def get_resnet50(): ...@@ -25,7 +25,7 @@ def get_resnet50():
def get_cat_image(): def get_cat_image():
url = 'https://gist.githubusercontent.com/zhreshold/bcda4716699ac97ea44f791c24310193/raw/fa7ef0e9c9a5daea686d6473a62aacd1a5885849/cat.png' url = 'https://gist.githubusercontent.com/zhreshold/bcda4716699ac97ea44f791c24310193/raw/fa7ef0e9c9a5daea686d6473a62aacd1a5885849/cat.png'
dst = 'cat.jpg' dst = 'cat.png'
real_dst = os.path.abspath(os.path.join(os.path.dirname(__file__), dst)) real_dst = os.path.abspath(os.path.join(os.path.dirname(__file__), dst))
download(url, real_dst) download(url, real_dst)
img = Image.open(real_dst).resize((224, 224)) img = Image.open(real_dst).resize((224, 224))
......
...@@ -91,7 +91,7 @@ block = get_model('resnet18_v1', pretrained=True) ...@@ -91,7 +91,7 @@ block = get_model('resnet18_v1', pretrained=True)
###################################################################### ######################################################################
# In order to test our model, here we download an image of cat and # In order to test our model, here we download an image of cat and
# transform its format. # transform its format.
img_name = 'cat.jpg' img_name = 'cat.png'
download('https://github.com/dmlc/mxnet.js/blob/master/data/cat.png?raw=true', img_name) download('https://github.com/dmlc/mxnet.js/blob/master/data/cat.png?raw=true', img_name)
image = Image.open(img_name).resize((224, 224)) image = Image.open(img_name).resize((224, 224))
......
...@@ -88,7 +88,7 @@ block = get_model('resnet18_v1', pretrained=True) ...@@ -88,7 +88,7 @@ block = get_model('resnet18_v1', pretrained=True)
###################################################################### ######################################################################
# In order to test our model, here we download an image of cat and # In order to test our model, here we download an image of cat and
# transform its format. # transform its format.
img_name = 'cat.jpg' img_name = 'cat.png'
download('https://github.com/dmlc/mxnet.js/blob/master/data/cat.png?raw=true', img_name) download('https://github.com/dmlc/mxnet.js/blob/master/data/cat.png?raw=true', img_name)
image = Image.open(img_name).resize((224, 224)) image = Image.open(img_name).resize((224, 224))
......
...@@ -56,8 +56,8 @@ from PIL import Image ...@@ -56,8 +56,8 @@ from PIL import Image
from matplotlib import pyplot as plt from matplotlib import pyplot as plt
from keras.applications.resnet50 import preprocess_input from keras.applications.resnet50 import preprocess_input
img_url = 'https://github.com/dmlc/mxnet.js/blob/master/data/cat.png?raw=true' img_url = 'https://github.com/dmlc/mxnet.js/blob/master/data/cat.png?raw=true'
download(img_url, 'cat.jpg') download(img_url, 'cat.png')
img = Image.open('cat.jpg').resize((224, 224)) img = Image.open('cat.png').resize((224, 224))
plt.imshow(img) plt.imshow(img)
plt.show() plt.show()
# input preprocess # input preprocess
......
...@@ -33,7 +33,7 @@ from mxnet.gluon.utils import download ...@@ -33,7 +33,7 @@ from mxnet.gluon.utils import download
from PIL import Image from PIL import Image
from matplotlib import pyplot as plt from matplotlib import pyplot as plt
block = get_model('resnet18_v1', pretrained=True) block = get_model('resnet18_v1', pretrained=True)
img_name = 'cat.jpg' img_name = 'cat.png'
synset_url = ''.join(['https://gist.githubusercontent.com/zhreshold/', synset_url = ''.join(['https://gist.githubusercontent.com/zhreshold/',
'4d0b62f3d01426887599d4f7ede23ee5/raw/', '4d0b62f3d01426887599d4f7ede23ee5/raw/',
'596b27d23537e5a1b5751d2b0481ef172f58b539/', '596b27d23537e5a1b5751d2b0481ef172f58b539/',
......
...@@ -148,7 +148,7 @@ def download_image(): ...@@ -148,7 +148,7 @@ def download_image():
from PIL import Image from PIL import Image
url = "https://github.com/dmlc/mxnet.js/blob/master/data/cat.png?raw=true" url = "https://github.com/dmlc/mxnet.js/blob/master/data/cat.png?raw=true"
img_name = "cat.jpg" img_name = "cat.png"
gluon.utils.download(url, img_name) gluon.utils.download(url, img_name)
image = Image.open(img_name).resize((224, 224)) image = Image.open(img_name).resize((224, 224))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment