from matplotlib import pyplot as plt
import numpy as np
import cv2
img = imread('xxx.png') #or image_data
img2 = img[:,:,::-1]
plt.imshow(img)
normalize('ㄷ ㅓ')
-> 더
get file name and ext
get dir
change file name
check file exist
let's image
val_data.x is node features ex) 13x1000
val_data.edge_index is sparse edge index stored by torch tensor
now we want to convert it to csr_matrix
The above code is example for this case.
The print out is like this:
tensor([[ 0, 0, 0, 1, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 3, 4,
4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 7, 7, 7,
8, 8, 8, 9, 9, 9, 9, 9, 10, 10, 10, 10, 10, 11, 11, 11, 11, 11,
11, 11, 12, 12, 12, 12],
[ 1, 3, 10, 0, 2, 3, 10, 11, 1, 3, 11, 12, 0, 1, 2, 11, 12, 5,
6, 8, 9, 11, 12, 4, 6, 7, 8, 9, 4, 5, 7, 9, 10, 5, 6, 8,
4, 5, 7, 4, 5, 6, 10, 11, 0, 1, 6, 9, 11, 1, 2, 3, 4, 9,
10, 12, 2, 3, 4, 11]])
[[0. 1. 0. 1. 0. 0. 0. 0. 0. 0. 1. 0. 0.]
[1. 0. 1. 1. 0. 0. 0. 0. 0. 0. 1. 1. 0.]
[0. 1. 0. 1. 0. 0. 0. 0. 0. 0. 0. 1. 1.]
[1. 1. 1. 0. 0. 0. 0. 0. 0. 0. 0. 1. 1.]
[0. 0. 0. 0. 0. 1. 1. 0. 1. 1. 0. 1. 1.]
[0. 0. 0. 0. 1. 0. 1. 1. 1. 1. 0. 0. 0.]
[0. 0. 0. 0. 1. 1. 0. 1. 0. 1. 1. 0. 0.]
[0. 0. 0. 0. 0. 1. 1. 0. 1. 0. 0. 0. 0.]
[0. 0. 0. 0. 1. 1. 0. 1. 0. 0. 0. 0. 0.]
[0. 0. 0. 0. 1. 1. 1. 0. 0. 0. 1. 1. 0.]
[1. 1. 0. 0. 0. 0. 1. 0. 0. 1. 0. 1. 0.]
[0. 1. 1. 1. 1. 0. 0. 0. 0. 1. 1. 0. 1.]
[0. 0. 1. 1. 1. 0. 0. 0. 0. 0. 0. 1. 0.]] <class 'numpy.ndarray'> (13, 13)Thank you
Enjoy Pytorch!
type this
jupyter notebook --generate-config
run juypter again
good luck!
github : https://github.com/aleju/imgaug