写在前面:1、此篇博客如遇问题,可看之前的解决。2、如需数据集可自取
链接:https
这里写目录标题
一、常用类介绍
1. Compose()
其实就是将几个transforms()组合起来使用。
- 相关代码解释 打开左侧structure
1)call (相关代码在addition_d4_Call.py中) ```def __call__(self, name): print("__call__" + "Hello" + name) def hello(self, name): print("hello" + name) person = Person() person("张三") #>>输出:__call__Hello张三 person.hello("李四") #>>输出:hello李四 ```
结果
2. ToTensor()
将PIL Image和ndarray格式转换成tensor
可视结果:
代码在最后