com.unity.perception icon indicating copy to clipboard operation
com.unity.perception copied to clipboard

Separate JSON data for each capture.

Open rajshekarreddy97 opened this issue 4 years ago • 10 comments

How do we create separate JSON files for each image?

rajshekarreddy97 avatar Oct 08 '20 11:10 rajshekarreddy97

Hi @rajshekarreddy97, right now there is no control over the number of images or captures in each JSON file. How will it help you to have different json files for each image?

JonathanHUnity avatar Oct 19 '20 20:10 JonathanHUnity

Hi @JonathanHUnity If we want to create a dataset for training a CNN based object detection model, we need label for each instance of training classes exist in the image. The model search for(image_name.jpeg,image_name.json). In that case, we need individual json file for images. Thank you!

abhishek1222017 avatar Oct 22 '20 09:10 abhishek1222017

It sounds like your model has a specific format of json that it needs to take as input. I would suggest looking at our Dataset Insights python library, which gives examples of how to load the dataset generated from Unity into python and translate it into a form needed to train the Faster R-CNN model.

In the end, we expect that some amount of data transformation will be required to take the output from Unity and train a model, depending on the specific model you are working with.

JonathanHUnity avatar Oct 22 '20 17:10 JonathanHUnity

Thank you @JonathanHUnity for reply. I would like to clarify our problem better way. Here our problem is not to get json file in a specific format, but individual json file for each image. Currently @rajshekarreddy97 is able to generate one single json file for a sequence of images where json containing bounding box location of each object of interest. I was wondering Instead if we are able to get same data but in different different json files. Thank you in advanced.

abhishek1222017 avatar Oct 22 '20 17:10 abhishek1222017

This is not something we have at the moment. If you would like to fork our package, you can find the control for the method we use to split files here: https://github.com/Unity-Technologies/com.unity.perception/blob/master/com.unity.perception/Runtime/GroundTruth/SimulationState.cs#L71

I've also added public control over this value to our list. Hope that helps!

JonathanHUnity avatar Oct 22 '20 17:10 JonathanHUnity

@abhishek1222017 There was a proposal in #19 to change dataset schema so that each annotation are stored as separate json file for each capture. Do you think this is close to what you expect?

adason avatar Nov 18 '20 22:11 adason

@adason Yes, this is exactly what we were looking for.

rajshekarreddy97 avatar Nov 19 '20 14:11 rajshekarreddy97

Hi @adason I had a similar requirement and I did it.
Please find the link to the repository: https://github.com/Gowtham171996/ConvertUnityPerceptionJSONtoPascalPOCFormat

Gowtham171996 avatar Dec 12 '20 19:12 Gowtham171996

@abhishek1222017 There was a proposal in #19 to change dataset schema so that each annotation are stored as separate json file for each capture. Do you think this is close to what you expect?

Hello adason, I am working on Unity Perception to generate dataset for semantic segmentation and I want single json annotation file along with maks for each image. I saw the commit that you mentioned but I am not sure how can I use it? A little guidance will be quite helpful. Thanks

HasnainKhanNiazi avatar Apr 16 '21 12:04 HasnainKhanNiazi

If you derive a class from FixedLengthScenario.cs, you can hook you to the onDestroy() method and add a custom transformation for the captures.json file.

JObject.Parse(File.ReadAllText(captureFilePath));
foreach (JObject jsonCaptureData in jsonCaptureDataArray)
{
    JArray jsonAnnotationDataArray = jsonCaptureData.Value<JArray>("annotations");
...

VincentGuigui avatar Jul 30 '21 14:07 VincentGuigui

Hey all! The Perception team just released 🎉 Perception 1.0 🎉, a major update to the toolset! In this release we have added the SOLO format, our new dataset that departs in several ways from the previous output format. This includes a single capture file and artifacts for each frame.

There are a bunch of cool features to check out such as ray tracing, depth, normals, and more! Here is the full list of changes: Perception 1.0 Changelog

StevenBorkman avatar Nov 22 '22 18:11 StevenBorkman