Giter VIP home page Giter VIP logo

Comments (4)

terasadi avatar terasadi commented on July 22, 2024 1

My skills with c# are better than Python.
I did by this way, after process on labelme2yolo:

//generated by labelme2yolo
var lstClassesWrong = new List<string>() { "person", "bicycle", "car", "motorbike", "aeroplane" };
var lstClassesCorrect = new List<string>() { "aeroplane", "bicycle", "motorbike", "car", "person" };

string rootDir = ".\labels";
string[] filess = Directory.GetFiles(rootDir, "*.txt", SearchOption.AllDirectories);

foreach (string _file in filess)
{
    List<string> lines = new List<string>();

    using (StreamReader sr = new StreamReader(_file))
    {
        string line;
        while ((line = sr.ReadLine()) != null)
        {
            string[] parts = line.Split(' ');

            if (parts.Length > 0)
            {
                int idxClassWrong = int.Parse(parts[0]);
                string classWrong = lstClassesWrong[idxClassWrong];
                int idxClassCorrect = lstClassesCorrect.IndexOf(classWrong);

                if (idxClassWrong != idxClassCorrect)
                    parts[0] = idxClassCorrect.ToString();
            }

            lines.Add(string.Join(" ", parts));
        }
    }

    using (StreamWriter sw = new StreamWriter(_file))
    {
        foreach (string line in lines)
        {
            sw.WriteLine(line);
        }
    }

    Console.WriteLine($"File {_file} changed!");
}

Console.WriteLine("Finished!");

from labelme2yolo.

GreatV avatar GreatV commented on July 22, 2024

Hi, @terasadi. Are you mean manually assigning the order of the labels before you start?

labelme2yolo --json_dir <YOUR DATASET DIR> --val_size 0.15 --classes person bicycle car motorbike aeroplane

from labelme2yolo.

GreatV avatar GreatV commented on July 22, 2024

This is a good idea, and we will implement it soon.

from labelme2yolo.

GreatV avatar GreatV commented on July 22, 2024

hi, @terasadi. Thank you for your feedback. This implementation of remapping label seems pretty good.

from labelme2yolo.

Related Issues (13)

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.