1
votes

I am trying to train a model for detecting license plates of pakistani cars. I found a faster technique called YOLO. Here is a link YOLOv2

Blog which I am following to train YOLOv2 is this blog

According to this blog I need to have images of cars and I need to annotate these images (need to mark position of license plate) for preparation of test data and training data. Problem is that I already have training data of the form

sample training data

and this tutorial requires me to do annotation from cars images like this.

enter image description here

If someone has worked with YOLO kindly tell me how can I avoid annotation and use my own training data to train a YOLO model.

2
If all of your training data is of the above format then probably YOLO is not the right choice for you. Yolo is object detection algorithm your training data is of the form of image classification problem. What is your test data? Images of vehicles or only images of plates? - Scorpio
I am doing detection not classification. Input to this model would be an image of car having a license plate on it. Test data contains images of vehicles. - Abdul Wahab
If the input is a car then why is the training data not car (or any other vehicle) ? Why is the training data just complete pics of number plate? - Scorpio
I think to achieve it you would have to provide the image license plates in all similar views that the Camera will caught them on the images. Giving it Big Plan images will not help at all. - KeitelDOG

2 Answers

3
votes

Yolo training requires following format of annotation

[class] [X] [Y] [W] [H]

i.e

0 0.443359 0.434722 0.391406 0.869444

If you have same annotation dataset, Congratulations you can start training. If you don't have same you can convert using tools available on github.

Update: Annotation is calculated from center For Example. If you are working with x1,y1,x2,y2 format you need to convert it.

def convert_to_yolo_format(path, x1, y1, x2, y2):
    """
    Definition: Converts (x1, y1, x1, y2) format to
        (x, y, width, height) normalized YOLO format.
    """
    size = get_img_shape(path) # size array [width,height]
    dw = 1./size[0]
    dh = 1./size[1]
    x = (x1 + x2)/2.0 # centroid x
    y = (y1 + y2)/2.0 # centroid y
    w = x2 - x1 # width
    h = y1 - y2 # height
    x = abs(x*dw) # divide by width
    w = abs(w*dw) # divide by width
    y = abs(y*dh) # divide by height
    h = abs(h*dh) # divide by height
    return (x,y,w,h)
0
votes

I also deal with LP recognition with YOLO right now. It's a good choice, bus as mentioned above, in order to solve object detection problem, you need training set not with bare LPs, but with "LPs in natural environment" to train Yolo to find LP position on the frame. If you have not got it, but only have set of bare LPs, you need to produce it in some artificial manner. I can propose to 1) extend you trainig set with negative examples (images without LP) 2) train Yolo for object classification problem 3) process you unlabelled "natural environment" train set with obtained classification model using moving window to detect LP ground truth positions (yes, it can be resource consuming...) and thus get training set for object detection problem 4) train NN to solve object detection problem. By the way, you can use the same NN trained on step 2, but with larger input size and with changed last layers as an initial weights for detection problem (but as for me, it didn't give any improvement compered with traing for detection from scratch).