Hi I am new to machine learning can anyone suggest open dataset consists of both digits and letters(small,capital)

I want images consisisting of both digits and letters to train my cnn model and make the model recognize the real time images

Can anyone please suggest me that dataset link

Thanks in advance

  • 1
    $\begingroup$ Hello. This type of question (i.e. asking for a dataset) is off-topic here. Please, read our on-topic page ai.stackexchange.com/help/on-topic to know more about our scope. You could try to ask this question on Open Data Stack Exchange. I will wait for the votes of the community members to close this question (the community needs to self-moderate without my or another moderator's intervention). $\endgroup$ – nbro May 14 at 21:39
  • $\begingroup$ @nbro Sorry dont know about this I asked about any dataset which is available open source $\endgroup$ – madhavi May 15 at 6:18
  • $\begingroup$ While not directly an ML question, it is definitely related @nbro . I think many people struggle with where to find data. While Google is a great resource, there really aren't that many datasets around. This question allows us to suggest ways to build your own. :) $\endgroup$ – David Hoelzer May 15 at 21:45
  • $\begingroup$ @DavidHoelzer I understand that it may not always be easy to find the dataset you're looking for, but, as far as I interpret it, the question is not about "how to build this dataset", but "where can I find this dataset". In both cases, I think the questions are off-topic. There's already Open Data Stack Exchange for the first and Data Science SE for the second. I really appreciate that you're trying to help, but I think we should focus on our scope as defined in the on-topic page. If you think we should change it, feel free to create a post on meta to discuss this ;) $\endgroup$ – nbro May 16 at 1:14
  • 1
    $\begingroup$ @nbro Oh, I get that he's asking "where can I find this dataset..." I'm trying to nudge him toward being able to create his own dataset. :) I'll switch to meta if I'm motivated. :) $\endgroup$ – David Hoelzer May 16 at 14:46

As for me, the easiest path to what you are asking for is generating them yourself.

An Example

I usually grab some TTF fonts and put them into a directory so that I have variety for character identification. Begin by importing dependencies and creating a generator function:

from PIL import Image, ImageDraw, ImageFont
from os import listdir

WIDTH       =   200
HEIGHT      =   100
MINX        =    20
MINY        =    20
MAXX        =    WIDTH-60
MAXY        =    HEIGHT-60
MINSIZE     =    24
MAXSIZE     =    48

fonts = [i for i in filter(lambda i:i[-3:]=="ttf", listdir("../data/fonts"))]

def generate_character_image():
    fonts = [i for i in filter(lambda i:i[-3:]=="ttf", listdir("../data/fonts"))]
    while 1:
        img = Image.new('RGB', (WIDTH,HEIGHT), color = (255,255,255))
        font = ImageFont.truetype(f'../data/fonts/{fonts[randrange(len(fonts))]}', randrange(MINSIZE,MAXSIZE))
        canvas = ImageDraw.Draw(img)
        where = (randrange(MINX,MAXX), randrange(MINY,MAXY))
        character = charset[randrange(len(charset))]
        coords = canvas.textbbox(where, character, font)
        # The coordinates are the top left corner
        bounding_box = (coords[0], coords[1], coords[2]-coords[0], coords[3]-coords[1])
        #canvas.rectangle(coords, outline=0, width=1)
        canvas.text(where, character, font=font, fill=(0,0,0), anchor="la")
        yield (character, coords, img)

for i in range(5):
    character,coords,image = next(generate_captcha())
    print(f"{character} is in Bounding Box: {coords}")

You can then use this to generate an infinite number of training samples pretty trivially.

Why This Might Be Good

Personally, I prefer to generate my datasets whenever possible. It allows me to do the following:

  • Train without ever repeating a sample
  • The validation data changes every time (in fact, I'll often not bother with a validation step since every epoch uses different data)
  • Zero storage required

Hope this helps!

  • $\begingroup$ thank you I didnt get what your code gives me an image? an dataset can you give me a brief please $\endgroup$ – madhavi May 16 at 5:57
  • $\begingroup$ This code is taken from another project. It will generate a single random character at a random size an with a random font in a random location in an image. It's perfect for generating a dataset on the fly for training a CNN for character recognition. You would need to adjust the sizes, etc. for your own problem. $\endgroup$ – David Hoelzer May 16 at 14:45

Not the answer you're looking for? Browse other questions tagged or ask your own question.