Skip to content
Snippets Groups Projects
Unverified Commit 65264596 authored by yinchimaoliang's avatar yinchimaoliang Committed by GitHub
Browse files

Add ply doc (#41)

* Add ply convert

* Change example.

* Change shell to python.
parent eb5a66ec
No related branches found
No related tags found
No related merge requests found
...@@ -213,7 +213,29 @@ Examples: ...@@ -213,7 +213,29 @@ Examples:
```shell ```shell
python demo/pcd_demo.py demo/kitti_000008.bin configs/second/hv_second_secfpn_6x8_80e_kitti-3d-car.py checkpoints/hv_second_secfpn_6x8_80e_kitti-3d-car_20200620_230238-393f000c.pth python demo/pcd_demo.py demo/kitti_000008.bin configs/second/hv_second_secfpn_6x8_80e_kitti-3d-car.py checkpoints/hv_second_secfpn_6x8_80e_kitti-3d-car_20200620_230238-393f000c.pth
``` ```
If you want to input a `ply` file, you can use the following function and convert it to `bin` format. Then you can use the converted `bin` file to generate demo.
Note that you need to install pandas and plyfile before using this script. This function can also be used for data preprocessing for training ```ply data```.
```python
import numpy as np
import pandas as pd
from plyfile import PlyData
def conver_ply(input_path, output_path):
plydata = PlyData.read(input_path) # read file
data = plydata.elements[0].data # read data
data_pd = pd.DataFrame(data) # convert to DataFrame
data_np = np.zeros(data_pd.shape, dtype=np.float) # initialize array to store data
property_names = data[0].dtype.names # read names of properties
for i, name in enumerate(
property_names): # read data by property
data_np[:, i] = data_pd[name]
data_np.astype(np.float32).tofile(output_path)
```
Examples:
```python
convert_ply('./test.ply', './test.bin')
```
### High-level APIs for testing point clouds ### High-level APIs for testing point clouds
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment