<jupyter_start><jupyter_text>Playing ChainerCV Reference:- https://github.com/chainer/chainercv- http://www.iconsplace.com/black-icons/letter-f-icon- https://qiita.com/mitmul/items/1e35fba085eb07a92560  import<jupyter_code>from imageio import imread, imsave
import skimage
import numpy as np
import matplotlib
from matplotlib import pyplot as plt 
%matplotlib inline
from IPython.display import Image
import chainer
from chainer.datasets import cifar
import chainercv
from chainercv import transforms<jupyter_output><empty_output><jupyter_text>check version<jupyter_code>print('chainercv',chainercv.__version__)
print('matplotlib',matplotlib.__version__)
# image 'letterF.png' is taken from http://www.iconsplace.com/black-icons/letter-f-icon
Image(filename='letterF.png')
letter = imread('letterF.png')
letter.shape<jupyter_output><empty_output><jupyter_text>Flip letter 'F'  in horizontal direction  using numpy.flipud<jupyter_code>flip_np=np.flipud(letter)
plt.imshow(flip_np)<jupyter_output><empty_output><jupyter_text>using chainercv.transforms.flip<jupyter_code>img=transforms.flip(letter, y_flip=False, x_flip=True, copy=True)
plt.imshow(img)<jupyter_output>uint8<jupyter_text>Ops... we can't see any of shape of F....   Let's examine another example<jupyter_code>train_dataset, test_dataset = cifar.get_cifar10(scale=255.)<jupyter_output><empty_output><jupyter_text>get an example<jupyter_code>example=train_dataset[0][0].astype(np.uint8)
example=example.transpose(2,1,0)<jupyter_output><empty_output><jupyter_text>show the image<jupyter_code>plt.imshow(example)<jupyter_output><empty_output><jupyter_text>using np.flipud<jupyter_code>plt.imshow(np.flipud(example))<jupyter_output><empty_output><jupyter_text>Flip the example image in horizontal direction<jupyter_code>img=transforms.flip(example, y_flip=False, x_flip=True, copy=True)
plt.imshow(img)<jupyter_output><empty_output><jupyter_text>Geez this result is not what I want  Let's read ChainerCV Readme before creating new issues the Readme.md of https://github.com/chainer/chainercv says...     Data Conventions- Image  - The order of color channel is RGB.  -  Shape is CHW (i.e. (channel, height, width)).  -  The range of values is [0, 255]. I see. We must convert an image data so that **the shape of the image is CHW**|<jupyter_code>img=transforms.flip(letter.transpose(2,1,0), y_flip=False, x_flip=True, copy=True)
print(img.dtype)
plt.imshow(img.transpose(2,1,0))<jupyter_output>uint8<jupyter_text>Yes, Got the result I wanted to see  try to apply an image of cifar10<jupyter_code>train_dataset, test_dataset = cifar.get_cifar10(scale=255.)
example=train_dataset[0][0].astype(np.uint8)
example.shape #<- the shape of example is originally CHW
img=transforms.flip(example, y_flip=False, x_flip=True, copy=True)
plt.imshow(img.transpose(2,1,0))
example=train_dataset[0][0].astype(np.uint8)
example=example.transpose(2,1,0)<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.11978097193702943, 'fraction_numerical': 0.018822724161533196, 'mean_word_length': 8.077639751552795, 'pattern_counts': {'":': 0, '<': 44, '<?xml version=': 0, '>': 43, 'https://': 3, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '11', 'dir': 'jupyter-structured-clean-dedup', 'id': '161996', 'license': 'MIT', 'n_tokens_mistral': 1123, 'n_tokens_neox': 1063, 'n_words': 196, 'path': 'deeplearning/chainercv/Playing_ChainerCV_in_advance.ipynb', 'repo_name': 'terasakisatoshi/pythonCodes', 'size': '2922'}