Skip to content

Commit 5ee4fcb

Browse files
committed
Code style refactoring
1 parent d715b0a commit 5ee4fcb

6 files changed

Lines changed: 17 additions & 20 deletions

File tree

src/Detector/OCVDNNDetector.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@ void OCVDNNDetector::Detect(const cv::UMat& colorFrame)
227227
[](const CRegion& reg) { return reg.m_brect; },
228228
[](const CRegion& reg) { return reg.m_confidence; },
229229
[](const CRegion& reg) { return reg.m_type; },
230-
0, 0.f);
230+
0, static_cast<track_t>(0));
231231
}
232232

233233
///

src/Detector/YoloDarknetDetector.cpp

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -162,11 +162,11 @@ void YoloDarknetDetector::Detect(const cv::UMat& colorFrame)
162162

163163
if (crops.size() > 1 || m_batchSize > 1)
164164
{
165-
nms3<CRegion>(tmpRegions, m_regions, 0.4f,
165+
nms3<CRegion>(tmpRegions, m_regions, static_cast<track_t>(0.4),
166166
[](const CRegion& reg) { return reg.m_brect; },
167167
[](const CRegion& reg) { return reg.m_confidence; },
168168
[](const CRegion& reg) { return reg.m_type; },
169-
0, 0.f);
169+
0, static_cast<track_t>(0));
170170
//std::cout << "nms for " << tmpRegions.size() << " objects - result " << m_regions.size() << std::endl;
171171
}
172172
}
@@ -324,7 +324,6 @@ void YoloDarknetDetector::Detect(const std::vector<cv::UMat>& frames, std::vecto
324324
{
325325
Detect(frames[0]);
326326
regions[0] = m_regions;
327-
328327
}
329328
else
330329
{
@@ -351,11 +350,11 @@ void YoloDarknetDetector::Detect(const std::vector<cv::UMat>& frames, std::vecto
351350
tmpRegions.emplace_back(cv::Rect(cvRound(wk * bbox.x), cvRound(hk * bbox.y), cvRound(wk * bbox.w), cvRound(hk * bbox.h)), T2T(bbox.obj_id), bbox.prob);
352351
}
353352

354-
nms3<CRegion>(tmpRegions, regions[i], 0.4f,
353+
nms3<CRegion>(tmpRegions, regions[i], static_cast<track_t>(0.4),
355354
[](const CRegion& reg) { return reg.m_brect; },
356355
[](const CRegion& reg) { return reg.m_confidence; },
357356
[](const CRegion& reg) { return reg.m_type; },
358-
0, 0.f);
357+
0, static_cast<track_t>(0));
359358
}
360359

361360
m_regions.assign(std::begin(regions.back()), std::end(regions.back()));

src/Detector/YoloTensorRTDetector.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -201,8 +201,8 @@ void YoloTensorRTDetector::Detect(const cv::UMat& colorFrame)
201201
std::vector<cv::Rect> crops = GetCrops(m_maxCropRatio, m_detector->GetInputSize(), colorMat.size());
202202
//std::cout << "Image on " << crops.size() << " crops with size " << crops.front().size() << ", input size " << m_detector->GetInputSize() << ", batch " << m_batchSize << ", frame " << colorMat.size() << std::endl;
203203
regions_t tmpRegions;
204-
std::vector<cv::Mat> batch;
205-
batch.reserve(m_batchSize);
204+
std::vector<cv::Mat> batch;
205+
batch.reserve(m_batchSize);
206206
for (size_t i = 0; i < crops.size(); i += m_batchSize)
207207
{
208208
size_t batchSize = std::min(static_cast<size_t>(m_batchSize), crops.size() - i);
@@ -212,7 +212,7 @@ void YoloTensorRTDetector::Detect(const cv::UMat& colorFrame)
212212
batch.emplace_back(colorMat, crops[i + j]);
213213
}
214214
std::vector<tensor_rt::BatchResult> detects;
215-
m_detector->Detect(batch, detects);
215+
m_detector->Detect(batch, detects);
216216

217217
for (size_t j = 0; j < batchSize; ++j)
218218
{
@@ -229,11 +229,11 @@ void YoloTensorRTDetector::Detect(const cv::UMat& colorFrame)
229229

230230
if (crops.size() > 1)
231231
{
232-
nms3<CRegion>(tmpRegions, m_regions, 0.4f,
232+
nms3<CRegion>(tmpRegions, m_regions, static_cast<track_t>(0.4),
233233
[](const CRegion& reg) { return reg.m_brect; },
234234
[](const CRegion& reg) { return reg.m_confidence; },
235235
[](const CRegion& reg) { return reg.m_type; },
236-
0, 0.f);
236+
0, static_cast<track_t>(0));
237237
//std::cout << "nms for " << tmpRegions.size() << " objects - result " << m_regions.size() << std::endl;
238238
}
239239
}

src/Detector/tensorrt_yolo/decodeTensorCUDA.cu

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ __global__ void decodeTensorKernel(
4747
float* decodeTensorCUDA(const int imageIdx, const TensorInfo& tensor)
4848
{
4949
// host
50-
int boxes_bytes = 6*sizeof(float)*tensor.grid_h*tensor.grid_w*tensor.numBBoxes; // x y w h maxProb maxIndex 6个元素
50+
int boxes_bytes = 6*sizeof(float)*tensor.grid_h*tensor.grid_w*tensor.numBBoxes; // x y w h maxProb maxIndex 6
5151
const float* detections = &tensor.hostBuffer[imageIdx * tensor.volume];
5252
float* boxes = (float*) malloc(boxes_bytes);
5353

src/Tracker/Kalman.cpp

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,10 @@ namespace kalman = cv::detail::tracking;
1717
/// \param deltaTime
1818
/// \param accelNoiseMag
1919
///
20-
TKalmanFilter::TKalmanFilter(
21-
tracking::KalmanType type,
22-
bool useAcceleration,
23-
track_t deltaTime, // time increment (lower values makes target more "massive")
24-
track_t accelNoiseMag
25-
)
20+
TKalmanFilter::TKalmanFilter(tracking::KalmanType type,
21+
bool useAcceleration,
22+
track_t deltaTime, // time increment (lower values makes target more "massive")
23+
track_t accelNoiseMag)
2624
:
2725
m_accelNoiseMag(accelNoiseMag),
2826
m_deltaTime(deltaTime),
@@ -374,7 +372,7 @@ void TKalmanFilter::CreateLinearAcceleration(cv::Rect_<track_t> rect0, Point_t r
374372

375373
m_initialRects.reserve(MIN_INIT_VALS);
376374

377-
m_initialized = true;
375+
m_initialized = true;
378376
}
379377

380378
///

src/common/defines.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -381,7 +381,7 @@ enum FilterGoal
381381
{
382382
FilterCenter,
383383
FilterRect,
384-
FilterRRect,
384+
FilterRRect,
385385
FiltersCount
386386
};
387387

0 commit comments

Comments
 (0)