Fix the sorting kernels used in the CenterNet pre and post-processing.
This commit moves the kernels in the correct sub-directory. It creates new header file for Thrust kernels. It splits the kernels into two files: 'normalize.cu' contains CenterNet pre-processing operations, 'postprocessing.cu' contains the CenterNet post-processing operations. Signed-off-by: Davide Sapienza <sapienza.dav@gmail.com>
This commit is contained in:
@@ -0,0 +1,16 @@
|
||||
#include "kernelsThrust.h"
|
||||
|
||||
__global__
|
||||
void normalize_kernel(float *bgr, const int dim, const float *mean, const float *stddev){
|
||||
int i = blockDim.x*blockIdx.x + threadIdx.x;
|
||||
int j = blockIdx.y;
|
||||
bgr[j*(dim)+i] = bgr[j*(dim)+i] - mean[j];
|
||||
bgr[j*(dim)+i] = bgr[j*(dim)+i] / stddev[j];
|
||||
|
||||
}
|
||||
|
||||
void normalize(float *bgr, const int ch, const int h, const int w, const float *mean, const float *stddev){
|
||||
int num_thread = 256;
|
||||
dim3 dimBlock(h*w/num_thread, ch);
|
||||
normalize_kernel<<<dimBlock, num_thread, 0>>>(bgr, h*w, mean, stddev);
|
||||
}
|
||||
Reference in New Issue
Block a user