创建自定义数据集

编程入门 行业动态 更新时间:2024-10-28 09:28:41
本文介绍了创建自定义数据集的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我认为这是一个广泛适用的问题,但是我正在尝试为特定比赛创建一个数据集,其中涉及将无人机驾驶在具有纸板几何形状并画有字母数字字符的田野上.目的是对形状和字符进行检测和分类.

I imagine this is a broadly applicable question, but I'm trying to create a dataset for a particular competition that involves flying a UAV over a field with cardboard geometric shapes with alphanumeric characters painted on. The objective is to detect and classify the shapes and characters.

目前,我正在使用SURF来检测形状,使用K均值来对形状和字符进行分割,并使用卷积神经网络对其进行分类.但是,在训练可以与真实数据一起良好运行的数据方面,我遇到了瓶颈.

Currently, I'm using SURF to detect the shape, K-means to segment the shape and character, and a convolutional neural network to classify each. However, I'm experiencing a bottleneck when it comes to training data that can perform well with real data.

我尝试过的

  • 使用Keras的 ImageDataGenerator 生成具有随机旋转,缩放和倾斜的数据集打字字体和几何形状的每个字母数字字符的模板图像:可以很好地处理数据集中的数据(转到图)和一些外部数据,但是当字符过于偏离时会感到困惑

  • Generating a dataset with Keras' ImageDataGenerator with random rotations, scalings, and skewings of a template image of each of the alphanumeric characters of a typewritten font and geometric shapes: works fine with data from the dataset (go figure) and some outside data but gets confused when the characters are too deviant

使用MNIST数据集:没有投诉,但仅包含数字

Using the MNIST dataset: no complaints, but only contains numbers

使用EMNIST ByClass数据集(与MNIST数据集不同;还包含字母):由于尺寸不容易训练,即使经过适当的训练也表现不佳高精确度.在数据集中,许多图像与所谓的类别几乎没有相似之处,并且某些类别的旋转角度与其他类别不同

Using the EMNIST ByClass dataset (which is different from the MNIST dataset; contains letters as well): doesn't train easily because of size, and doesn't perform well even when trained to a decently high accuracy. In the dataset itself, many images bear little resemblance to the purported class, and some classes are at different rotations than others

使用Tesseract OCR字符.效果不佳

Using Tesseract OCR for the characters. This hasn't had great results

我没有尝试过的东西

  • 使用我们创建的真实纸板切口进行多个天桥设计,并使用每个视频中的多个帧作为数据集.缺点:这将需要大量的飞行和纸板切口,并且不会提供太多的数据变化.

使用ImageDataGenerator,但是使用几种不同的字体,而不是一种.

Using the ImageDataGenerator, but on several different fonts instead of one.

有人对如何为这样的任务创建自定义数据集有任何建议吗?

Does anyone have any advice on how to create a custom dataset for a task like this?

推荐答案

这是我的dataSetGenerator也许可以帮助您生成自己的数据集

this is my dataSetGenerator maybe help you to generate your own dataset

import numpy as np from os import listdir from glob import glob import cv2 def dataSetGenerator(path,resize=False,resize_to=224,percentage=100): """ DataSetsFolder | |----------class-1 | . |-------image-1 | . | . | . | . | . | . | . |-------image-n | . |-------class-n :param path: <path>/DataSetsFolder :param resize: :param resize_to: :param percentage: :return: images, labels, classes """ classes = listdir(path) image_list = [] labels = [] for classe in classes: for filename in glob(path+'/'+classe+'/*.tif'): if resize:image_list.append(cv2.resize(cv2.imread(filename),(resize_to, resize_to))) else:image_list.append(cv2.imread(filename)) label=np.zeros(len(classes)) label[classes.index(classe)]=1 labels.append(label) indice = np.random.permutation(len(image_list))[:int(len(image_list)*percentage/100)] return np.array([image_list[x] for x in indice]),np.array([labels[x] for x in indice]),np.array(classes)

更多推荐

创建自定义数据集

本文发布于:2023-11-13 14:02:56,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1584516.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:自定义   数据

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!