Giter Site home page Giter Site logo

hyperpcr's Introduction

This repository contains the code relative to the paper "Towards Confidence-guided Shape Completion for Robotic Applications". This code contain a python package that allows you to do inference with our model. If you want to look at the training and evaluation code check out https://github.com/andrearosasco/confidence_shape_completion or https://github.com/andrearosasco/pcr/tree/mc_dropout mc_dropout branch for a messier version.

Installation

To install the code run pip install hyperpcr If you are on Linux this should automatically install all the dependencies. On windows you might need to manually install pytorch.

Usage

The following script download a checkpoint and a partial point cloud. Then it process it and generates its reconstruction. If you wanna visualize the results you have to additionally install Open3D python library.

import numpy as np
import torch
try:
    from open3d.cpu.pybind.geometry import PointCloud
    from open3d.cpu.pybind.utility import Vector3dVector
    from open3d.visualization import draw
    visualize = True
except ImportError:
    visualize = False

from pcr.model import PCRNetwork as Model
from pcr.utils import Normalize, Denormalize
from pcr.default_config import Config
from pcr.misc import download_checkpoint, download_asset


def main():

    ckpt_path = download_checkpoint(f'grasping.ckpt')
    asset_path = download_asset(f'partial_bleach_317.npy')

    model = Model(config=Config.Model)
    model.load_state_dict(torch.load(ckpt_path)['state_dict'])
    model.cuda()
    model.eval()

    partial = np.load(asset_path)

    partial, ctx = Normalize(Config.Processing)(partial)

    partial = torch.tensor(partial, dtype=torch.float32).cuda().unsqueeze(0)
    complete, probabilities = model(partial)

    complete = complete.squeeze(0).cpu().numpy()
    partial = partial.squeeze(0).cpu().numpy()

    complete = Denormalize(Config.Processing)(complete, ctx)
    partial = Denormalize(Config.Processing)(partial, ctx)

    if visualize:
        draw([
              PointCloud(points=Vector3dVector(partial)).paint_uniform_color([0, 0, 1]),
              PointCloud(points=Vector3dVector(complete)).paint_uniform_color([0, 1, 1]),
              ])

    print(complete)

If you want to change the Decoder behaviour you can change the configuration values of pcr.default_config.Config.

hyperpcr's People

Contributors

andrearosasco avatar

Stargazers

Yoon, Seungje avatar  avatar Nicola Piga avatar  avatar

Watchers

 avatar  avatar

Forkers

xenvre

hyperpcr's Issues

Question about training

Hello, thank you for your great work. I have a question about training. I found that training this network is difficult to converge, meaning that the loss decreases to around 0.6 and then remains largely unchanged. I am using the ShapeNetV2 dataset and training the network through pcr/ours/train.py. The network is configured using ours/configs/local_config.py, and the dataloader is generated through ours/datasets/ShapeNetPOVRemoval.py. I look forward to your response.

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.