- 基础知识
参考:https://zhuanlan.zhihu.com/p/342698821
- 数据集下载
参考:https://blog.csdn.net/ASLLTQ/article/details/127573268
- 监测异常图片
| ''' |
| 此代码是查找出一个文件夹里面, |
| 所有图片读取错误,再删除 |
| ''' |
| import os |
| import shutil |
| import warnings |
| import cv2 |
| import io |
| from PIL import Image |
| warnings.filterwarnings("error", category=UserWarning) |
| base_dir = "./train/cats" |
| i = 0 |
| def is_read_successfully(file): |
| try: |
| imgFile = Image.open(file) |
| return True |
| except Exception: |
| return False |
| for parent, dirs, files in os.walk(base_dir): |
| for file in files: |
| if not is_read_successfully(os.path.join(parent, file)): |
| print(os.path.join(parent, file)) |
| |
| i = i + 1 |
| print(i) |
- 图形转换相关
| from keras.preprocessing import image |
| |
| img = image.load_img(img_path,target_size=(150,150)) |
| |
| x = image.img_to_array(img) |
| |
| x = x.reshape((1,)+x.shape) |
| |
| plt.imshow(image.array_to_img(x)) |
- module 'keras.layers.preprocessing' has no attribute 'sequence'
参考:https://blog.csdn.net/XUQIAN_LIUQIAN/article/details/129196503
- pad_sequence
参考:https://blog.csdn.net/wcy23580/article/details/84957471
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 震惊!C++程序真的从main开始吗?99%的程序员都答错了
· winform 绘制太阳,地球,月球 运作规律
· 【硬核科普】Trae如何「偷看」你的代码?零基础破解AI编程运行原理
· 上周热点回顾(3.3-3.9)
· 超详细:普通电脑也行Windows部署deepseek R1训练数据并当服务器共享给他人