Training the network with images