Learning pytorch: trying to train a very simple classifier.
Download a few hundred of images of llamas and kiwis from google, store them in a folder called dataset/kiwis and dataset/llamas respectively. In a terminal, run:
find dataset/ -type f | grep ".jpg" >> all_imas.txt
Then in python run:
import numpy as np
data = [d.replace('\n', '') for d in open('all_imas.txt').readlines()]
perm = np.random.permutation(len(data))
train = np.array(finalfiles)[perm[:int(0.9*len(finalfiles))]]
val = np.array(finalfiles)[perm[int(0.9*len(finalfiles)):]]
ff = open('train.txt', 'w')
for fin in train:
ff.write("%s\n" % fin)
ff.close()
ff = open('val.txt', 'w')
for fin in val:
ff.write("%s\n" % fin)
ff.close()
Run main.py in python.
Run tensorboard --logdir runs
in a terminal and open in a browser the specified address.