Example #1
0
def download_cifar10():
    data_dir="data"
    fnames = (os.path.join(data_dir, "cifar10_train.rec"),
              os.path.join(data_dir, "cifar10_val.rec"))
    download_file('http://data.mxnet.io/data/cifar10/cifar10_val.rec', fnames[1])
    download_file('http://data.mxnet.io/data/cifar10/cifar10_train.rec', fnames[0])
    return fnames
Example #2
0
def download_cifar10():
    data_dir="data"
    fnames = (os.path.join(data_dir, "cifar10_train.rec"),
              os.path.join(data_dir, "cifar10_val.rec"))
    download_file('http://data.mxnet.io/data/cifar10/cifar10_val.rec', fnames[1])
    download_file('http://data.mxnet.io/data/cifar10/cifar10_train.rec', fnames[0])
    return fnames
Example #3
0
def download_cifar10():
    data_dir = "/home/limin/Repo/BMXNet/data"
    fnames = (os.path.join(data_dir, "cifar10_train.rec"),
              os.path.join(data_dir, "cifar10_val.rec"))
    if not os.path.exists(fnames[1]):
        download_file('http://data.mxnet.io/data/cifar10/cifar10_val.rec',
                      fnames[1])
    if not os.path.exists(fnames[0]):
        download_file('http://data.mxnet.io/data/cifar10/cifar10_train.rec',
                      fnames[0])
    return fnames
Example #4
0
def read_data(label, image):
    """
    download and read data into numpy
    """
    base_url = 'http://yann.lecun.com/exdb/mnist/'
    with gzip.open(download_file(base_url+label, os.path.join('data',label))) as flbl:
        magic, num = struct.unpack(">II", flbl.read(8))
        label = np.fromstring(flbl.read(), dtype=np.int8)
    with gzip.open(download_file(base_url+image, os.path.join('data',image)), 'rb') as fimg:
        magic, num, rows, cols = struct.unpack(">IIII", fimg.read(16))
        image = np.fromstring(fimg.read(), dtype=np.uint8).reshape(len(label), rows, cols)
    return (label, image)
Example #5
0
def download_model(model_name, dst_dir='./', meta_info=None):
    if meta_info is None:
        meta_info = _default_model_info
    meta_info = dict(meta_info)
    if model_name not in meta_info:
        return (None, 0)
    if not os.path.isdir(dst_dir):
        os.mkdir(dst_dir)
    meta = dict(meta_info[model_name])
    assert 'symbol' in meta, "missing symbol url"
    model_name = os.path.join(dst_dir, model_name)
    download_file(meta['symbol'], model_name + '-symbol.json')
    assert 'params' in meta, "mssing parameter file url"
    download_file(meta['params'], model_name + '-0000.params')
def download_upzip_data(label, image, ulabel, uimage):
    """
    download and read data into numpy
    """
    ufl = os.path.join('data',ulabel)
    ufi = os.path.join('data',uimage)
    base_url = 'http://yann.lecun.com/exdb/mnist/'
    flbl = gzip.open(download_file(base_url+label, os.path.join('data',label)))
    fimg = gzip.open(download_file(base_url+image, os.path.join('data',image)), 'rb')
    ulabel_out = open(ufl, 'wb')
    ulabel_out.write(flbl.read())
    ulabel_out.close()
    flbl.close()

    uimage_out = open(ufi, 'wb')
    uimage_out.write(fimg.read())
    uimage_out.close()
    fimg.close()
    return (ufl, ufi)
def download_upzip_data(label, image, ulabel, uimage):
    """
    download and read data into numpy
    """
    ufl = os.path.join('data', ulabel)
    ufi = os.path.join('data', uimage)
    base_url = 'http://yann.lecun.com/exdb/mnist/'
    flbl = gzip.open(
        download_file(base_url + label, os.path.join('data', label)))
    fimg = gzip.open(
        download_file(base_url + image, os.path.join('data', image)), 'rb')
    ulabel_out = open(ufl, 'wb')
    ulabel_out.write(flbl.read())
    ulabel_out.close()
    flbl.close()

    uimage_out = open(ufi, 'wb')
    uimage_out.write(fimg.read())
    uimage_out.close()
    fimg.close()
    return (ufl, ufi)
Example #8
0
def download_data():
    download_file('http://data.mxnet.io/data/val-5k-256.rec', 'data/val-5k-256.rec')
Example #9
0
def download_data():
    download_file('http://data.mxnet.io/data/val-5k-256.rec', 'data/val-5k-256.rec')
Example #10
0
def download_data():
    download_file("http://data.mxnet.io/data/val-5k-256.rec", "data/val-5k-256.rec")
Example #11
0
def download_data():
    if not os.path.isdir('data'):
        os.mkdir('data')
    return download_file('http://data.mxnet.io/data/val-5k-256.rec',
                         'data/val-5k-256.rec')