Giter VIP home page Giter VIP logo

partsegmentationtoolbox's Introduction

PartSegmentationToolbox

This toolbox provides helper scripts for the application of MedMeshCNN and MeshCNN.

It includes Blender scripts that

  • prepare Blender for the manual segmentation (prepare_blender.py)
  • extract edge labels from the manual segmentation performend in blender (extract_edge_labels.py)
  • prints edge labels to objects in blender (print_segmentation.py)

as well as independent python scripts that

  • create sseg files (create_sseg.py)
  • map segmentation outputs to meshes of different resolution (e.g. to compensate downsampling) (upscale_labels.py)

Getting Started

Installation

  • Clone this repo:
git clone https://github.com/LSnyd/PartSegmentationToolbox.git
cd MedMeshCNN
  • Install dependencies: Blender version 2.82

Run Blender scripts

To run the blender scripts, copy and paste the provided script into the Blender Python Console. Make sure that you update all paths according to your own locations.

Prepare Blender for manual segmentation

To prepare Blender for the manual segmentation of an object, insert the prepare_blender.py after opening Blender. This script creates 4 vertex groups and maps 4 different colors to the group. If you want to create a segmentation with more classes, alter the script accordingly.

Perform a manual segmentation

For the manual segmentation please refer to my Medium article here.

Extract labels from the manual segmentation (.eseg file)

In order to extract the edge labels from the manual segmentation insert the content of extract_edge_labels.py into the Blender Python Console after performing the manual segmentation. This script creates an .eseg file of the object, which includes the class labels per edge ordered after their edge ID. Afterwards, it is still necessary to create a .seseg file for your object to run MedMeshCNN or MeshCNN. For this you can refer to the Python section of this toolbox.

Print segmentation of .eseg file to your object

The print_segmentation.py script lets you print your .eseg files onto the surface of your mesh. Make sure that you always activate "keep vertex order" when importing an object.

Run Python scripts

Create files with soft labels (.seseg file)

To create relevant sseg files for running MedMeshCNN or MeshCNN please run

python create_sseg.py /home/user/MedMeshCNN/datasets/human_seg/

and include the path to you train, test, seg, sseg folders as an argument. Make sure that there is a sseg folder already created in the path. This script creates a sseg file for all available eseg files in the eseg folder of the path.

Map your segmentation outcome to meshes of varying resolutions

To map your segmentation output to a mesh with a different resolution run

python upscale_labels.py /home/user/MedMeshCNN/checkpoints/human_seg/validate/ /home/user/data/high_resolution_meshes/

This script maps the segmentation result to the original resolution mesh via a nearest neighbor search within a KD-Tree. This is helpful if you had to downsample your meshes to run MeshCNN and want to transfer your results to the original resolution of the mesh. Note that this transformation is only possible once. Once you have added labels to your high resolution objects, it is not possible to overwrite them with this script.

Questions / Issues

If you have questions or issues running this code, please open an issue.

partsegmentationtoolbox's People

Contributors

lsnyd avatar

Watchers

James Cloos avatar

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.