0

I am new in python and mxnet, I want to make the example in the link:http://mxnet.io/how_to/finetune.html In the "Prepare data" part, when i run this script:

mkdir -p caltech_256_train_60
for i in 256_ObjectCategories/*; do
    c=`basename $i`
    mkdir -p caltech_256_train_60/$c
    for j in `ls $i/*.jpg | shuf | head -n 60`; do
        mv $j caltech_256_train_60/$c/
    done
done

I have the error:

"invalid syntax"

I did

os.system ('mkdir -p caltech_256_train_60')

and it worked and the directory was created.

For the rest, it does not work.

I think that this script is made for Linux and I need to ru it on windows 8 and python 2.7, someone can help me translate this code so i can run it.

il_raffa
  • 5,090
  • 129
  • 31
  • 36

1 Answers1

0

let me first paste full version of the script from the page:

wget http://www.vision.caltech.edu/Image_Datasets/Caltech256/256_ObjectCategories.tar
tar -xf 256_ObjectCategories.tar

mkdir -p caltech_256_train_60
for i in 256_ObjectCategories/*; do
    c=`basename $i`
    mkdir -p caltech_256_train_60/$c
    for j in `ls $i/*.jpg | shuf | head -n 60`; do
        mv $j caltech_256_train_60/$c/
    done
done

python ~/mxnet/tools/im2rec.py --list True --recursive True caltech-256-60-train caltech_256_train_60/
python ~/mxnet/tools/im2rec.py --list True --recursive True caltech-256-60-val 256_ObjectCategories/
python ~/mxnet/tools/im2rec.py --resize 256 --quality 90 --num-thread 16 caltech-256-60-val 256_ObjectCategories/
python ~/mxnet/tools/im2rec.py --resize 256 --quality 90 --num-thread 16 caltech-256-60-train caltech_256_train_60/

The example from the web site, indeed requires bash to be installed as well as some unix tools like:

  • wget
  • tar

there are several ways to use bash on Windows 8 machine, I would strongly recommend to use cygwin (https://cygwin.com/install.html). Cygwin comes with the package manager from the box, so during the first installation you can specify packages that you need (default packages + wget/tar if they are not installed by default).