Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "../network_config.h"
- #include "../trt_utils.h"
- #include "../yolov3-tiny.h"
- #include "../yolo.h"
- #include <fstream>
- #include <iterator>
- #include <vector>
- using namespace std;
- int main(int argc, char** argv) {
- ifstream inputStream( "input.raw", ios::binary);
- vector<unsigned char> input(istreambuf_iterator<char>(inputStream), {});
- Yolo* m_inferNet(new YoloV3Tiny("custom_model.engine", 16, 0.5));
- m_inferNet->doInference(input.data());
- struct timeval inferStart, inferEnd;
- gettimeofday(&inferStart, NULL);
- for (int j = 0; j < 50; j++) {
- m_inferNet->doInference(input.data());
- for (int i = 0; i < m_batchSize; i++) {
- auto binfo = m_inferNet->decodeDetections(i, 1080, 1920);
- auto remaining = nonMaximumSuppression(m_inferNet->getNMSThresh(), binfo);
- }
- }
- gettimeofday(&inferEnd, NULL);
- double inferElapsed = ((inferEnd.tv_sec - inferStart.tv_sec) +
- (inferEnd.tv_usec - inferStart.tv_usec) / 1000000.0) * 1000 /
- (50 * 16);
- cout << "Took " << inferElapsed << "ms per image" << endl;
- }
Advertisement
Add Comment
Please, Sign In to add comment