Comments (4)
BirdViewMap::BirdViewMap()
{
params_ = std::make_shared();
cudaMalloc((void**)&cnt_gpu_, params_->bev_size_ * sizeof(int));
cudaMalloc((void**)&bev_gpu_, params_->bev_size_ * 3 * sizeof(float));
}
BirdViewMap::~BirdViewMap()
{
cudaFree(cnt_gpu_);
cudaFree(bev_gpu_);
}
global void cuda_range_filter(float* pc, float min_x, float max_x,
float min_y, float max_y, float min_z, float max_z, int points_num)
{
int id = blockDim.x * blockIdx.x + threadIdx.x;
if(id >= points_num)
{
return ;
}
if(pc[id*4] <= min_x || pc[id*4] >= max_x
|| pc[id*4+1] <= min_y || pc[id*4+1] >= max_y
|| pc[id*4+2] <= min_z || pc[id*4+2] >= max_z)
{
pc[id*4] = 0;
pc[id*4+1] = 0;
pc[id*4+2] = 0;
pc[id*4+3] = 0;
}
}
global void cuda_generate_info(float* pc,
float xgrid, float ygrid, float xoffset, float yoffset, float z_min, float z_size,
float* bev_map, int bev_height, int bev_width, int bev_size, int* cnt, int points_num)
{
int id = blockDim.x * blockIdx.x + threadIdx.x;
if(id >= points_num)
{
return ;
}
if(0 == pc[id * 4] && 0 == pc[id * 4 + 1]
&& 0 == pc[id4+2] && 0 == pc[id4+3])
{
return ;
}
int x = __float2int_rd(floorf(pc[id * 4] / xgrid) + xoffset);
int y = __float2int_rd(floorf(pc[id * 4 + 1] / ygrid) + yoffset);
if(x >= bev_height || y >= bev_width)
{
return ;
}
int map_id = x * bev_width + y;
float intensity = (pc[id * 4 + 3] / 255.0f);
float zcoor = (pc[id * 4 + 2] - z_min) / z_size;
atomicAdd(bev_map+map_id, intensity);
atomicAdd(bev_map+bev_size+map_id, zcoor);
atomicAdd(cnt+map_id, (int)1);
}
global void cuda_generate_bev(float* bev_map,
int* cnt, float max_unique, int bev_size)
{
int id = blockDim.x * blockIdx.x + threadIdx.x;
if(id >= bev_size)
{
return ;
}
int max_cnt = max(1, cnt[id]);
float zcoor = bev_map[id+bev_size] / (float)max_cnt;
float intensity = bev_map[id] / (float)max_cnt;
float rate = logf((float)cnt[id] + 1.0f) / logf(max_unique);
float map_rate = min(1.0f, rate);
bev_map[bev_size*2+id] = map_rate;
bev_map[bev_size+id] = zcoor;
bev_map[id] = intensity;
}
void BirdViewMap::make_bev_map(float* points_gpu, int points_num)
{
cudaMemset(cnt_gpu_, 0, params_->bev_size_ * sizeof(int));
cudaMemset(bev_gpu_, 0, params_->bev_size_ * 3 * sizeof(float));
printf("%f, %f, %f, %f\n", params_->bound_grid_x_, params_->bound_grid_y_,
(float)params_->offset_x_, (float)params_->offset_y_);
dim3 thread1d; dim3 block1d; thread1d.x = 1024;
block1d.x = (points_num + thread1d.x - 1) / thread1d.x;
cuda_range_filter<<<block1d, thread1d>>>(points_gpu, params_->bound_min_x_, params_->bound_max_x_,
params_->bound_min_y_, params_->bound_max_y_, params_->bound_min_z_, params_->bound_max_z_, points_num);
cudaDeviceSynchronize();
cuda_generate_info<<<block1d, thread1d>>>(points_gpu, params_->bound_grid_x_, params_->bound_grid_y_,
(float)params_->offset_x_, (float)params_->offset_y_, params_->bound_min_z_, params_->bound_size_z_,
bev_gpu_, params_->bev_height_, params_->bev_width_, params_->bev_size_, cnt_gpu_, points_num);
cudaDeviceSynchronize();
block1d.x = (params_->bev_size_ + thread1d.x - 1) / thread1d.x;
cuda_generate_bev<<<block1d, thread1d>>>(bev_gpu_, cnt_gpu_, (float)params_->max_unique_, params_->bev_size_);
cudaDeviceSynchronize();
}
from sfa3d.
你好,我有两个问题向您请教:
1.这个改进可以提高精度吗?看代码没有太看懂,可以简单说一下思路吗?
2.第二部分代码是在用cuda加速第一部分吗?
from sfa3d.
你好,我有两个问题向您请教:
1.这个改进可以提高精度吗?看代码没有太看懂,可以简单说一下思路吗?
2.第二部分代码是在用cuda加速第一部分吗?
yep, speed first one
from sfa3d.
请问您有遇到val_loss曲线先下降后上升的情况吗,如下图:
我并没有改作者的代码,也没有改参数,可是训练出来的模型效果远远不如作者提供的预训练模型(用kitti数据集),请问您可以给我提供一些建议使它work吗?
from sfa3d.
Related Issues (20)
- Can you tell me more about what 3D-Object-Detection Architecture that you have used and what part in this git? I am still not clear when reading your README file HOT 2
- Cannot get detections on VLP 16 lidar data HOT 1
- 2D pcd file testing HOT 3
- core ml HOT 1
- corners_int is not int type HOT 1
- Data Augmentation
- what is mean by hm_name, hm_mc, hm_out?
- qt.qpa.xcb: could not connect to display
- [Solved] Problem when running it with GPU
- Train without intensity
- TypeError: Descriptors cannot not be created directly
- Train on my datasets, but performance is poor. HOT 2
- classnames.txt file? HOT 1
- ros node /image_rects no launch
- Pointcloud doesn't fit in the image
- How to measure the precision and accuracy of the model ?
- Data Augmentation Issue in Random Scaling
- Pitch and roll prediction feature request HOT 3
- can we make the algorithm such a way so that it only takes point cloud for training and not images
- what is lidar_aug in kiitti_dataset.py in KittiDataset class?
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from sfa3d.