今天在制作自己训练集合并且训练的时候,碰见了如下的错:

image_size must contain 3 elements[4]

这是因为训练的数据集中不是所有的图片位深都是三通道的。

写一个脚本查看所有的数据集中所有的数据,列举出不是RGB的图片:

from PIL import Image
import os
path = '/home/seven/cy_folder/data/plane/' #图片目录
for file in os.listdir(path):
extension = file.split('.')[-1]
if extension == 'jpg':
fileLoc = path+file
img = Image.open(fileLoc)
if img.mode != 'RGB':
print(file+', '+img.mode)

然后删除这些图片,可以重新找一些图片添加到训练集中。

这里需要特别注意的一点是不是所有的.jpg文件都是三通道的。

image_size must contain 3 elements[4]的更多相关文章

  1. js Form.elements[i]的使用实例

    function pdf(){    //一个html里面可能存在多个form,所以document.form[0]指的是第一个form,document.form[1]返回就是第二个form,如果没 ...

  2. View and Data API Tips: Hide elements in viewer completely

    By Daniel Du With View and Data API, you can hide some elements in viewer by calling "viewer.hi ...

  3. [LeetCode] Minimum Moves to Equal Array Elements II 最少移动次数使数组元素相等之二

    Given a non-empty integer array, find the minimum number of moves required to make all array element ...

  4. [LeetCode] Minimum Moves to Equal Array Elements 最少移动次数使数组元素相等

    Given a non-empty integer array of size n, find the minimum number of moves required to make all arr ...

  5. [LeetCode] Top K Frequent Elements 前K个高频元素

    Given a non-empty array of integers, return the k most frequent elements. For example,Given [1,1,1,2 ...

  6. [LeetCode] Remove Linked List Elements 移除链表元素

    Remove all elements from a linked list of integers that have value val. Example Given: 1 --> 2 -- ...

  7. Chrome 开发工具之Elements

    友情提示:全文图片高能,如使用手机阅读,请确保在wifi情况下或者流量充足.图片有点渣,也算辛苦做出来的,请别嫌弃- Elements面板主要展示当前页面的组织结构,在如今的应用程序中,HTML页面初 ...

  8. T-SQL Recipes之Separating elements

    Separating elements Separating elements is a classic T-SQL challenge. It involves a table called Arr ...

  9. POJ2167Irrelevant Elements[唯一分解定理 组合数 杨辉三角]

    Irrelevant Elements Time Limit: 5000MS   Memory Limit: 65536K Total Submissions: 2407   Accepted: 59 ...

随机推荐

  1. system存储说明和制作os模板时的注意事项

    1.通过ISO制作模板时,安装机器后,使用非持久化磁盘安装后,无法从硬盘引导:使用持久化磁盘可以.2.system 存储,当opennebula 初次部署时,会生成0(system),1(image) ...

  2. eclipse添加web项目报错“Target runtime Apache Tomcat v7.0 is not defined.”

    项目检出后,发现是Tomcat7 发布的,修改文件: 工作空间--->项目名称--->.settings--->org.eclipse.wst.common.project.face ...

  3. 洛谷 P3659 [USACO17FEB]Why Did the Cow Cross the Road I G

    //神题目(题目一开始就理解错了)... 题目描述 Why did the cow cross the road? Well, one reason is that Farmer John's far ...

  4. Spring查询方法的注入 为查询的方法注入某个实例

    //这里是客户端的代码 当调用CreatePersonDao这个抽象方法或者虚方法的时候由配置文件返回指定的实例 为查询的方法注入某个实例 start static void Main(string[ ...

  5. bootstrap导入JavaScript插件

    Bootstrap的JavaScript插件可以单独导入到页面中,也可以一次性导入到页面中.因为在Bootstrap中的JavaScript插件都是依赖于jQuery库,所以不论是单独导入还一次性导入 ...

  6. [GO]channel实现同步

    goroutine运行在相同的地址空间,因此访问共享内存必须 做好同步.goroutine奉行通过通信来共享内存,而不是共享内存通信 它跟map一样,使用make来创建,它是一个引用 ,而不是值传递 ...

  7. Python3+Apache+Django+CentOS

    使用django开发的项目上到正式环境的环境搭建,系统软件版本: CentOS6. setuptools-.tar.gz pip-.tar.gz Python-.tgz pcre-8.39.tar.b ...

  8. javascript总结系列49:javaScript教程:原型链不可变

    <!DOCTYPE html> <html lang="zh-CN"> <head> <meta charset="UTF-8& ...

  9. spring mvc 入门程序

    入门程序 1.环境准备 myeclipse Spring jar 2.前端控制器设置 (web.xml) 所有的*.action请求通过org.springframework.web.servlet. ...

  10. 解决NIOS II工程移动在磁盘上位置后project无法编译问题

    说明:本文档于2017年3月4日由小梅哥更新部分内容,主要是增加了讲解以Quartus II13.0为代表的经典版本和以15.1为代表的更新版本之间,解决问题的一些小的差异. 如果用户只是想快速解决问 ...