Giter VIP home page Giter VIP logo

Comments (15)

Ahziel avatar Ahziel commented on August 15, 2024 2

Hi @thealchemist89,

I'm a newbie too but I'm also working on the training of YOLO so maybe I can help you a little with my tiny knowledge.

To create my own dataset with annotations I personally use labelImg but I know that others use BBox-Label-Tool. I prefer labelImg just because you have the annotations in the Pascal VOC format. So, to use your data for YAD2K, you'll have to you a parser to create annotation with the good format. (In python it's easy because the annotation file is in xml)

To train YAD2K you have a script called retain_yolo.py. You just have to provided a .npz file witch contain your data. To create this file, you can used this project witch is provided by @shadySource (who provided also the retrain_yolo.py script).

You just have to execute the script. I don't remember if you need to modified the .cfg for this version, maybe others know that. You also have to created the .txt with your classes.

I had some issues to train my own data because my images had different shapes. If this happen to you too you can check this post to see how solve this problem.

I do not know whether I am clear in my remarks. If you need more explication just ask and if I understand the problem I will answe !

I sorry for my English if it's not clear or if there is a lot of mistakes !

from yad2k.

alecGraves avatar alecGraves commented on August 15, 2024 2

@thealchemist89

  1. retrain_yolo.py currently resizes (stretches/shrinks) all images and their corresponding labels to a fixed size for easy training with keras. Also, the way training data is loaded now requires all training images to have the same dimensions. The post is near the bottom here.
  2. retrain_yolo.py is already configured to load the pre-trained model of yolo then re-train it for another dataset (it already does transfer learning). If you need help understanding how to use it, I could write a small tutorial. The readme does need to be updated with this information.

from yad2k.

MATRIX4284 avatar MATRIX4284 commented on August 15, 2024 1

from yad2k.

thealchemist-x avatar thealchemist-x commented on August 15, 2024

Thank you Ahziel, you explained it very well. And, I appreciate very much your time and patience in writing so clearly. If I may ask 2 more questions:

  1. May I know which post you are referring to that helps us to handle images with different shapes?

  2. How can we build our dataset on-top of the pre-trained model of YOLO? I'm trying to do transfer learning hoping not to re-train everything. Do you know where in the code we can do this?

Thank you for helping!

from yad2k.

thealchemist-x avatar thealchemist-x commented on August 15, 2024

@shadySource

Thank you so much for your kind direction. I will follow up based on your suggestions, a tutorial will certainly be great!

from yad2k.

00desire avatar 00desire commented on August 15, 2024

I labelled my images using labelImg, just contributing my code to parse the xml files to the format used by @shadySource package_dataset2.py

Hope this can help newbies working with YAD2K :)

import xml.etree.ElementTree as ET
import os

dir = 'data/xmls' #directory containing xml files

f= open("data.csv","w+") #csv file name

for files in os.listdir(dir):
    tree = ET.parse(os.path.join(dir,files))
    root = tree.getroot()


    file_name = root.find('filename').text

    for object in root.findall('object'):
        obj_name = object.find('name').text
        bndbox = object.find('bndbox')
        xmin = bndbox.find('xmin').text
        ymin = bndbox.find('ymin').text
        xmax = bndbox.find('xmax').text
        ymax = bndbox.find('ymax').text
        string = ' '.join([file_name,xmin,ymin,xmax,ymax,'0',obj_name,'\n'])
        f.write(string)

from yad2k.

zq1314 avatar zq1314 commented on August 15, 2024

@00desire hi,can you share your code with me ,here is my emial ([email protected])

from yad2k.

MATRIX4284 avatar MATRIX4284 commented on August 15, 2024

First use labelImg-master to convert the boxed pictures into VOC Annotated format the use my utility from the link below to convert the VOC Annotated Files to npz so that you can train your own custom data using YAD2K

https://github.com/MATRIX4284/VOC_NPZ

from yad2k.

priyamehta01 avatar priyamehta01 commented on August 15, 2024

Hey, I have image text files which I generated from the LabelImg project. I am facing quite some trouble parsing it when there are multiple objects in an image file.

from yad2k.

00desire avatar 00desire commented on August 15, 2024

@priyamehta01 refer to the code i provided above using the Element Tree library to parse the xml files to find specific objects.

from yad2k.

Denielll avatar Denielll commented on August 15, 2024

@shadySource
you mentioned that retrain_yolo.py currently resizes (stretches/shrinks) all images and their corresponding labels to a fixed size for easy training with keras.

However, in the package_dataset.py, u resize img ? Why was that ? I thought retrain_yolo.py already handled it.

What should I do if I have different sizes of img ?
Can I label them and then resize ? or I have to resize before labeling ?

Thank you !

from yad2k.

MATRIX4284 avatar MATRIX4284 commented on August 15, 2024

from yad2k.

MATRIX4284 avatar MATRIX4284 commented on August 15, 2024

from yad2k.

MATRIX4284 avatar MATRIX4284 commented on August 15, 2024

from yad2k.

MATRIX4284 avatar MATRIX4284 commented on August 15, 2024

from yad2k.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.