Skip to content

Commit c938826

Browse files
author
Wish
committed
add destroy
1 parent 1f57892 commit c938826

File tree

7 files changed

+37
-8
lines changed

7 files changed

+37
-8
lines changed

src/application/app_alphapose/alpha_pose.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,11 @@ namespace AlphaPose{
5757
>;
5858
class InferImpl : public Infer, public ControllerImpl{
5959
public:
60+
/** 要求在InferImpl里面执行stop,而不是在基类执行stop **/
61+
virtual ~InferImpl(){
62+
stop();
63+
}
64+
6065
bool startup(const string& file, int gpuid){
6166
return ControllerImpl::startup(make_tuple(file, gpuid));
6267
}

src/application/app_arcface/arcface.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,11 @@ namespace Arcface{
7070
>;
7171
class InferImpl : public Infer, public ControllerImpl{
7272
public:
73+
/** 要求在InferImpl里面执行stop,而不是在基类执行stop **/
74+
virtual ~InferImpl(){
75+
stop();
76+
}
77+
7378
virtual bool startup(const string& file, int gpuid){
7479

7580
float mean[] = {0.5f, 0.5f, 0.5f};

src/application/app_fall_gcn/fall_gcn.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,11 @@ namespace FallGCN{
4040
>;
4141
class InferImpl : public Infer, public ControllerImpl{
4242
public:
43+
/** 要求在InferImpl里面执行stop,而不是在基类执行stop **/
44+
virtual ~InferImpl(){
45+
stop();
46+
}
47+
4348
bool startup(const string& file, int gpuid){
4449
gpuid_ = gpuid;
4550
return ControllerImpl::startup(make_tuple(file, gpuid));

src/application/app_retinaface/retinaface.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,11 @@ namespace RetinaFace{
5353
>;
5454
class InferImpl : public Infer, public ControllerImpl{
5555
public:
56+
/** 要求在InferImpl里面执行stop,而不是在基类执行stop **/
57+
virtual ~InferImpl(){
58+
stop();
59+
}
60+
5661
virtual bool startup(const string& file, int gpuid, float confidence_threshold, float nms_threshold){
5762

5863
float mean[] = {104, 117, 123};

src/application/app_scrfd/scrfd.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,11 @@ namespace Scrfd{
5353
>;
5454
class InferImpl : public Infer, public ControllerImpl{
5555
public:
56+
/** 要求在InferImpl里面执行stop,而不是在基类执行stop **/
57+
virtual ~InferImpl(){
58+
stop();
59+
}
60+
5661
virtual bool startup(const string& file, int gpuid, float confidence_threshold, float nms_threshold){
5762

5863
float mean[] = {127.5, 127.5, 127.5};

src/application/app_yolo/yolo.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,12 @@ namespace Yolo{
100100
>;
101101
class InferImpl : public Infer, public ControllerImpl{
102102
public:
103+
104+
/** 要求在InferImpl里面执行stop,而不是在基类执行stop **/
105+
virtual ~InferImpl(){
106+
stop();
107+
}
108+
103109
virtual bool startup(const string& file, Type type, int gpuid, float confidence_threshold, float nms_threshold){
104110

105111
if(type == Type::V5){

src/tensorRT/infer/trt_infer.cpp

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -194,12 +194,11 @@ namespace TRT {
194194
if (pdata == nullptr || size == 0)
195195
return false;
196196

197-
this->context_.reset(new EngineContext());
197+
context_.reset(new EngineContext());
198198

199199
//build model
200-
EngineContext* context = (EngineContext*)this->context_.get();
201-
if (!context->build_model(pdata, size)) {
202-
this->context_.reset();
200+
if (!context_->build_model(pdata, size)) {
201+
context_.reset();
203202
return false;
204203
}
205204

@@ -216,12 +215,11 @@ namespace TRT {
216215
if (data.empty())
217216
return false;
218217

219-
this->context_.reset(new EngineContext());
218+
context_.reset(new EngineContext());
220219

221220
//build model
222-
EngineContext* context = (EngineContext*)this->context_.get();
223-
if (!context->build_model(data.data(), data.size())) {
224-
this->context_.reset();
221+
if (!context_->build_model(data.data(), data.size())) {
222+
context_.reset();
225223
return false;
226224
}
227225

0 commit comments

Comments
 (0)