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

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. 第一个Django应用程序_part3

    一.概述 此文延续第一个Django应用程序part2. 官方文档:https://docs.djangoproject.com/en/1.11/intro/tutorial03/ view是Djan ...

  2. code1316 文化之旅

    文化之旅的本质是最短路问题,只不过添加了一个文化排斥,仅需要做最短路时判断一下是否排斥即可 因为数据较小,采用了Floyd算法,以下是代码,关键部分附注释: #include<iostream& ...

  3. easyui 获取当前页签选中的名称

    parent.parent.$("#tabs").tabs('getSelected').panel('options').title == "收藏夹管理"

  4. SourceTree 3.0.8 跳过登陆注册

    3.0.8普通用户版account.json跳过登陆注册方法已失效,请安装企业版 https://www.sourcetreeapp.com/enterprise 企业版默认安装在 %programf ...

  5. transition与animation的区别

    transition需要事件触发,animation可以直接自动触发,而且功能上更为强大,包括可以设置不同时间段的动画规则,还有状态的控制,事件等等.

  6. 使用 ServiceStack 构建跨平台 Web 服务(转)

    出处:http://www.cnblogs.com/shanyou/p/3348347.html 本文主要来自MSDN杂志<Building Cross-Platform Web Service ...

  7. 利用APT实现Android编译时注解

    摘要: 一.APT概述 我们在前面的java注解详解一文中已经讲过,可以在运行时利用反射机制运行处理注解.其实,我们还可以在编译时处理注解,这就是不得不说官方为我们提供的注解处理工具APT (Anno ...

  8. VC:GetWindowRect、GetClientRect、ScreenToClient与ClientToScreen

    GetWindowRect是取得窗口在屏幕坐标系下的RECT坐标(包括客户区和非客户区),这样可以得到窗口的大小和相对屏幕左上角(0,0)的位置. GetClientRect取得窗口客户区(不包括非客 ...

  9. 彻底的卸载SQL Server2005

    昨天不小心把SQL Server 2005弄坏了.所以,对彻底卸载他进行了研究.在这里记录一下,嘿嘿~ 1.首先在控制面板中卸载所有与SQL Server 2005相关的程序,要记得最后一个卸载Mic ...

  10. 《JavaScript权威指南》(第6版)翻译错误集 更新中。。。

    §6.2.2  P126 原文:If o inherits x,and that property is an accessor property with a setter method. 原译:如 ...