Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion includes/common/logging.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,12 @@
#include <sstream>
#include <string>

#if NV_TENSORRT_MAJOR >= 8
#define TRT_NOEXCEPT noexcept
#else
#define TRT_NOEXCEPT
#endif

using Severity = nvinfer1::ILogger::Severity;

class LogStreamConsumerBuffer : public std::stringbuf
Expand Down Expand Up @@ -236,7 +242,7 @@ class Logger : public nvinfer1::ILogger
//! Note samples should not be calling this function directly; it will eventually go away once we eliminate the
//! inheritance from nvinfer1::ILogger
//!
void log(Severity severity, const char* msg) override
void log(Severity severity, const char* msg) TRT_NOEXCEPT override
{
LogStreamConsumer(mReportableSeverity, severity) << "[TRT] " << std::string(msg) << std::endl;
}
Expand Down
1 change: 1 addition & 0 deletions yolov7/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ message(STATUS "Find CUDA include at ${CUDA_INCLUDE_DIRS}")
message(STATUS "Find CUDA libraries: ${CUDA_LIBRARIES}")

# TensorRT
# set(TENSORRT_ROOT /usr/local/cuda/)
set(TENSORRT_ROOT /usr/src/tensorrt/)
find_path(TENSORRT_INCLUDE_DIR NvInfer.h
HINTS ${TENSORRT_ROOT} PATH_SUFFIXES include/)
Expand Down
13 changes: 13 additions & 0 deletions yolov7/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,3 +51,16 @@ yolov7:

## 5.Results:
![](prediction.jpg)

## COCO AP evaluation

1. Download COCO validation set images (http://images.cocodataset.org/zips/val2017.zip) and annotations (http://images.cocodataset.org/annotations/annotations_trainval2017.zip), unzip them.

2. Compile and run yolov7 with `EXPORT_COCO_JSON` flag enabled

3. Install the COCO python API, then run `coco_eval.py` (make sure the path in the script are correct)

```
python -m pip install pycocotools
python coco_eval.py
```
17 changes: 17 additions & 0 deletions yolov7/coco_eval.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
from pycocotools.coco import COCO
from pycocotools.cocoeval import COCOeval

#initialize COCO ground truth api
cocoGt = COCO("instances_val2017.json")

#initialize COCO detections api
cocoDt = cocoGt.loadRes("build/yolov7_coco_eval.json")

imgIds=sorted(cocoGt.getImgIds())

# running evaluation
cocoEval = COCOeval(cocoGt, cocoDt, 'bbox')
cocoEval.params.imgIds = imgIds
cocoEval.evaluate()
cocoEval.accumulate()
cocoEval.summarize()
Loading