Skip to content

Commit

Permalink
Update readme
Browse files Browse the repository at this point in the history
  • Loading branch information
Nuzhny007 committed May 6, 2023
1 parent 2a3ff95 commit e37522a
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 25 deletions.
7 changes: 3 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,9 @@

# Last changes

* Some experiments with YOLOv7_mask and results with rotated rectangles: detector works tracker in progress

* Breaking change: removed static enum with types
* YOLOv8 detextor worked with TensorRT! Export pretrained Pytorch models [here (ultralytics/ultralytics)](https://github.com/ultralytics/ultralytics) to onnx format and run Multitarget-tracker with -e=6 example

* Support ONNX with NMS
* Some experiments with YOLOv7_mask and results with rotated rectangles: detector works tracker in progress

* YOLOv7 worked with TensorRT! Export pretrained Pytorch models [here (WongKinYiu/yolov7)](https://github.com/WongKinYiu/yolov7) to onnx format and run Multitarget-tracker with -e=6 example

Expand Down Expand Up @@ -250,6 +248,7 @@ And so on.
* STAPLE tracker: https://github.com/xuduo35/STAPLE
* LDES tracker: https://github.com/yfji/LDESCpp
* Ini file parser: https://github.com/benhoyt/inih
* Circular Code from Lior Kogan

#### License
Apache 2.0: [LICENSE text](https://github.com/Smorodov/Multitarget-tracker/blob/master/LICENSE)
Expand Down
23 changes: 17 additions & 6 deletions combined/combined.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,7 @@ bool CombinedDetector::InitDetector(cv::UMat frame)
YOLOv7Mask,
YOLOv8
};
YOLOModels usedModel = YOLOModels::YOLOv7;
YOLOModels usedModel = YOLOModels::YOLOv8;
switch (usedModel)
{
case YOLOModels::TinyYOLOv3:
Expand Down Expand Up @@ -416,11 +416,15 @@ bool CombinedDetector::InitDetector(cv::UMat frame)
break;

case YOLOModels::YOLOv8:
configDNN.emplace("modelConfiguration", pathToModel + "yolov8s.onnx");
configDNN.emplace("modelBinary", pathToModel + "yolov8s.onnx");
//configDNN.emplace("modelConfiguration", pathToModel + "yolov8s.onnx");
//configDNN.emplace("modelBinary", pathToModel + "yolov8s.onnx");
configDNN.emplace("modelConfiguration", "C:/work/mtracking/Nuzhny007/Multitarget-tracker/data/yolov8x.onnx");
configDNN.emplace("modelBinary", "C:/work/mtracking/Nuzhny007/Multitarget-tracker/data/yolov8x.onnx");
configDNN.emplace("confidenceThreshold", "0.2");
configDNN.emplace("inference_precision", "FP32");
configDNN.emplace("inference_precision", "FP16");
configDNN.emplace("net_type", "YOLOV8");
configDNN.emplace("inWidth", "640");
configDNN.emplace("inHeight", "640");
maxBatch = 1;
configDNN.emplace("maxCropRatio", "-1");
break;
Expand All @@ -434,9 +438,16 @@ bool CombinedDetector::InitDetector(cv::UMat frame)
configDNN.emplace("white_list", "handbag");
configDNN.emplace("white_list", "suitcase");

#if 1
configDNN.emplace("dnnTarget", "DNN_TARGET_CPU");
configDNN.emplace("dnnBackend", "DNN_BACKEND_DEFAULT");
#else
configDNN.emplace("dnnTarget", "DNN_TARGET_CUDA");
configDNN.emplace("dnnBackend", "DNN_BACKEND_CUDA");
#endif

m_detectorDNN = BaseDetector::CreateDetector(tracking::Detectors::Yolo_TensorRT, configDNN, frame);
if (m_detectorDNN.get())
m_detectorDNN->SetMinObjectSize(cv::Size(frame.cols / 40, frame.rows / 40));
//m_detectorDNN = BaseDetector::CreateDetector(tracking::Detectors::DNN_OCV, configDNN, frame);

return m_detectorBGFG.get() && m_detectorDNN.get();
}
Expand Down
22 changes: 9 additions & 13 deletions src/Detector/tensorrt_yolo/YoloONNX.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -790,14 +790,20 @@ void YoloONNX::ProcessBBoxesOutput(size_t imgIdx, const std::vector<float*>& out
size_t ncInd = 1;
size_t lenInd = 2;
int nc = m_outpuDims[0].d[ncInd] - 4;
int dimensions = nc + 4;
size_t len = static_cast<size_t>(m_outpuDims[0].d[lenInd]) / m_params.explicitBatchSize;
auto Volume = [](const nvinfer1::Dims& d)
{
return std::accumulate(d.d, d.d + d.nbDims, 1, std::multiplies<int>());
};
auto volume = len * m_outpuDims[0].d[ncInd]; // Volume(m_outpuDims[0]);
output += volume * imgIdx;
std::cout << "len = " << len << ", nc = " << nc << ", m_params.confThreshold = " << m_params.confThreshold << ", volume = " << volume << std::endl;
//std::cout << "len = " << len << ", nc = " << nc << ", m_params.confThreshold = " << m_params.confThreshold << ", volume = " << volume << std::endl;

cv::Mat rawMemory(1, dimensions * len, CV_32FC1, output);
rawMemory = rawMemory.reshape(1, dimensions);
cv::transpose(rawMemory, rawMemory);
output = (float*)rawMemory.data;

std::vector<int> classIds;
std::vector<float> confidences;
Expand All @@ -812,16 +818,6 @@ void YoloONNX::ProcessBBoxesOutput(size_t imgIdx, const std::vector<float*>& out
size_t k = i * (nc + 4);
float object_conf = output[k + 4];

if (i == 0)
{
std::cout << "mem" << i << ": ";
for (size_t ii = 0; ii < nc * 4; ++ii)
{
std::cout << output[k + ii] << " ";
}
std::cout << std::endl;
}

if (object_conf >= m_params.confThreshold)
{
// (center x, center y, width, height) to (x, y, w, h)
Expand All @@ -845,8 +841,8 @@ void YoloONNX::ProcessBBoxesOutput(size_t imgIdx, const std::vector<float*>& out

class_conf *= object_conf;

if (i == 0)
std::cout << i << ": object_conf = " << object_conf << ", class_conf = " << class_conf << ", classId = " << classId << ", rect = " << cv::Rect(cvRound(x), cvRound(y), cvRound(width), cvRound(height)) << std::endl;
//if (i == 0)
// std::cout << i << ": object_conf = " << object_conf << ", class_conf = " << class_conf << ", classId = " << classId << ", rect = " << cv::Rect(cvRound(x), cvRound(y), cvRound(width), cvRound(height)) << std::endl;

classIds.push_back(classId);
confidences.push_back(class_conf);
Expand Down
4 changes: 2 additions & 2 deletions thirdparty/Circular_Code/FPCompare.h
Original file line number Diff line number Diff line change
Expand Up @@ -239,8 +239,8 @@ class FloatingPoint

Bits bits= DistanceBetweenSignAndMagnitudeNumbers(u_.bits_, rhs.u_.bits_);

if (bits > kMaxUlps && bits<100000000)
__debugbreak();
//if (bits > kMaxUlps && bits<100000000)
// __debugbreak();

return bits <= kMaxUlps;
}
Expand Down

0 comments on commit e37522a

Please sign in to comment.