Skip to content
This repository has been archived by the owner on Nov 17, 2023. It is now read-only.

Commit

Permalink
Fix urllib bug affecting Python 3.x in the finetune tutorial (#8229)
Browse files Browse the repository at this point in the history
* changed url references from dmlc to apache/incubator-mxnet

* added python 3 support for dataset download with urllib

* added python 3 support for dataset download with urllib

* removed unintended edits
  • Loading branch information
aaronmarkham authored and piiswrong committed Oct 30, 2017
1 parent a6fa7b4 commit 100eb88
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions docs/faq/finetune.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@

# Fine-tune with Pretrained Models

Many of the exciting deep learning algorithms for computer vision require
Expand Down Expand Up @@ -68,12 +69,19 @@ python ~/mxnet/tools/im2rec.py --resize 256 --quality 90 --num-thread 16 caltech

The following code downloads the pregenerated rec files. It may take a few minutes.


```python
import os, urllib
import os, sys

if sys.version_info[0] >= 3:
from urllib.request import urlretrieve
else:
from urllib import urlretrieve

def download(url):
filename = url.split("/")[-1]
if not os.path.exists(filename):
urllib.urlretrieve(url, filename)
urlretrieve(url, filename)
download('http://data.mxnet.io/data/caltech-256/caltech-256-60-train.rec')
download('http://data.mxnet.io/data/caltech-256/caltech-256-60-val.rec')
```
Expand Down

0 comments on commit 100eb88

Please sign in to comment.