-
Notifications
You must be signed in to change notification settings - Fork 236
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to generate object detection dataset using kubric? #235
Comments
Hello! Lets take a look at the examples folder, specifically we will arbitrarily choose helloworld.py (seen here)
Lets dive into the file that defines these in Kubric/file_io.py Upon further investigation it seems as though there is a dictionary of default data handlers that have been built. Lets quickly look at it!
I'm guessing something will need to be done with one of these to actually build the boxes from the cameras angle? I kept clicking and found: Edit 26/05/2022I've done more looking and you probably want somthing as seen here in Challenges
Checkout do the bottom of Movi_ab_worker.py |
Thank you very much for your reply! I checked your reply, but still have some questions, how can I build a virtual scene, and then generate a 2D target detection frame for the target of interest in the scene? The example of hello world.py shows how to generate depth map and segmentation map. Obviously, it is easier to generate boxes, but how to generate specific scenes? For example, I want to generate random people and vehicles in the street scene, label them with bbox, and finally export the labels? |
You want to be able to export the images with the bboxes and labels on them? I'll try to whip together an example of something that does that (don't hold me to it. EDIT: Yeah, dont hold me to it, trying to get this done sucks ass when you barley know what everything does) Although to my knowledge the Pipeline doesn't currently draw the boxes for you, It just outputs the metadata information required to draw the said bboxes. That would be another processing step you would take externally. in short: Edit 31/05/2022Generate your Dataset from the Kubric Pipeline.
You could also just use the Movi-F Example to generate data or as a full example in the Kubric Pipeline. DisclaimerThis is not inside of Kubric, This is something I wrote that USES the data made above by Kubric!Lets walk through how to use it for anyone else looking (and for future me xD ) Get a fresh dev enviroment and install openCV Look a load of text.. Can't promise it will work for you or note break something so please do take care and have a read through to make sure it suites your application
This is what I got in the end, tucked away in a folder named "bboxdraw" inside whatever folder you put into the program. I hope this helps xD |
frist: You could also just use the Movi-F Example to generate data or as a full example in the Kubric Pipeline. Because the environment is difficult to configure, it is not easy to run the code in the mirror to debug, so it is very inconvenient, but thank you very much for what you have done, I believe this can help more people |
No need to request forgiveness! Just ensure you read and poise questions to better help yourself understand. Never be afraid to ask for clarification! The internet can be a great place to learn :D I plan on and hope to answer all your questions but first want to get through the issue you seem to be having with point 2 One of the Developers Mentioned the following quoted information, Although at the time of writing my comment here; there has not been any further comments after the following:
The above was in response to someone experiencing the same error as in your picture Now lets jump back to point 1
The last two lines of the command you copy and paste give us further insight aswell. Lets explore xD kubric/challenges/movi/movi_def_worker.py Line 52 in ea9556f
Parkour! Point 3
If we go back to the file we activate we will find the aforementioned "end of what a Worker File looks like" kubric/challenges/movi/movi_def_worker.py Line 241 in ea9556f
I was generalizing and I failed to mention that. Other examples do NOT look like that consistently. There are just a few different "Boilerplates" for specific needs. To which yours is a need for the Segmentation Data and the metadata for bboxs. I want to make sure I include everything you need to get the desired result. Its a bit of a walk in the park and there might be a few more questions you have. Line 49 in ea9556f
make examples/helloworld - for example will start this example file of the repo
Lets now answer how do we create a dataset from the beginning in plain English? Create a custom Kubric worker file that creates a scene using certain objects. Output the appropriate data. I hope I was able to answer a few of your questions. If there's any more questions let me know. If you don't have internet connection from inside your container then you will struggle getting the Pipeline operational. Once it works once there isnt much trouble in getting it to function time and time again. |
I used the following test command as you mentioned:
The content of the json file of the road successfully, my container can access the internet。 I would like to know if there is a way to import json locally, I will download the required files and upload them to the folder of the local server, instead of accessing the URL and downloading through python code. |
Create a new folder somewhere and make your way in a browser to the following link
I'm not sure how you will go about loading it inside the file for demonstrative purposes. I tried quickly and from what I could tell I wasnt sucessfull in getting it to load locally. Although you may have better luck as its your setup that has the issues. I cobbled up a little example for you to use that should work in your Region. Its really simple but should provide a solid learning base to start getting a response from the Kubric Pipeline without downloading extra assets from inside the Repo.
replace examples/helloworld.py with the above code and run It should produce 4 Frames worth of images. Once again, goodluck xD |
I used the example you provided to generate the data, and used the script you wrote to visualize the bbox, but no valid objects were generated in this hello world.py, the reason I think is because the valid metadata is not loaded (json file containing object information), so I tried to re-use the example provided by the repo for data generation, but as before, I still can't get the json file from the url, how can I solve this problem? |
OH! Crikey. I really do have a copy paste brain... Lets find the Problems!!!!! To make debugging easier you might want to download yourself Blender 2.9 so you can open the .blend file rendered in the following line
Opening the blender file you will now see the camera is wonky - keep reading for an explanation or skip to the bottom of this comment 😄 The class does not support such method as it was me testing/attempting to fix some things. I got it working by editing the Kubric Core Code. How did I get that working? Good question! I've created a Pull Request although things take time xD Here is my Fork that I do ALL my Kubric stuffs on. Here we are at the funky camera issues listed in the repository Issues section: ORRRRRRRR!!!!!!!
Delete both those lines in your worker file. You dont need them, You only need the one above it for this example as we dont need a moving camera at this point (Keep the following):
The camera gets moved here in an earlier attempt to replicate the above Linked Issues. My mistake to leave it in there D: EDIT:
Why arnt you getting any object or instance information in the metadata.json file?
As we can see from the snippet of the worker file It only grabs the VISIBLE Objects. The camera isnt pointing at anything but the edge of the box named "floor". It is not a Asset Object so it has no asset_ID, Its a Kubric Core object as are the balls. Also please note that is NOT the only fix required inside the bbox drawer file as at this point in time, Segmentation_ID isn't working as intended. Which is why I updated the script to deafult to asset_id then segmentation_id and finally a numbering system if all else fails. MrXandbadas@72415ea is the specific commit to my Fork of this repository with a potential fix for the Segmentation_ID issue. Allowing for Segmentation_id's to be passed through to the metadata.json file. I'm going to guess thats how I got it working... There might be one more thing I'm forgetting to mention.... It will come to me xD |
Can kubric be used to generate object detection data in virtual scenes?
If so, how can it be implemented?
Thanks for your replies! ! !
The text was updated successfully, but these errors were encountered: