Skip to content

Commit

Permalink
Code Using RecIO (zhanghang1989#30)
Browse files Browse the repository at this point in the history
  • Loading branch information
zhanghang1989 committed Apr 23, 2020
1 parent d3c6f31 commit 8d1b2a8
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 20 deletions.
18 changes: 7 additions & 11 deletions .github/workflows/unit_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,27 +12,23 @@ on:
jobs:
build:

runs-on: ubuntu-latest
runs-on: self-hosted

steps:
- uses: actions/checkout@v2
- uses: seanmiddleditch/gha-setup-ninja@master

- name: Set up Python
uses: actions/setup-python@v1
uses: actions/github-script@0.3.0
with:
python-version: 3.7
github-token: ${{github.token}}
script: |
const core = require('@actions/core')
core.exportVariable("PATH", "/home/ubuntu/anaconda3/bin:/usr/local/bin:/usr/bin/:/bin:$PATH")
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install numpy -I
pip install pytest torch
pip install nose
- name: Install package
run: |
python -m pip install --upgrade pip
pip install nose
pip install -e .
- name: Run pytest
Expand Down
Binary file added miscs/abstract.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
13 changes: 4 additions & 9 deletions scripts/gluon/verify.py
Original file line number Diff line number Diff line change
Expand Up @@ -175,22 +175,17 @@ def __call__(self, img):
val_data = gluon.data.DataLoader(
imagenet.classification.ImageNet(opt.data_dir, train=False).transform_first(transform_test),
batch_size=batch_size, shuffle=False, num_workers=num_workers)
def batch_fn(batch, ctx):
data = gluon.utils.split_and_load(batch[0], ctx_list=ctx, batch_axis=0)
label = gluon.utils.split_and_load(batch[1], ctx_list=ctx, batch_axis=0)
return data, label
else:
imgrec = os.path.join(opt.rec_dir, 'val.rec')
imgidx = os.path.join(opt.rec_dir, 'val.idx')
val_data = gluon.data.DataLoader(
mx.gluon.data.vision.ImageRecordDataset(imgrec).transform_first(transform_test),
batch_size=batch_size, shuffle=False, num_workers=num_workers)

def batch_fn(batch, ctx):
data = gluon.utils.split_and_load(batch.data[0], ctx_list=ctx, batch_axis=0)
label = gluon.utils.split_and_load(batch.label[0], ctx_list=ctx, batch_axis=0)
return data, label

def batch_fn(batch, ctx):
data = gluon.utils.split_and_load(batch[0], ctx_list=ctx, batch_axis=0)
label = gluon.utils.split_and_load(batch[1], ctx_list=ctx, batch_axis=0)
return data, label

err_top1_val, err_top5_val = test(net, ctx, val_data, batch_fn)
print(err_top1_val, err_top5_val)

0 comments on commit 8d1b2a8

Please sign in to comment.