GithubHelp home page GithubHelp logo

zju3dv / clean-pvnet Goto Github PK

View Code? Open in Web Editor NEW
392.0 13.0 103.0 4.57 MB

Code for "PVNet: Pixel-wise Voting Network for 6DoF Pose Estimation" CVPR 2019 oral

License: Apache License 2.0

Python 13.63% C++ 82.72% Cuda 1.02% C 2.46% GLSL 0.12% Dockerfile 0.03% Shell 0.01%

clean-pvnet's Introduction

PVNet: Pixel-wise Voting Network for 6DoF Pose Estimation

introduction

PVNet: Pixel-wise Voting Network for 6DoF Pose Estimation
Sida Peng, Yuan Liu, Qixing Huang, Xiaowei Zhou, Hujun Bao
CVPR 2019 oral
Project Page

Any questions or discussions are welcomed!

Introduction

Thanks Haotong Lin for providing the clean version of PVNet and reproducing the results.

The structure of this project is described in project_structure.md.

Installation

One way is to set up the environment with docker. See this.

Thanks Floris Gaisser for providing the docker implementation.

Another way is to use the following commands.

  1. Set up the python environment:
    conda create -n pvnet python=3.7
    conda activate pvnet
    
    # install torch 1.1 built from cuda 9.0
    pip install torch==1.1.0 -f https://download.pytorch.org/whl/cu90/stable
    
    pip install Cython==0.28.2
    sudo apt-get install libglfw3-dev libglfw3
    pip install -r requirements.txt
    
  2. Compile cuda extensions under lib/csrc:
    ROOT=/path/to/clean-pvnet
    cd $ROOT/lib/csrc
    export CUDA_HOME="/usr/local/cuda-9.0"
    cd ransac_voting
    python setup.py build_ext --inplace
    cd ../nn
    python setup.py build_ext --inplace
    cd ../fps
    python setup.py build_ext --inplace
    
    # If you want to run PVNet with a detector
    cd ../dcn_v2
    python setup.py build_ext --inplace
    
    # If you want to use the uncertainty-driven PnP
    cd ../uncertainty_pnp
    sudo apt-get install libgoogle-glog-dev
    sudo apt-get install libsuitesparse-dev
    sudo apt-get install libatlas-base-dev
    python setup.py build_ext --inplace
    
  3. Set up datasets:
    ROOT=/path/to/clean-pvnet
    cd $ROOT/data
    ln -s /path/to/linemod linemod
    ln -s /path/to/linemod_orig linemod_orig
    ln -s /path/to/occlusion_linemod occlusion_linemod
    
    # the following is used for tless
    ln -s /path/to/tless tless
    ln -s /path/to/cache cache
    ln -s /path/to/SUN2012pascalformat sun
    

Download datasets which are formatted for this project:

  1. linemod
  2. linemod_orig: The dataset includes the depth for each image.
  3. occlusion linemod
  4. truncation linemod: Check TRUNCATION_LINEMOD.md for the information about the Truncation LINEMOD dataset.
  5. Tless: cat tlessa* | tar xvf - -C ..
  6. Tless cache data: It is used for training and testing on Tless.
  7. SUN2012pascalformat

Testing

Testing on Linemod

We provide the pretrained models of objects on Linemod, which can be found at here.

Take the testing on cat as an example.

  1. Prepare the data related to cat:
    python run.py --type linemod cls_type cat
    
  2. Download the pretrained model of cat and put it to $ROOT/data/model/pvnet/cat/199.pth.
  3. Test:
    python run.py --type evaluate --cfg_file configs/linemod.yaml model cat cls_type cat
    python run.py --type evaluate --cfg_file configs/linemod.yaml test.dataset LinemodOccTest model cat cls_type cat
    
  4. Test with icp:
    python run.py --type evaluate --cfg_file configs/linemod.yaml model cat cls_type cat test.icp True
    python run.py --type evaluate --cfg_file configs/linemod.yaml test.dataset LinemodOccTest model cat cls_type cat test.icp True
    
  5. Test with the uncertainty-driven PnP:
    export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:./lib/csrc/uncertainty_pnp/lib
    python run.py --type evaluate --cfg_file configs/linemod.yaml model cat cls_type cat test.un_pnp True
    python run.py --type evaluate --cfg_file configs/linemod.yaml test.dataset LinemodOccTest model cat cls_type cat test.un_pnp True
    

Testing on Tless

We provide the pretrained models of objects on Tless, which can be found at here.

  1. Download the pretrained models and put them to $ROOT/data/model/pvnet/.
  2. Test:
    python run.py --type evaluate --cfg_file configs/tless/tless_01.yaml
    # or
    python run.py --type evaluate --cfg_file configs/tless/tless_01.yaml test.vsd True
    

Visualization

Demo

python run.py --type demo --cfg_file configs/linemod.yaml demo_path demo_images/cat

Visualization on Linemod

Take the cat as an example.

  1. Prepare the data related to cat:
    python run.py --type linemod cls_type cat
    
  2. Download the pretrained model of cat and put it to $ROOT/data/model/pvnet/cat/199.pth.
  3. Visualize:
    python run.py --type visualize --cfg_file configs/linemod.yaml model cat cls_type cat
    

If setup correctly, the output will look like

cat

  1. Visualize with a detector:

    Download the pretrained models here and put them to $ROOT/data/model/pvnet/pvnet_cat/59.pth and $ROOT/data/model/ct/ct_cat/9.pth

    python run.py --type detector_pvnet --cfg_file configs/ct_linemod.yaml
    

Visualization on Tless

Visualize:

python run.py --type visualize --cfg_file configs/tless/tless_01.yaml
# or
python run.py --type visualize --cfg_file configs/tless/tless_01.yaml test.det_gt True

Training

Training on Linemod

  1. Prepare the data related to cat:
    python run.py --type linemod cls_type cat
    
  2. Train:
    python train_net.py --cfg_file configs/linemod.yaml model mycat cls_type cat
    

The training parameters can be found in project_structure.md.

Training on Tless

Train:

python train_net.py --cfg_file configs/tless/tless_01.yaml

Tensorboard

tensorboard --logdir data/record/pvnet

If setup correctly, the output will look like

tensorboard

Training on the custom object

An example dataset can be downloaded at here.

  1. Create a dataset using https://github.com/F2Wang/ObjectDatasetTools
  2. Organize the dataset as the following structure:
    ├── /path/to/dataset
    │   ├── model.ply
    │   ├── camera.txt
    │   ├── diameter.txt  // the object diameter, whose unit is meter
    │   ├── rgb/
    │   │   ├── 0.jpg
    │   │   ├── ...
    │   │   ├── 1234.jpg
    │   │   ├── ...
    │   ├── mask/
    │   │   ├── 0.png
    │   │   ├── ...
    │   │   ├── 1234.png
    │   │   ├── ...
    │   ├── pose/
    │   │   ├── pose0.npy
    │   │   ├── ...
    │   │   ├── pose1234.npy
    │   │   ├── ...
    │   │   └──
    
  3. Create a soft link pointing to the dataset:
    ln -s /path/to/custom_dataset data/custom
    
  4. Process the dataset:
    python run.py --type custom
    
  5. Train:
    python train_net.py --cfg_file configs/custom.yaml train.batch_size 4
    
  6. Watch the training curve:
    tensorboard --logdir data/record/pvnet
    
  7. Visualize:
    python run.py --type visualize --cfg_file configs/custom.yaml
    
  8. Test:
    python run.py --type evaluate --cfg_file configs/custom.yaml
    

An example dataset can be downloaded at here.

Citation

If you find this code useful for your research, please use the following BibTeX entry.

@inproceedings{peng2019pvnet,
  title={PVNet: Pixel-wise Voting Network for 6DoF Pose Estimation},
  author={Peng, Sida and Liu, Yuan and Huang, Qixing and Zhou, Xiaowei and Bao, Hujun},
  booktitle={CVPR},
  year={2019}
}

Acknowledgement

This work is affliated with ZJU-SenseTime Joint Lab of 3D Vision, and its intellectual property belongs to SenseTime Group Ltd.

Copyright (c) ZJU-SenseTime Joint Lab of 3D Vision. All Rights Reserved.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

clean-pvnet's People

Contributors

dependabot[bot] avatar haotongl avatar jiamingsuen avatar pengsida avatar

Stargazers

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

Watchers

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

clean-pvnet's Issues

keyError 'CustomTrain' from dataset_catalog.py and TypeError: 'int' object is not iterable

Hello

There is an error in your code.

Traceback (most recent call last):
attrs = DatasetCatalog.dataset_attrs[name]
KeyError: 'CustomTrain'

https://github.com/zju3dv/clean-pvnet/blob/master/lib/datasets/dataset_catalog.py#L74

The corresponding code is missing.
'CustomTrain': {
'id': 'linemod',
'data_root': 'data/custom',
'ann_file': 'data/custom/train.json',
'split': 'train'
},

my command is = python train_net.py --cfg_file configs/linemod.yaml train.dataset CustomTrain test.dataset CustomTrain model tless_06 train.batch_size 8 eval_ep 20 train.epoch 201

Traceback (most recent call last):
File "train_net.py", line 67, in
main()
File "train_net.py", line 63, in main
train(cfg, network) # @ go line 28
File "train_net.py", line 37, in train
trainer.train(epoch, train_loader, optimizer, recorder) # Go to train --> lib - train - trainers - trainer.py
File "/home/hwanglab/PycharmProjects/clean-pvnet/lib/train/trainers/trainer.py", line 33, in train
for iteration, batch in enumerate(data_loader): # get Datasets from lib - datasets - tless_train - pvnet.py - def getitem
File "/home/hwanglab/anaconda3/envs/pvnet/lib/python3.6/site-packages/torch/utils/data/dataloader.py", line 582, in next
return self._process_next_batch(batch)
File "/home/hwanglab/anaconda3/envs/pvnet/lib/python3.6/site-packages/torch/utils/data/dataloader.py", line 608, in _process_next_batch
raise batch.exc_type(batch.exc_msg)
TypeError: Traceback (most recent call last):
File "/home/hwanglab/anaconda3/envs/pvnet/lib/python3.6/site-packages/torch/utils/data/_utils/worker.py", line 99, in _worker_loop
samples = collate_fn([dataset[i] for i in batch_indices])
File "/home/hwanglab/anaconda3/envs/pvnet/lib/python3.6/site-packages/torch/utils/data/_utils/worker.py", line 99, in
samples = collate_fn([dataset[i] for i in batch_indices])
File "lib/datasets/linemod/pvnet.py", line 41, in getitem
index, height, width = index_tuple
TypeError: 'int' object is not iterable

i'm having trouble using custom data.
I'd appreciate it if you could look at the code once.

thank you

david

Visualization

Could you please add the visualization about TLESS.
Very Thanks!

Training TIme

Can i ask how many gpus and what kind do you use in this new project?
And, how much time did it cost?
Thanks

Training is interrupted

Every 5:th epoch, training using command python train_net.py --cfg_file configs/tless/tless_01.yaml gets interrupted with RuntimeError from the ransac_voting_gpu.py file. Have you experienced this before? Do you know why it happens every fifth epoch?

eta: 0:00:18 epoch: 9 step: 4980 vote_loss: 0.0147 seg_loss: 0.0149 loss: 0.0296 data: 0.2134 batch: 0.5426 lr: 0.001000 max_mem: 2463
eta: 0:00:00 epoch: 9 step: 4999 vote_loss: 0.0141 seg_loss: 0.0147 loss: 0.0288 data: 0.2152 batch: 0.5443 lr: 0.001000 max_mem: 2463
eta: 0:00:00 epoch: 9 step: 5000 vote_loss: 0.0141 seg_loss: 0.0147 loss: 0.0289 data: 0.2197 batch: 0.5473 lr: 0.001000 max_mem: 2463
0%| | 0/2927 [00:00<?, ?it/s]
Traceback (most recent call last):
File "train_net.py", line 58, in
main()
File "train_net.py", line 54, in main
train(cfg, network)
File "train_net.py", line 35, in train
trainer.val(epoch, val_loader, evaluator, recorder)
File "/home/franswed/Documents/MastersThesis2020/clean-pvnet-master/lib/train/trainers/trainer.py", line 82, in val
output, loss, loss_stats, image_stats = self.network.module(batch)
File "/home/franswed/anaconda3/envs/pvnet2/lib/python3.7/site-packages/torch/nn/modules/module.py", line 493, in call
result = self.forward(*input, **kwargs)
File "lib/train/trainers/pvnet.py", line 16, in forward
output = self.net(batch['inp'])
File "/home/franswed/anaconda3/envs/pvnet2/lib/python3.7/site-packages/torch/nn/modules/module.py", line 493, in call
result = self.forward(*input, **kwargs)
File "lib/networks/pvnet/resnet18.py", line 94, in forward
self.decode_keypoint(ret)
File "lib/networks/pvnet/resnet18.py", line 69, in decode_keypoint
kpt_2d = ransac_voting_layer_v3(mask, vertex, 128, inlier_thresh=0.99, max_num=100)
File "/home/franswed/Documents/MastersThesis2020/clean-pvnet-master/lib/csrc/ransac_voting/ransac_voting_gpu.py", line 190, in ransac_voting_layer_v3
ATA=torch.matmul(normal.permute(0,2,1),normal) # [vn,2,2]
RuntimeError: cublas runtime error : the GPU program failed to execute at /pytorch/aten/src/THC/THCBlas.cu:450

pvnet-rendering

Am I correct in that you are not using rendered data for the training here, specifically in training custom dataset?

If you did not use rendered data, did it reproduce paper results on LINEMOD and related datasets?

t-less datasets pose ground truth

Thank you for your wonderful results and code sharing.

Currently, I want to proceed customer learning using tless dataset.
I saw the file t-less_01.yaml in your configs folder.

Therefore, I would like to ask you how you constructed the pose ground truth.
If you have sample ground truth for Tless 01, I would appreciate it if you could share it with me.

P.S I created a pose ground truth using the value of the gt.yml file given in the tless dataset. Is this the right way?

I'll wait for your reply.

Thank you.

KeyError: 'Non-existent config key: train.sampler'

Hi, thanks for your work. When I ran "python train_net.py --cfg_file configs/linemod.yaml model mycat cls_type cat", I met the followig error:

Traceback (most recent call last):
File "train_net.py", line 1, in
from lib.config import cfg, args
File "/home/yang/clean-pvnet-master/lib/config/init.py", line 1, in
from .config import cfg, args
File "/home/yang/clean-pvnet-master/lib/config/config.py", line 147, in
cfg = make_cfg(args)
File "/home/yang/clean-pvnet-master/lib/config/config.py", line 130, in make_cfg
cfg.merge_from_file(args.cfg_file)
File "/home/yang/anaconda3/envs/pvnet/lib/python3.6/site-packages/yacs/config.py", line 171, in merge_from_file
self.merge_from_other_cfg(cfg)
File "/home/yang/anaconda3/envs/pvnet/lib/python3.6/site-packages/yacs/config.py", line 175, in merge_from_other_cfg
_merge_a_into_b(cfg_other, self, self, [])
File "/home/yang/anaconda3/envs/pvnet/lib/python3.6/site-packages/yacs/config.py", line 401, in _merge_a_into_b
_merge_a_into_b(v, b[k], root, key_list + [k])
File "/home/yang/anaconda3/envs/pvnet/lib/python3.6/site-packages/yacs/config.py", line 392, in _merge_a_into_b
raise KeyError("Non-existent config key: {}".format(full_key))
KeyError: 'Non-existent config key: train.sampler'

I don't know how to solve it. And I am looking forward your reply. Thanks!

Can I get a webcam demo?

Thank you, your document is very useful to me.

I want to use your network through my webcam.

Can I get a webcam demo?

Custom Dataset Pose Format

From the example custom dataset, I see that for each image you need to have a 3x4 matrix with the pose saved in a numpy array. E.g. one of these arrays has the pose

[ -0.857243  ,  0.376382  , -0.351385  , -0.06970996],
[  0.499056  ,  0.775362  , -0.386984  , -0.0512582 ],
[  0.126797  , -0.5071      , -0.852509  ,  0.746117  ]

What is the format of this pose matrix (i.e. what does each of the entries mean)?

TLess dataset problem

Hello! I downloaded the repo, datasets and followed the installation guide here on the repo but do not manage to run the python train_net.py --cfg_file configs/tless/tless_01.yaml command. I attach the terminal output. Just like the error says there are missing files.

When pressing the 5:th link under the list of datasets it takes me to a list of 14 items and I chose the first i.e. "tlessaa". Do I need them all? Because the one I chose does not contain train_primesense which the code tries to execute.

Thanks in advance!

python train_net.py --cfg_file configs/tless/tless_01.yaml
loading annotations into memory...
Done (t=3.07s)
creating index...
index created!
lib/evaluators/tless_test/pvnet.py:42: YAMLLoadWarning: calling yaml.load() without Loader=... is deprecated, as the default Loader is unsafe. Please read https://msg.pyyaml.org/load for full details.
model_info = yaml.load(open(os.path.join(model_dir, 'models_info.yml')))
/home/franswed/anaconda3/envs/pvnet/lib/python3.7/site-packages/imgaug/imgaug.py:184: DeprecationWarning: Function ContrastNormalization() is deprecated. Use imgaug.contrast.LinearContrast instead.
warn_deprecated(msg, stacklevel=3)
loading annotations into memory...
Done (t=0.02s)
creating index...
index created!
loading annotations into memory...
Traceback (most recent call last):
File "train_net.py", line 57, in
main()
File "train_net.py", line 53, in main
train(cfg, network)
File "train_net.py", line 22, in train
train_loader = make_data_loader(cfg, is_train=True, max_iter=cfg.ep_iter)
File "/home/franswed/Documents/MastersThesis2020/clean-pvnet-master/lib/datasets/make_dataset.py", line 73, in make_data_loader
dataset = make_dataset(cfg, dataset_name, transforms, is_train)
File "/home/franswed/Documents/MastersThesis2020/clean-pvnet-master/lib/datasets/make_dataset.py", line 32, in make_dataset
dataset = dataset(**args)
File "lib/datasets/tless_train/pvnet.py", line 46, in init
self.other_obj_coco = COCO('data/tless/train_primesense/assets/train.json')
File "/home/franswed/anaconda3/envs/pvnet/lib/python3.7/site-packages/pycocotools/coco.py", line 84, in init
dataset = json.load(open(annotation_file, 'r'))
FileNotFoundError: [Errno 2] No such file or directory: 'data/tless/train_primesense/assets/train.json'

Question: Custom Test Data

Hello,

I would like to create a brand new custom dataset to test without the aruco markers around the object to understand generalization. I have been going through the code, and it seems like the custom.yaml file and the dataset catalog are the necessary files where I have to add / change.

I am also assuming for visualization / evaluation only inference is being done on a pre - trained model with a simple RGB image as the input.

After creating this dataset, and adding it to the dataset catalog, what details should I be aware of. For example do I need an ann file or a value for 'split'? Is is fine to assume that inference on a pretrained model would only require a RGB image?

Also, why does the inference line in these 2 functions differ?

def run_evaluate():
.......
output = network(inp)

def run_visualize():
.........
output = network(batch['inp'], batch)

KeyError: 'mask'

Thank you so much for sharing the code and model for tless.
While training tless dataset, i am facing this error. Could you please help me with this?

Traceback (most recent call last):
File "train_net.py", line 57, in
main()
File "train_net.py", line 53, in main
train(cfg, network)
File "train_net.py", line 35, in train
trainer.val(epoch, val_loader, evaluator, recorder)
File "/datasets/Mahesh_kashyap/pvnet-clean/clean-pvnet/lib/train/trainers/trainer.py", line 82, in val
output, loss, loss_stats, image_stats = self.network(batch)
File "/home/belakavadi/anaconda3/envs/pvnet/lib/python3.7/site-packages/torch/nn/modules/module.py", line 493, in call
result = self.forward(*input, **kwargs)
File "/home/belakavadi/anaconda3/envs/pvnet/lib/python3.7/site-packages/torch/nn/parallel/data_parallel.py", line 152, in forward
outputs = self.parallel_apply(replicas, inputs, kwargs)
File "/home/belakavadi/anaconda3/envs/pvnet/lib/python3.7/site-packages/torch/nn/parallel/data_parallel.py", line 162, in parallel_apply
return parallel_apply(replicas, inputs, kwargs, self.device_ids[:len(replicas)])
File "/home/belakavadi/anaconda3/envs/pvnet/lib/python3.7/site-packages/torch/nn/parallel/parallel_apply.py", line 83, in parallel_apply
raise output
File "/home/belakavadi/anaconda3/envs/pvnet/lib/python3.7/site-packages/torch/nn/parallel/parallel_apply.py", line 59, in _worker
output = module(*input, **kwargs)
File "/home/belakavadi/anaconda3/envs/pvnet/lib/python3.7/site-packages/torch/nn/modules/module.py", line 493, in call
result = self.forward(*input, **kwargs)
File "lib/train/trainers/pvnet.py", line 24, in forward
weight = batch['mask'][:, None].float()
KeyError: 'mask'

Regards,
Mahesh

AssertionError: Non-existent Key: train.dataset

感谢作者提供的干净版本的pvnet! 当我运行了python run.py --type visualize --cfg_file configs/linemod.yaml train.datset CustomTrain test.dataset CustomTrain model mycat这个以后,出现了这种error, AssertionError: Non-existent Key: train.dataset,该如何解决呢?

Fatal IO error: client killed

I made Azure-kinect demo file. This file worked normally on my computer(Ubuntu 18.04, RTX 2080 Ti, CUDA 10.1)

https://hyu-my.sharepoint.com/:u:/g/personal/wdrac331_hanyang_ac_kr/EY7ODSE0DL5EoEK150cIW-IBAN71KNMlcMqjK1MP2kFdTw?e=82MTHR

However, an error occurs 20 to 30 seconds after operation.
The following is the error information.


[xcb] Unknown request in queue while dequeuing
[xcb] Most likely this is a multi-threaded client and XInitThreads has not been called
[xcb] Aborting, sorry about that.
python3: ../../src/xcb_io.c:165: dequeue_pending_request: Assertion
`!xcb_xlib_unknown_req_in_deq' failed.
: Fatal IO error: client killed

Have you ever seen such an error?

Custom Dataset Training

Hello,

I have created a custom dataset (the dataset is in the exact format as the linemod dataset). These are some errors I am facing when running:

python run.py --type custom

Error 1
Traceback (most recent call last):
File "run.py", line 226, in
globals()'run_'+args.type
File "run.py", line 222, in run_custom
handle_custom_dataset.custom_to_coco(data_root)
File "/home/ubuntu/clean-pvnet/tools/handle_custom_dataset.py", line 89, in custom_to_coco
renderer = OpenGLRenderer(model_path)
File "/home/ubuntu/clean-pvnet/lib/utils/linemod/opengl_renderer.py", line 21, in init
self.model = self.load_ply(self.ply_path)
File "/home/ubuntu/clean-pvnet/lib/utils/linemod/opengl_renderer.py", line 42, in load_ply
line = f.readline().rstrip('\n').rstrip('\r') # Strip the newline character(s)
File "/home/ubuntu/anaconda3/envs/pvnet/lib/python3.7/codecs.py", line 322, in decode

UnicodeDecodeError: 'utf-8' codec can't decode byte 0xf3 in position 292: invalid continuation byte

I was able to bypass this error by running the code on a Python 2 environment and saving the dictionary into a .npz file then manually loading the dictionary in the python 3 environment. But essentially the function in opengl_renderer.py ---- def load_ply(self, ply_path): only works in a python 2 environment.

Error 2 (Currently stuck on)
When running the train command:

python train_net.py --cfg_file configs/linemod.yaml train.dataset CustomTrain test.dataset CustomTrain model mycat train.batch_size 4

I get this error: FileNotFoundError: [Errno 2] No such file or directory: 'data/linemod/cat/cat.ply'

But I am not trying to use a cat, I have my own .ply file called model.ply which is stored in the directory structure mentioned in the repo like below:

├── /path/to/dataset
│ ├── model.ply
│ ├── camera.txt
│ ├── rgb/
│ │ ├── 0.jpg
│ │ ├── ...
│ │ ├── 1234.jpg
│ │ ├── ...
│ ├── mask/
│ │ ├── 0.png
│ │ ├── ...
│ │ ├── 1234.png
│ │ ├── ...
│ ├── pose/
│ │ ├── 0.npy
│ │ ├── ...
│ │ ├── 1234.npy
│ │ ├── ...
│ │ └──

Any information is greatly appreciated.

What is the format of camera.txt in custom dataset ?

What is the format of camera.txt in custom dataset ?
Organize the dataset as the following structure:
├── /path/to/dataset
│ ├── model.ply
│ ├── camera.txt
│ ├── rgb/
│ │ ├── 0.jpg
│ │ ├── ...
│ │ ├── 1234.jpg
│ │ ├── ...
│ ├── mask/
│ │ ├── 0.png
│ │ ├── ...
│ │ ├── 1234.png
│ │ ├── ...
│ ├── pose/
│ │ ├── 0.npy
│ │ ├── ...
│ │ ├── 1234.npy
│ │ ├── ...
│ │ └──

And I'd like to see an eample of this camera.txt. there's no such file camera.txt In LINEMOD dataset

No CUDA runtime is found

I am getting the error below, but I have double checked and the cuda-9.0 does exist in the specified usr/local directory. I am following the exact setup directions as listed on a Ubuntu machine 16.04

No CUDA runtime is found, using CUDA_HOME='/usr/local/cuda-9.0'
/usr/local/cuda-9.0
Traceback (most recent call last):
File "setup.py", line 64, in
ext_modules=get_extensions(),
File "setup.py", line 41, in get_extensions
raise NotImplementedError('Cuda is not availabel')
NotImplementedError: Cuda is not availabel

Model output segmentation classes & ver_dim - LINEMOD

Hi,
From what I have observed from the code, every class has separate models, which seems contradicting to the paper. Can you please explain this if I have understood correctly?

Why there is separate model for each class instead of 1 model ?

Assuming there are C classes of objects and K keypoints for each class, PVNet takes as input the H × W × 3 image, processes it with a fully convolutional architecture, and outputs the H ×W ×(K ×2×C) tensor representing unit vectors and H×W ×(C+1) tensor representing class probabilities.

Moreover, for LineMOD ver_dim is taken as 18. Should it not be 8*2 = 16, for K = 8 key points.

Thnaks.

About tless dataset

Hi,thanks your perfect work.
I want to know "when you use TLESS dataset, how did you settle the original dataset?" Can I use the same way like the custom dataset to handle the TLESS dataset?
Thanks!

mask problem in ransac voting gpu

When i try to visualize, after this

loading annotations into memory...
Done (t=0.03s)
creating index...
index created!
loading annotations into memory...
Done (t=0.05s)
creating index...
index created!

comes error:

sac_voting/ransac_voting_gpu.py", line 135, in ransac_voting_layer_v3
    cur_mask *= selected_mask
RuntimeError: expected device cuda:0 and dtype Byte but got device cuda:0 and dtype Bool

Error in `python': free(): invalid pointer: 0x000055e1deea4028 *** Aborted (core dumped)

sorry to bother you , when i run the command python run.py --type evaluate --cfg_file configs/linemod.yaml model cat test.icp True, i come across the following error " Error in `python': free(): invalid pointer: 0x000055e1deea4028 *** Aborted (core dumped)", and i find the "evaluator = imp.load_source(module, path).Evaluator(cfg.result_dir)" code cause the problem. Can you help me, very thanks.

RuntimeError: solve_cuda: For batch 0: U(1,1) is zero, singular U

我用pvnet在我自己的小数据集上进行训练,然后进行预测。在ransac_voting阶段,经常碰到RuntimeError: solve_cuda: For batch 0: U(1,1) is zero, singular U 这个错误
错误发生在这里
def b_inv(b_mat): ''' code from https://stackoverflow.com/questions/46595157/how-to-apply-the-torch-inverse-function-of-pytorch-to-every-sample-in-the-batc :param b_mat: :return: ''' eye = b_mat.new_ones(b_mat.size(-1)).diag().expand_as(b_mat) b_inv, _ = torch.solve(eye, b_mat) return b_inv
请问有什么解决办法吗

torch 1.3.1
torchvision 0.4.2
windows10系统

Can i run inference on a CPU, without a gpu?

I copied all the compiled file directories (which successfully runs inference on the aws gpu instance) onto to my local machine. But when, I run the visualize command on my cpu, I am getting the error below. Do I need a GPU to run inference ? My goal is to build a real time functioning pose estimator using a real sense camera to visualize the pose in real time. It would be difficult to build this from a remote aws instance.

File "run.py", line 91, in run_visualize
network = make_network(cfg)#.cuda()
File "/Users/ishangupta/Documents/Python_Projects/pose-demo/aws-clean-pvnet/clean-pvnet/lib/networks/make_network.py", line 34, in make_network
return imp.load_source(module, path).get_network(cfg)
File "/Users/ishangupta/.pyenv/versions/3.7.0/lib/python3.7/imp.py", line 172, in load_source
module = _load(spec)
File "", line 696, in _load
File "", line 677, in _load_unlocked
File "", line 728, in exec_module
File "", line 219, in _call_with_frames_removed
File "lib/networks/pvnet/init.py", line 1, in
from .resnet18 import get_res_pvnet
File "lib/networks/pvnet/resnet18.py", line 5, in
from lib.csrc.ransac_voting.ransac_voting_gpu import ransac_voting_layer, ransac_voting_layer_v3
File "/Users/ishangupta/Documents/Python_Projects/pose-demo/aws-clean-pvnet/clean-pvnet/lib/csrc/ransac_voting/ransac_voting_gpu.py", line 2, in
import lib.csrc.ransac_voting.ransac_voting as ransac_voting
ModuleNotFoundError: No module named 'lib.csrc.ransac_voting.ransac_voting'

run_custom() is missing from run.py

I have a custom dataset for which I would like to run through Clean-pvnet. I am following the instructions to run the run.py command for the custom dataset. I get the error below. I looked through the code for run.py and run_custom() function does not exist. Any information is greatly appreciated.

Traceback (most recent call last):
File "run.py", line 219, in
globals()'run_'+args.type
KeyError: 'run_custom'

Use in a multi-object setting

Hi,

thank you for your great work!

I noticed that here you suggested a few modifications to be done to the code to make it work in a multi-object setting.

I am interested in training a single network with samples containing multiple objects (with different class), can you give me a few hints about which parts of the network architecture should be modified to adapt it to this case?

About diameter

Thank you for sharing your amazing research.

I wonder how you got the Diameter of the Linemod dataset you saved in advance.

If you have a code, I'd appreciate it if you could share it.

cheers

David

Visualization saving

Hello,

I have successfully completed training of the model; thank you for your support in that. I am running the code on an AWS instance; I am unable to view the visualization. Where would be the proper file to insert code to save the plots into a directory?

Would it be here?

def visualize(self, output, batch):

The same thing for evaluate, where would be the file where I can alter it to save the evaluations to a file, because I am unable to view anything in a remote cluster.

lib.ransac_voting error

hello,

I followed the steps and now trying to test the model with the command:
python run.py --type evaluate --cfg_file configs/linemod.yaml model cat

But I got an error as :
ModuleNotFoundError: No module named 'lib.csrc.ransac_voting.ransac_voting'

As I have already setup the 'ransac_voting' with no error. Can I get any advice about why is this happening?

About the pvnet

For the command "conda create -n pvnet python=3.7", is pvnet a package that we need to download first ?
Thank you

Realtime demo

感谢作者的分享!
请问作者如何用训练出来的weight 来实时(Realtime)检测object的pose呢?
例如像主页里发布的Real-time-demo视频一样,可以在编码上稍微指点一下实时检测物体位姿的部分吗?
期待作者的回复,谢谢!

Loading Pre-trained custom model

I am following the project structure and the custom.yaml file, I would like to load the pre trained model myself. Before loading the model, I would need to instantiate the class like this below:

model = TheModelClass(*args, **kwargs)

According to the custom.yaml file; the 'task' is pvnet, but the network is res.
clean-pvnet/lib/networks/pvnet

Which class network would the appropriate one to use when loading the custom model in pytorch?

Would it be this one: Resnet18?
https://github.com/zju3dv/clean-pvnet/blob/07e7c09e80cde938e013d8bc2880605add33a0ce/lib/networks/pvnet/resnet18.py

Or this one: PoseResNet?
https://github.com/zju3dv/clean-pvnet/blob/07e7c09e80cde938e013d8bc2880605add33a0ce/lib/networks/resnet.py

My end goal is to just take my pretrained model that I trained; and create a brand new inference code pipeline, where I can customize it with my own usecase.

Could not reproduce paper results

Hi,

I tried to train your network on the Ape object. So I ran the command :
python train_net.py --cfg_file configs/linemod.yaml model ape cls_type ape but after 200 epochs I cannot find the same results than you. I followed every steps of your tutorial.

Regards

Sorry, i want to ask some questions about custom data

I saw your command which is like this
python run.py --type evaluate --cfg_file configs/linemod.yaml train.dataset CustomTrain test.dataset CustomTrain model mycat
On your custom object, you alaways use the CustomTrain on the train.dataset and test.dataset.Does it mean that you use the same data on traning and testing? Thanks you.

python setup.py build_ext --inplace

when I compiled "cd ../nn python setup.py build_ext --inplace",I met some problems".
1.gcc: error: /usr/local/cuda-9.0/lib64/libcudart.so: No such file or directory
So, I found my cuda is 10.0.130, and I change <setup.py>-cuda 9.0 to cuda 10.0.
Then, I met the problem2 again

2.In file included from tmpxft_00001f84_00000000-4_nearest_neighborhood.cudafe1.stub.c:1:0:
/tmp/tmpxft_00001f84_00000000-4_nearest_neighborhood.cudafe1.stub.c: In function ‘void __device_stub__Z27findNearestPoint3DIdxKernelPfS_Piiiii(float*, float*, int*, int, int, int, int)’:
/tmp/tmpxft_00001f84_00000000-4_nearest_neighborhood.cudafe1.stub.c:11:153: error: ‘__args_arr’ was not declared in this scope
_par1, int __par2, int __par3, int __par4, int __par5, int __par6){__cudaSetup
^
/tmp/tmpxft_00001f84_00000000-4_nearest_neighborhood.cudafe1.stub.c:11:164: error: ‘__args_idx’ was not declared in this scope
__par2, int __par3, int __par4, int __par5, int __par6){_cudaSetupArgSimple(
^
In file included from tmpxft_00001f84_00000000-4_nearest_neighborhood.cudafe1.stub.c:1:0:
/tmp/tmpxft_00001f84_00000000-4_nearest_neighborhood.cudafe1.stub.c: In function ‘void __device_stub__Z27findNearestPoint2DIdxKernelPfS_Piiiii(float
, float
, int*, int, int, int, int)’:
/tmp/tmpxft_00001f84_00000000-4_nearest_neighborhood.cudafe1.stub.c:1:162: error: ‘__args_arr’ was not declared in this scope
/tmp/tmpxft_00001f84_00000000-4_nearest_neighborhood.cudafe1.stub.c:1:173: error: ‘__args_idx’ was not declared in this scope
generating ./_ext.c
(already up-to-date)
the current directory is '/home/yang/clean-pvnet-master/lib/csrc/nn'
running build_ext
building '_ext' extension
gcc -pthread -B /home/yang/anaconda3/envs/pvnet/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/home/yang/anaconda3/envs/pvnet/include/python3.6m -c _ext.c -o ./_ext.o
gcc -pthread -shared -B /home/yang/anaconda3/envs/pvnet/compiler_compat -L/home/yang/anaconda3/envs/pvnet/lib -Wl,-rpath=/home/yang/anaconda3/envs/pvnet/lib -Wl,--no-as-needed -Wl,--sysroot=/ ./_ext.o src/nearest_neighborhood.cu.o /usr/local/cuda-10.0/lib64/libcudart.so -lstdc++ -o ./_ext.cpython-36m-x86_64-linux-gnu.so

Must I use cuda9.0?

Tless renderings for training

Hi! I'm currently training the network on the prepared Tless dataset and have a question about the renderings.

As I've understood it you add renderings to the training data as well which can be found in /data/tless/renders. I noticed however that there are no renderings for some of the objects in the dataset. Is this correct or have I failed a step where they were supposed to be added?
yes

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.