This is an implementation of PoseCNN for 6D pose estimation on PROPSP dataset
We tested the codes on
PyTorch version: 2.3.1
CUDA version: 12.1
Ubuntu 22.04
GeForce RTX 4070 and 4090
The project requires the following Python libraries and versions:
| Package | Version | Description |
|---|---|---|
matplotlib |
3.7.2 |
For plotting and visualization. |
numpy |
1.24.3 |
Fundamental package for numerical computations. |
Pillow |
11.0.0 |
Library for working with image processing tasks. |
pyrender |
0.1.45 |
Rendering 3D scenes for visualization. |
torch |
2.3.1 |
PyTorch library for deep learning. |
torchvision |
0.18.1 |
PyTorch's library for vision-related tasks. |
tqdm |
4.66.4 |
For creating progress bars in scripts. |
trimesh |
4.4.3 |
For loading and working with 3D triangular meshes. |
You can install the required dependencies using the requirements.txt file:
pip install -r requirements.txt
To use this project, you need to download the required dataset and extract it to the root path of the project.
-
Download the Dataset:
- Download the dataset from the following link:
PROPS-Pose-Dataset
- Download the dataset from the following link:
-
Place the Dataset:
- Move the downloaded file
PROPS-Pose-Dataset.tar.gzto the root directory of the project.
- Move the downloaded file
-
Extract the Dataset:
- Use the following command to extract the dataset:
tar -xvzf PROPS-Pose-Dataset.tar.gz
- This will create a folder named
PROPS-Pose-Datasetin the root directory.
- Use the following command to extract the dataset:
-
Verify the Dataset Structure:
- Ensure the folder structure matches the following:
PROPS-Pose-Dataset/ ├── train/ │ ├── rgb/ │ ├── depth/ │ ├── mask_visib/ │ ├── train_gt.json │ ├── train_gt_info.json ├── val/ │ ├── rgb/ │ ├── depth/ │ ├── mask_visib/ │ ├── val_gt.json │ ├── val_gt_info.json ├── model/ ├── 1_master_chef_can/ ├── ...
- Ensure the folder structure matches the following:
-
Set Dataset Path in Code:
- The project will automatically locate the dataset in
PROPS-Pose-Datasetunder the root path during execution. Ensure this directory exists before running the code.
- The project will automatically locate the dataset in
To train the model, run the train.py script:
python train.pyTo visualize the results, follow these steps to set up and run the inference.py script:
-
Download Pretrained Weights:
- Download the pretrained model weights from the following link:
PoseCNN Pretrained Weights
- Download the pretrained model weights from the following link:
-
Place the Weights:
- Save the downloaded weights file (e.g.,
posecnn_weights.pth) to your desired directory.
- Save the downloaded weights file (e.g.,
-
Set the Weights Path in Code:
- Open the
inference.pyscript and locate the following line:posecnn_model.load_state_dict(torch.load(os.path.join("your weight here")))
- Replace
"your weight here"with the path to your weights file. For example:posecnn_model.load_state_dict(torch.load(os.path.join("models/posecnn_weights.pth")))
- Open the
-
Run the Inference Script:
- Execute the script to visualize predictions:
python inference.py
- Execute the script to visualize predictions: