Automatic detection of canonical image orientation by convolutional neural networks