引言:在訓練網路中時常需要將影像格式進行轉化,很麻煩,今天記錄一下,下面一起來看看吧!!!
1.將numpy----》tensor
廢話少說,直接開干!
代碼:
import cv2 import torch import numpy as np path=r'./cat.jpg' img=cv2.imread(path) print(img.shape) img1 = torch.from_numpy(img1) print(img1.shape)#待續,,,
#
2.結束:
GAME OVER
如果理解錯誤,歡迎大家批評,及時糾正小瓊的錯誤哦,真心感謝你的糾正!!!
如果小伙伴夢有疑問歡迎在評論區留言哦!!!
如果感覺不錯的話!點個贊唄,不用客氣!(O(∩_∩)O哈哈~)
歡迎和小伙伴夢一起學習,共同努力,加油!!!
轉載請註明出處,本文鏈接:https://www.uj5u.com/qita/337837.html
標籤:其他
