Skip to content

Commit 5332e0e

Browse files
committed
fix
1 parent c4fd9ca commit 5332e0e

File tree

2 files changed

+25
-3
lines changed

2 files changed

+25
-3
lines changed

README.md

+1
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ Following models are implemented.
7878
|[ufld](./ufld)| pytorch implementation from [Ultra-Fast-Lane-Detection](https://github.com/cfzd/Ultra-Fast-Lane-Detection), ECCV2020 |
7979
|[hrnet](./hrnet)| hrnet-image-classification and hrnet-semantic-segmentation, pytorch implementation from [HRNet-Image-Classification](https://github.com/HRNet/HRNet-Image-Classification) and [HRNet-Semantic-Segmentation](https://github.com/HRNet/HRNet-Semantic-Segmentation) |
8080
|[psenet](./psenet)| PSENet Text Detection, tensorflow implementation from [liuheng92/tensorflow_PSENet](https://github.com/liuheng92/tensorflow_PSENet) |
81+
|[ibnnet](./ibnnet)| IBN-Net, pytorch implementation from [XingangPan/IBN-Net](https://github.com/XingangPan/IBN-Net), ECCV2018 |
8182

8283
## Model Zoo
8384

yolov5/yolov5.cpp

+24-3
Original file line numberDiff line numberDiff line change
@@ -195,9 +195,16 @@ ICudaEngine* createEngine_m(unsigned int maxBatchSize, IBuilder* builder, IBuild
195195
// Build engine
196196
builder->setMaxBatchSize(maxBatchSize);
197197
config->setMaxWorkspaceSize(16 * (1 << 20)); // 16MB
198-
#ifdef USE_FP16
198+
#if defined(USE_FP16)
199199
config->setFlag(BuilderFlag::kFP16);
200+
#elif defined(USE_INT8)
201+
std::cout << "Your platform support int8: " << (builder->platformHasFastInt8() ? "true" : "false") << std::endl;
202+
assert(builder->platformHasFastInt8());
203+
config->setFlag(BuilderFlag::kINT8);
204+
Int8EntropyCalibrator2 *calibrator = new Int8EntropyCalibrator2(1, INPUT_W, INPUT_H, "./coco_calib/", "int8calib.table", INPUT_BLOB_NAME);
205+
config->setInt8Calibrator(calibrator);
200206
#endif
207+
201208
std::cout << "Building engine, please wait for a while..." << std::endl;
202209
ICudaEngine* engine = builder->buildEngineWithConfig(*network, *config);
203210
std::cout << "Build engine successfully!" << std::endl;
@@ -284,9 +291,16 @@ ICudaEngine* createEngine_l(unsigned int maxBatchSize, IBuilder* builder, IBuild
284291
// Build engine
285292
builder->setMaxBatchSize(maxBatchSize);
286293
config->setMaxWorkspaceSize(16 * (1 << 20)); // 16MB
287-
#ifdef USE_FP16
294+
#if defined(USE_FP16)
288295
config->setFlag(BuilderFlag::kFP16);
296+
#elif defined(USE_INT8)
297+
std::cout << "Your platform support int8: " << (builder->platformHasFastInt8() ? "true" : "false") << std::endl;
298+
assert(builder->platformHasFastInt8());
299+
config->setFlag(BuilderFlag::kINT8);
300+
Int8EntropyCalibrator2 *calibrator = new Int8EntropyCalibrator2(1, INPUT_W, INPUT_H, "./coco_calib/", "int8calib.table", INPUT_BLOB_NAME);
301+
config->setInt8Calibrator(calibrator);
289302
#endif
303+
290304
std::cout << "Building engine, please wait for a while..." << std::endl;
291305
ICudaEngine* engine = builder->buildEngineWithConfig(*network, *config);
292306
std::cout << "Build engine successfully!" << std::endl;
@@ -375,9 +389,16 @@ ICudaEngine* createEngine_x(unsigned int maxBatchSize, IBuilder* builder, IBuild
375389
// Build engine
376390
builder->setMaxBatchSize(maxBatchSize);
377391
config->setMaxWorkspaceSize(16 * (1 << 20)); // 16MB
378-
#ifdef USE_FP16
392+
#if defined(USE_FP16)
379393
config->setFlag(BuilderFlag::kFP16);
394+
#elif defined(USE_INT8)
395+
std::cout << "Your platform support int8: " << (builder->platformHasFastInt8() ? "true" : "false") << std::endl;
396+
assert(builder->platformHasFastInt8());
397+
config->setFlag(BuilderFlag::kINT8);
398+
Int8EntropyCalibrator2 *calibrator = new Int8EntropyCalibrator2(1, INPUT_W, INPUT_H, "./coco_calib/", "int8calib.table", INPUT_BLOB_NAME);
399+
config->setInt8Calibrator(calibrator);
380400
#endif
401+
381402
std::cout << "Building engine, please wait for a while..." << std::endl;
382403
ICudaEngine* engine = builder->buildEngineWithConfig(*network, *config);
383404
std::cout << "Build engine successfully!" << std::endl;

0 commit comments

Comments
 (0)