json to voc xml annotations conversion - json

I'm a newbie in AI and i'm using labelbox to create my own dataset (instance segmentation) and the annotation output is a single json file.
The issue that i have is that the model that i'm using (Mask RCNN) need to be feed with images with an annotation file in VOC xml for each file.
I need a script that could use the single JSON from labelbox and convert it to multiple images and voc xml annotation file.
Thanks for your help.

You can use https://app.roboflow.com/ to easily convert them, as per this guide:
https://roboflow.com/convert/labelbox-json-to-pascal-voc-xml
Though it realistically wouldn't be all too hard to make a parsing script, at least for bounding boxes, to manually create xml's if 1000 images (robobox's free amount) isn't enough. The Json files contain top left box coordinates as well as width and height. This is basically all the VOC XMLs need.

Related

Autodesk design automation Revit , text file as input

The Revit API I developed, take a text file as input.
the text file looks like as below......
1.002, 20,502, 21.706
12.502, 5,502, 7.706
21.002, 15,502, 14.706
.....................
.....................
(The values are not correct.just imaginary. I am just showing how my text file looks like)
I am basically reading the text data as input.
Now if I want to convert the same API as Design automation API, I guess I will not be able to use "text file" as input.
My question is, what should be file type of input file, if it is consisted of 3d point coordinates as described above.
Should it be Json? If it need to be json, then how I should write it for point coordinates? or any other suggestion for file type will be a big help.
If there is any example code, will be a big help.
In the list for supported input file format, txt file is not included.
If I write a Json file, then please give me some clue, how should I arrange it and read the file for Revit.
Many thanks in advance.
T
Thank you for your query.
The slightly more complex question is how to generate multiple output files.
That is answered by the article
on How to generate dynamic number of output with Design Automation for Revit V3.
In passing, it also mentions multiple input files, saying:
"... For the zipped input file, it's well documented at https://forge.autodesk.com/en/docs/design-automation/v3/tutorials/revit/step6-post-workitem/, but for the output zipped result, it's not so clear..."
Trying to follow that link, I note that it is out of date.
The updated link is:
https://forge.autodesk.com/en/docs/design-automation/v3/tutorials/revit/step7-post-workitem/
Looking at the additional notes on input arguments, I see the instructions on how to pass JSON input data directly in the workitem itself.
I would assume that you can also use a different prefix instead of data:application/json such as data:application/text to pass in the data in its current form.
Please try that out and let us know how it works for you.
Alternatively, you can just stay on the safe side and convert your text data to JSON format.
There are innumerable ways of doing so.
The most minimalistic and simple would look like this:
[1.002, 20,502, 21.706,
12.502, 5,502, 7.706,
21.002, 15,502, 14.706,
...]
That represents on single array of doubles.
A slightly more structured approach might be to pass in an array of triples of doubles like this:
[[1.002, 20,502, 21.706],
[12.502, 5,502, 7.706],
[21.002, 15,502, 14.706],
...]
As you see, it is not hard.
I hope this helps.

Move Gherkin's (i.e. Cucumber and Behave) Data Table to JSON

I was using Behave and Selenium to test on something that use a large amount of data. Data tables were becoming too big and making the Gherkin documentation unreadable.
I would like to move most of the data from data tables to external file such as JSON. But I couldn't find any examples on websites.
I cannot offer an example at the moment, but I would create the JSON file as needed and give reference to the JSON file in Given or Background , then capture the value in the respective decorated method.

JSON format for Three.JS

I have a problem with JSON format.
I am going to generate a 2D building plan in JSON format automatically. Then this JSON file is loaded to Three.JS for visualization.
Currently, I can easily create various geometry type in JSON format based on:
https://github.com/mrdoob/three.js/wiki/JSON-Model-format-3.1
However, I need to know more about this data format.
Firstly, how can I add text to the model?
Secondly, I could not find line as a geometry in this format. Is there?
Thirdly, is there any document that I can refer to it for more explanation regarding this
format?
Lastly, how can I add additional information about geometries
inside the JSON format? for example when I create a polygon in JSON
format, I want to add additional information regarding that polygon
such as area, owner,...
Either through a texture, or by creating THREE.TextGeometry and merging that with the other geometry
AFAIK, no. You might be able to emulate lines by loading a separate object that you render as wireframe.
I've used the source code: Loader, JSONLoader
I don't think that's possible while maintaining compatibility, i.e. you would need to patch Three.js loader.
One option for achieving what you want could be to add custom entries to the JSON, e.g. "lines": [], "customFaceProperties": [] and then parse them yourself once the stock Loader has parsed everything it understands.
Also, since it seems you might be creating something that has different things in it, you might want to take a peek at the scene loading capabilities: example, SceneLoader.js

Configuring Object Instances from JSON in conf Files

So I want to be able to basically make instances of a class from JSON definitions in a conf file. In looking through the docs, I found that there are ways to reference things that are defined in JSON structures, but I was wondering about how best to instantiate objects from such definitions. For instance, suppose I had a class called RemoteRepository with 4 or 5 properties. I'd like to make a bunch of entries in a JSON file then read in at startup and get back a collection of RemoteRepository objects. I could do this with a database, of course, including a graph one, but would like to just do JSON if possible.
Assuming a static class definition that represents the JSON structure is acceptable, you can try the JSON C# Class Generator
Once you've generated your classes you can simply create a new instance or array of instances by passing in the json to the constructor that this tool creates on the generated class(es).
So I can make instances, but as usual, once I need a bunch of instances, it's time for a database. In this case, I ended up doing some simple XML files to trigger these instances. As much of a mess as XML is, for things like this, it does work best. Namely:
Some nesting of instance information
Not an exact mapping to the target class, e.g. field mappings are part of my config. I am going to load a few fields from the config file, but then create instances of a different class, hence the immediate conversion to a java class I would get from JSON is not meaningful
One other thing I figured out in doing this is that processing XML in Java is still kind of a mess. Still, this was the right way to go in this case.

MFC :: Modify the values in a json file

I'm able to parse json files in MFC but is having a hard time modifying the values. Is there an easier way writing new values, other than converting it to native file types, modifying the contents and converting it back to json again?
I thought it would be as easy as changing values in an XML file where you just look for the tag and change it's value.
thanks...
You can use JSON Spirit library. The way it traverses through the json file is through it's key and value which is treated as a "pair". All you have to do is loop through the objects and search for the pair you want to replace. That's it...
The details aren't shown here, but pretty much gives you the basics -> http://www.codeproject.com/KB/recipes/JSON_Spirit.aspx. It's got a bunch of methods you could use for whatever operation you want.
:)