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

How to access output directory of current dataset?

Open jmacpereira opened this issue 2 years ago • 7 comments

I'm capturing depth images alongside the normal RGB and segmentation images captured by the PerceptionCamera, and I'm trying to write the depth images to a folder on the same level as the RGB and segmentation folders - the base directory for the sensors.

In the previous 0.9.0 preview release, I could do this with a combination of setting Configuration.localPersistentDataPath and getting Configuration.Instance.GetStoragePath(), but updating to 0.10.0-preview.1 broke this, and I'm not able to get the current dataset path anymore. I've tried getting ((PerceptionEndpoint)PerceptionSettings.instance.endpoint).currentPath, but it doesn't seem to access the currently running PerceptionEndpoint, and currentPath ends up generating a new Guid, so I end up with a separate folder.

I thought of creating a custom endpoint implementing IConsumerEndpoint to add the custom sensor (depth in my case), but it didn't look that simple. Not sure if this is a viable idea.

Can you help my use case? Maybe the PerceptionCamera could have a getter for the PerceptionEndpoint with the path it's currently writing to?

Thanks

jmacpereira avatar Mar 25 '22 16:03 jmacpereira

This workes for me, baseDirectory = Manager.Instance.GetDirectoryFor(DataCapturePaths.ScreenCapture);

This points towards a ScreenCapture folder located at the level of RGB and segmentation images., maybe it helps (i'm not an expert)?

I'm very interested in how you get accurate depth images. I'm using the CaptureCamera.CaptureColorAndDepthToFile method, which saves a good looking image to disk but i cannot recover accurate actual depth images from it. Any hints?

frederikvaneecke1997 avatar Mar 25 '22 16:03 frederikvaneecke1997

@frederikvaneecke1997 Not exactly what I was looking for... The RGB and segmentation folders are inside a folder which name is a GUID. I can put the depth folder on the same level as that dir, but I want it to be inside of the dir. On 0.10.0-preview.1 I can't do this, even when using the line you suggested.

As for depth images, the capture package doesn't have the required accuracy, so I resorted to a custom shader approach.

jmacpereira avatar Mar 25 '22 17:03 jmacpereira

@jmacpereira Thanks for reaching out, and being a perception user.

I think an api that will allow you to request the current working directory is a very reasonable feature request, and hopefully we can get that implemented in the near future.

How are you reporting your depth image? For it to work with and EndPoint, you would have to report your depth capture as a sensor to DatasetCapture, in the same fashion that we report the perception camera's results.

StevenBorkman avatar Mar 25 '22 17:03 StevenBorkman

@StevenBorkman Currently I don't report it as a capture. I manually add the frameCount to the depth filenames, so they match up with the other files and the correspondence can be made by the dataset users. Reporting them to the captures.json file could be helpful, but that would mean registering and reporting the sensor, which involves writing a SensorDefinition and subclassing Sensor which I don't want to do yet.

For now, having the current dataset directory would be the most practical. Thanks for the fast response!

jmacpereira avatar Mar 25 '22 17:03 jmacpereira

hey @jmacpereira , I am new to unity world and was wondering how you got the depth images ? were you able to find the generated dataset ? I was following the perception tutorial and cant find the generated dataset.. thanks for any help

an99990 avatar Mar 28 '22 15:03 an99990

@an99990 we are using a custom shader, there is a good online tutorial about this here which should get you started

robin-moss avatar Mar 29 '22 11:03 robin-moss

alright thank you, will take a look at it ! @robin-moss

an99990 avatar Mar 29 '22 17:03 an99990

Hey all! The Perception team just released 🎉 Perception 1.0 🎉, a major update to the toolset! With this change we have added a new output format: SOLO. SOLO will allow for easier association of added frame data with the current capture. Also we have added a built-in Depth Labeler for you to use. I hope this meets all of your needs.

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

StevenBorkman avatar Nov 22 '22 18:11 StevenBorkman