Fix original size
Signed-off-by: Micaela Verucchi <micaelaverucchi@gmail.com>
This commit is contained in:
@@ -30,7 +30,7 @@ class DetectionNN {
|
||||
tk::dnn::NetworkRT *netRT = nullptr;
|
||||
dnnType *input_d;
|
||||
|
||||
cv::Size originalSize;
|
||||
std::vector<cv::Size> originalSize;
|
||||
|
||||
cv::Scalar colors[256];
|
||||
|
||||
@@ -103,13 +103,14 @@ class DetectionNN {
|
||||
if(cur_batches > nBatches)
|
||||
FatalError("A batch size greater than nBatches cannot be used");
|
||||
|
||||
originalSize.clear();
|
||||
if(VERBOSE) printCenteredTitle(" TENSORRT detection ", '=', 30);
|
||||
{
|
||||
TIMER_START
|
||||
for(int bi=0; bi<cur_batches;++bi){
|
||||
if(!frames[bi].data)
|
||||
FatalError("No image data feed to detection");
|
||||
originalSize = frames[bi].size();
|
||||
originalSize.push_back(frames[bi].size());
|
||||
preprocess(frames[bi], bi);
|
||||
}
|
||||
TIMER_STOP
|
||||
|
||||
@@ -127,7 +127,7 @@ void CenternetDetection::preprocess(cv::Mat &frame, const int bi){
|
||||
// auto start_t = std::chrono::steady_clock::now();
|
||||
// auto step_t = std::chrono::steady_clock::now();
|
||||
// auto end_t = std::chrono::steady_clock::now();
|
||||
cv::Size sz = originalSize;
|
||||
cv::Size sz = originalSize[bi];
|
||||
// std::cout<<"image: "<<sz.width<<", "<<sz.height<<std::endl;
|
||||
cv::Size sz_old;
|
||||
float scale = 1.0;
|
||||
|
||||
@@ -256,8 +256,8 @@ void MobilenetDetection::postprocess(const int bi, const bool mAP){
|
||||
checkCuda(cudaMemcpy(locations_h, rt_out[1], N_COORDS * nPriors * sizeof(float), cudaMemcpyDeviceToHost));
|
||||
convert_locatios_to_boxes_and_center();
|
||||
|
||||
int width = originalSize.width;
|
||||
int height = originalSize.height;
|
||||
int width = originalSize[bi].width;
|
||||
int height = originalSize[bi].height;
|
||||
|
||||
float *conf_per_class;
|
||||
for (int i = 1; i < classes; i++){
|
||||
|
||||
@@ -94,8 +94,8 @@ void Yolo3Detection::postprocess(const int bi, const bool mAP){
|
||||
for(int i=0; i<netRT->pluginFactory->n_yolos; i++)
|
||||
rt_out[i] = (dnnType*)netRT->buffersRT[i+1] + netRT->buffersDIM[i+1].tot()*bi;
|
||||
|
||||
float x_ratio = float(originalSize.width) / float(netRT->input_dim.w);
|
||||
float y_ratio = float(originalSize.height) / float(netRT->input_dim.h);
|
||||
float x_ratio = float(originalSize[bi].width) / float(netRT->input_dim.w);
|
||||
float y_ratio = float(originalSize[bi].height) / float(netRT->input_dim.h);
|
||||
|
||||
// compute dets
|
||||
nDets = 0;
|
||||
|
||||
Reference in New Issue
Block a user