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

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. 面向对象JS基础

    什么是面向对象?面向对象是一种思想!(废话). 面向对象可以把程序中的关键模块都视为对象,而模块拥有属性及方法.这样我们如果把一些属性及方法封装起来,日后使用将非常方便,也可以避免繁琐重复的工作.接下 ...

  2. python实现高效率的排列组合算法-乾颐堂

    组合算法 本程序的思路是开一个数组,其下标表示1到m个数,数组元素的值为1表示其下标 代表的数被选中,为0则没选中. 首先初始化,将数组前n个元素置1,表示第一个组合为前n个数. 然后从左到右扫描数组 ...

  3. ssh上外网

    https://www.cnblogs.com/leipei2352/archive/2011/07/21/2112274.html http://www.qijiannet.com/web/1332 ...

  4. Java Persistence with MyBatis 3(中文版) 第五章 与Spring集成

    MyBatis-Spring是MyBatis框架的子模块,用来提供与当前流行的依赖注入框架Spring的无缝集成. Spring框架是一个基于依赖注入(Dependency Injection)和面向 ...

  5. Spring Boot☞ 使用freemarker模板引擎渲染web视图

    效果图 代码 package com.wls.integrateplugs.hello.controller; /** * Created by wls on 2017/8/24. */ import ...

  6. .NET开源MSSQL、Redis监控产品Opserver之Redis配置

    安全与基础配置地址:http://www.cnblogs.com/xiaopotian/p/6898310.html edis监控数据实例的加载可以查看Opserver.Core项目data/Redi ...

  7. ACM 韩信点兵 、n的另一种阶乘、6174的问题

    3.6174问题 描述 假设你有一个各位数字互不相同的四位数,把所有的数字从大到小排序后得到a,从小到大后得到b,然后用a-b替换原来这个数,并且继续操作.例如,从1234出发,依次可以得到4321- ...

  8. [修正] Firemonkey 中英文混排折行,省略字符,首字避开标点

    问题:FMX 在移动平台的文字显示并非由该平台的原生 API 来显示,而是由 FMX.TextLayout.GPU 来处理,也许是官方没留意到中文字符的问题,造成在中英文混排折行时,有些问题. 修正: ...

  9. [leetcode] 3. Pascal's Triangle

    第三道还是帕斯卡三角,这个是要求正常输出,题目如下: Given numRows, generate the first numRows of Pascal's triangle. For examp ...

  10. C#判断一个字符串是否是数字或者含有某个数字

    第一种就是 最常见的 用Try..Catch.. 再try中强转你要确认的string 类型 成功就是int  catch 就不是 string a = "avdfd"; try ...