add train function as port of train_imagenet.sh

Use full paths for filenames, or fix how relative paths
work. Eventually this should move out of preprocessing. Currently
train fails with a leveldb LOCK error.