Apollo
11.0
自动驾驶开放平台
entropy_calibrator.h
浏览该文件的文档.
1
/******************************************************************************
2
* Copyright 2018 The Apollo Authors. All Rights Reserved.
3
*
4
* Licensed under the Apache License, Version 2.0 (the "License");
5
* you may not use this file except in compliance with the License.
6
* You may obtain a copy of the License at
7
*
8
* http://www.apache.org/licenses/LICENSE-2.0
9
*
10
* Unless required by applicable law or agreed to in writing, software
11
* distributed under the License is distributed on an "AS IS" BASIS,
12
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
* See the License for the specific language governing permissions and
14
* limitations under the License.
15
*****************************************************************************/
16
17
#pragma once
18
19
#include <string>
20
#include <vector>
21
22
#include "NvInfer.h"
23
#include "NvInferPlugin.h"
24
25
#include "
modules/perception/common/inference/tensorrt/batch_stream.h
"
26
#include "
modules/perception/common/inference/tensorrt/rt_utils.h
"
27
28
namespace
nvinfer1
{
29
class
Int8EntropyCalibrator
:
public
IInt8EntropyCalibrator {
30
public
:
31
Int8EntropyCalibrator
(
32
const
apollo::perception::inference::BatchStream
&stream,
int
first_batch,
33
bool
read_cache, std::string network);
34
35
virtual
~Int8EntropyCalibrator
();
36
int
getBatchSize
() const noexcept
override
{
return
stream_.
getBatchSize
(); }
37
38
bool
getBatch
(
void
*bindings[],
39
const
char
*names[],
int
nbBindings)
noexcept
override
;
40
41
const
void
*
readCalibrationCache
(
size_t
&length)
noexcept
override
;
42
43
void
writeCalibrationCache
(
const
void
*cache,
44
size_t
length)
noexcept
override
;
45
46
private
:
47
apollo::perception::inference::BatchStream
stream_;
48
bool
read_cache_ =
true
;
49
std::string network_ =
"yolo"
;
50
size_t
input_count_;
51
void
*device_input_ =
nullptr
;
52
std::vector<char> calibration_cache_;
53
};
54
55
}
// namespace nvinfer1
batch_stream.h
apollo::perception::inference::BatchStream
Definition
batch_stream.h:36
apollo::perception::inference::BatchStream::getBatchSize
int getBatchSize() const
Definition
batch_stream.h:52
nvinfer1::Int8EntropyCalibrator
Definition
entropy_calibrator.h:29
nvinfer1::Int8EntropyCalibrator::writeCalibrationCache
void writeCalibrationCache(const void *cache, size_t length) noexcept override
Definition
entropy_calibrator.cc:77
nvinfer1::Int8EntropyCalibrator::getBatchSize
int getBatchSize() const noexcept override
Definition
entropy_calibrator.h:36
nvinfer1::Int8EntropyCalibrator::~Int8EntropyCalibrator
virtual ~Int8EntropyCalibrator()
Definition
entropy_calibrator.cc:43
nvinfer1::Int8EntropyCalibrator::readCalibrationCache
const void * readCalibrationCache(size_t &length) noexcept override
Definition
entropy_calibrator.cc:61
nvinfer1::Int8EntropyCalibrator::getBatch
bool getBatch(void *bindings[], const char *names[], int nbBindings) noexcept override
Definition
entropy_calibrator.cc:49
nvinfer1
Definition
entropy_calibrator.cc:32
rt_utils.h
modules
perception
common
inference
tensorrt
entropy_calibrator.h