Code Monkey home page Code Monkey logo

digit-depth's Introduction


This repository is archived as of April 2024.

DIGIT

This codebase allows you:

  • Collect image frames from DIGIT and annotate circles in each frame.
  • Save the annotated frame values into a csv file.
  • Train a baseline MLP model for RGB to Normal mapping.
  • Generate depth maps in real-time using a fast Poisson Solver.
  • Estimate 2D object pose using PCA and OpenCV built-in algorithms.

Currently, labeling circles is done manually for each sensor. It can take up to an hour for annotating 30 images.
This codebase has a script that will replace manual labeling and model training process up to 10 mins.

Visualization

Estimating object pose by fitting an ellipse (PCA and OpenCV):


Depth image point cloud :


Marker movement tracking ( useful for force direction and magnitude estimation):


TODO

  • Add a Pix2Pix model to generate depth maps from RGB images.
  • Add a Monocular Depth model to generate depth maps from RGB images.

Config files

There are a number of configs params to be edited before you can run the scripts. This is the rough execution order:

  • python scripts/mm_to_pix.py : This script will help you calculate the mm_to_pix value for your sensor. You need to place a caliper on the sensor and press SPACEBAR to capture the image. Then, you need to enter the distance between the two ends of the caliper in mm. This will give you the mm_to_pix value for your sensor.Replace the value in config/digit.yaml file. Other config params in digit.yaml:
  • gel_height: Height of the gel in mm
  • gel_width: Width of the gel in mm
  • gel_thickness: Thickness of the gel in mm
  • gel_min_depth: Minimum depth of the gel in mm (max deformation)
  • ball_diameter: Diameter of the calibration ball in mm
  • max_depth: Maximum depth of the gel in mm (min deformation)
  • sensor/serial_num: Serial number of the sensor
  • sensor/fps: Frames per second of the sensor. Default is 30. There are some issues with 60 FPS.

Usage

Be careful about python path. It is assumed that you run all the scripts from the package folder(/digit-depth)

After changing the config params, run the following scripts in the following order:

  • pip install -r requirements.txt
  • pip install . Now you should have the package installed in your python environment. To train the model, you need to collect data first. You can use the following scripts to collect data:
  • python scripts/record.py : Press SPACEBAR to start recording. Collect 30-40 images.
  • python scripts/label_data.py : Press LEFTMOUSE to label center and RIGHTMOUSE to label circumference.
  • python scripts/create_image_dataset.py : Create a dataset of images and save it to csv files.
  • python scripts/train_mlp.py : Train an MLP model for RGB to Normal mapping.

color2normal model will be saved to a separate folder "models" in /digit-depth/ with its datetime.

Visualization

  • python scripts/point_cloud.py : Opens up Open3D screen to visualize point clouds generated by depth image
  • python scripts/depth.py : Publishes a ROS topic with the depth image. Modify the params inside for better visualization(threshold values,etc).

You can also try these ROS nodes to publish RGB image and maximum deformation value from depth images inside /scripts/ros folder:

  • python scripts/ros/depth_value_pub.py: Publishes the maximum depth (deformation) value for the entire image when object is pressed. Accuracy depends on your MLP-depth model.
  • python scripts/ros/digit_image_pub.py: Publishes the RGB image from the sensor.

Issues

  • If you are using a 60 FPS sensor, you might need to change the fps value in config/digit.yaml file. There are some issues with 60 FPS. Refer to this issue
  • MLP model accuracy really depends on the quality of RGB lighting. If you have produced your own DIGIT, make sure the light is not directly hitting the DIGIT internal camera.

Acknowledgements

I have modified/used the code from the following repos:

Feel free to post an issue and create PRs.

digit-depth's People

Contributors

vocdex avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

digit-depth's Issues

Misunderstanding of gel_min_depth and max_depth config parameters

Hi! First of all I wanted to congratulate you for your work, it is really amazing.

I wonder what the gel_min_depth and max_depth config parameters mean. In digit.yaml, I can see your values of ~20mm, but I don't really understand how the gel is able to deform this much. The thickness of the sensor is around 2-3 mm, so it seems impossible to deform 20mm.

If you could guide me with these two parameters, I would appreciate it.

Thanks in advance.
Julio.

Digit markers

Hi! My name is Julio,

I am working with Digit sensors and I would like to ask you about the digit markers. How did you make the markers over the gel surface?

Thanks in advance.

Lack of file issues

Hello, there is an error in operation when I run 'python scripts/ros/depth_value_pub.py'. No such file or directory:'/home/shuk/digits2/tactile-in-hand/inhandpy/local/Mike/mike.ckpt', Can you help me solve this problem?thank you.

Sharing images

Hi!

Sorry for bothering you again about this topic.

I am trying to understand why I can't get decent 3D reconstruction with my DIGIT sensor. I don't know if the problem is in the parameters of the gel or in the training images. I wonder if you could share with me the images that you used to train and test your model. I would really appreciate it.

Thanks in advance.

How to calibrate digit sensor

Hi! Thanks for the awesome work.

I'm curious about how can we get the configuration files for the digit sensor? It seems in the digit.yaml file you have lots of values obtained from measurements, may I ask if there's a standard pipeline for this? Thanks!

Issues in create_image_dataset.py

Hi, I am encountering difficulties while attempting to run the create_image_dataset.py Python script. Despite successfully locating my 40 image datasets, I consistently encounter errors during the execution of the while loop responsible for computing surface normals. Regrettably, this results in the creation of zero normal images. I have attached screenshots illustrating the errors encountered.

Could you kindly provide guidance on steps to diagnose and resolve this issue? Any insights or recommendations regarding potential causes and troubleshooting steps would be greatly appreciated.

Thank you for your assistance.

err1

err2

Marker movement tracking

Hello! I have successfully used your codes to generate depth maps from tactile images. Next, I want to try marker movement tracking by myself, but I don't know how to build the dataset. If I use the supervised learning method, how can I label the marker movement in the tactile images of my dataset?

Color to normals

Hi! I am Julio again, I create this issue to ask you about the normals. How do you get the normals from the images for the ground truth?
Thanks in advance!

About Estimating object pose using digit sensor

Hi, I am glad to have discovered an open-source work that uses a digit tactile sensor to estimate the pose of objects, but I have not found any code related to "Estimating object pose by fitting an ellipse (PCA and OpenCV)". I would like to ask which file it is specifically.

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.