Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

reshaping a image vector/matrix

#A trick when you want to flatten a matrix X of shape (a,b,c,d)... 
#...to a matrix X_flatten of shape (b ∗ c ∗ d, a) is to use:

X_flatten = X.reshape(X.shape[0], -1).T      # X.T is the transpose of X
 
PREVIOUS NEXT
Tagged: #reshaping #image
ADD COMMENT
Topic
Name
3+9 =