text
stringlengths
24
1.04M
metadata
stringlengths
233
497
### File: yolop/yolop.cpp #include "yolop.hpp" int main(int argc, char** argv) { cudaSetDevice(DEVICE); std::string wts_name = ""; std::string engine_name = ""; std::string img_dir; if (!parse_args(argc, argv, wts_name, engine_name, img_dir)) { std::cerr << "arguments not right!...
{"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "C++", "repo_name": "minhanghuang/tensorrtx", "path": "yolop/yolop.cpp", "license": "mit", "size": 8412}
### File: yolop/yolop.hpp #pragma once #include <chrono> #include "cuda_utils.h" #include "logging.h" #include "utils.h" #define USE_FP16 // set USE_INT8 or USE_FP16 or USE_FP32 #define DEVICE 0 // GPU id #define NMS_THRESH 0.45 #define CONF_THRESH 0.25 #define BATCH_SIZE 1 // stuff we know about the network and t...
{"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "C++", "repo_name": "minhanghuang/tensorrtx", "path": "yolop/yolop.hpp", "license": "mit", "size": 13063}
### File: yolop/yolop_trt.py # 2022/10/26 by ausk """ An example that uses TensorRT's Python api to make yolop inferences. """ import ctypes import os import shutil import random import sys import time import cv2 import numpy as np import pycuda.autoinit import pycuda.driver as cuda import tensorrt as trt CONF_THRESH ...
{"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "Python", "repo_name": "minhanghuang/tensorrtx", "path": "yolop/yolop_trt.py", "license": "mit", "size": 16036}
### File: yolov3-spp/CMakeLists.txt cmake_minimum_required(VERSION 2.6) project(yolov3-spp) add_definitions(-std=c++11) option(CUDA_USE_STATIC_CUDA_RUNTIME OFF) set(CMAKE_CXX_STANDARD 11) set(CMAKE_BUILD_TYPE Debug) find_package(CUDA REQUIRED) include_directories(${PROJECT_SOURCE_DIR}/include) # include and link d...
{"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "CMake", "repo_name": "minhanghuang/tensorrtx", "path": "yolov3-spp/CMakeLists.txt", "license": "mit", "size": 1120}
### File: yolov3-spp/Utils.h #ifndef __TRT_UTILS_H_ #define __TRT_UTILS_H_ #include <iostream> #include <vector> #include <algorithm> #include <cudnn.h> #ifndef CUDA_CHECK #define CUDA_CHECK(callstr) \ { ...
{"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "C++", "repo_name": "minhanghuang/tensorrtx", "path": "yolov3-spp/Utils.h", "license": "mit", "size": 3146}
### File: yolov3-spp/gen_wts.py import struct import sys from models import * from utils.utils import * model = Darknet('cfg/yolov3-spp.cfg', (416, 416)) weights = sys.argv[1] dev = '0' device = torch_utils.select_device(dev) model.load_state_dict(torch.load(weights, map_location=device)['model']) with open('yolov3-...
{"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "Python", "repo_name": "minhanghuang/tensorrtx", "path": "yolov3-spp/gen_wts.py", "license": "mit", "size": 637}
### File: yolov3-spp/logging.h /* * Copyright (c) 2019, NVIDIA CORPORATION. All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/...
{"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "C++", "repo_name": "minhanghuang/tensorrtx", "path": "yolov3-spp/logging.h", "license": "mit", "size": 16550}
### File: yolov3-spp/yololayer.cu #include "yololayer.h" using namespace Yolo; namespace nvinfer1 { YoloLayerPlugin::YoloLayerPlugin() { mClassCount = CLASS_NUM; mYoloKernel.clear(); mYoloKernel.push_back(yolo1); mYoloKernel.push_back(yolo2); mYoloKernel.push_back(yolo3...
{"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "Cuda", "repo_name": "minhanghuang/tensorrtx", "path": "yolov3-spp/yololayer.cu", "license": "mit", "size": 9472}
### File: yolov3-spp/yololayer.h #ifndef _YOLO_LAYER_H #define _YOLO_LAYER_H #include <assert.h> #include <cmath> #include <string.h> #include <cublas_v2.h> #include "NvInfer.h" #include "Utils.h" #include <iostream> namespace Yolo { static constexpr int CHECK_COUNT = 3; static constexpr float IGNORE_THRESH =...
{"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "C++", "repo_name": "minhanghuang/tensorrtx", "path": "yolov3-spp/yololayer.h", "license": "mit", "size": 5021}
### File: yolov3-spp/yolov3-spp.cpp #include <fstream> #include <iostream> #include <map> #include <sstream> #include <vector> #include <chrono> #include <opencv2/opencv.hpp> #include <opencv2/dnn/dnn.hpp> #include <dirent.h> #include "NvInfer.h" #include "cuda_runtime_api.h" #include "logging.h" #include "yololayer.h"...
{"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "C++", "repo_name": "minhanghuang/tensorrtx", "path": "yolov3-spp/yolov3-spp.cpp", "license": "mit", "size": 27691}
### File: yolov3-tiny/CMakeLists.txt cmake_minimum_required(VERSION 2.6) project(yolov3-tiny) add_definitions(-std=c++11) option(CUDA_USE_STATIC_CUDA_RUNTIME OFF) set(CMAKE_CXX_STANDARD 11) set(CMAKE_BUILD_TYPE Debug) find_package(CUDA REQUIRED) include_directories(${PROJECT_SOURCE_DIR}/include) if (CMAKE_SYSTEM_P...
{"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "CMake", "repo_name": "minhanghuang/tensorrtx", "path": "yolov3-tiny/CMakeLists.txt", "license": "mit", "size": 1251}
### File: yolov3-tiny/gen_wts.py import struct import sys from models import * from utils.utils import * model = Darknet('cfg/yolov3-tiny.cfg', (608, 608)) weights = sys.argv[1] device = torch_utils.select_device('0') if weights.endswith('.pt'): # pytorch format model.load_state_dict(torch.load(weights, map_locat...
{"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "Python", "repo_name": "minhanghuang/tensorrtx", "path": "yolov3-tiny/gen_wts.py", "license": "mit", "size": 750}
### File: yolov3-tiny/logging.h /* * Copyright (c) 2019, NVIDIA CORPORATION. All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses...
{"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "C++", "repo_name": "minhanghuang/tensorrtx", "path": "yolov3-tiny/logging.h", "license": "mit", "size": 16583}
### File: yolov3-tiny/macros.h #ifndef __MACROS_H #define __MACROS_H #if NV_TENSORRT_MAJOR >= 8 #define TRT_NOEXCEPT noexcept #define TRT_CONST_ENQUEUE const #else #define TRT_NOEXCEPT #define TRT_CONST_ENQUEUE #endif #endif // __MACROS_H
{"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "C", "repo_name": "minhanghuang/tensorrtx", "path": "yolov3-tiny/macros.h", "license": "mit", "size": 210}
### File: yolov3-tiny/utils.h #ifndef __TRT_UTILS_H_ #define __TRT_UTILS_H_ #include <iostream> #include <vector> #include <algorithm> #include <cudnn.h> #include "macros.h" #ifndef CUDA_CHECK #define CUDA_CHECK(callstr) \ { ...
{"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "C++", "repo_name": "minhanghuang/tensorrtx", "path": "yolov3-tiny/utils.h", "license": "mit", "size": 3192}
### File: yolov3-tiny/yololayer.cu #include <assert.h> #include "yololayer.h" #include "utils.h" using namespace Yolo; namespace nvinfer1 { YoloLayerPlugin::YoloLayerPlugin() { mClassCount = CLASS_NUM; mYoloKernel.clear(); mYoloKernel.push_back(yolo1); mYoloKernel.push_back(yol...
{"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "Cuda", "repo_name": "minhanghuang/tensorrtx", "path": "yolov3-tiny/yololayer.cu", "license": "mit", "size": 9132}
### File: yolov3-tiny/yololayer.h #ifndef _YOLO_LAYER_H #define _YOLO_LAYER_H #include <vector> #include <string> #include "NvInfer.h" #include "macros.h" namespace Yolo { static constexpr int CHECK_COUNT = 3; static constexpr float IGNORE_THRESH = 0.1f; static constexpr int MAX_OUTPUT_BBOX_COUNT = 1000;...
{"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "C++", "repo_name": "minhanghuang/tensorrtx", "path": "yolov3-tiny/yololayer.h", "license": "mit", "size": 4908}
### File: yolov3-tiny/yolov3-tiny.cpp #include <fstream> #include <iostream> #include <map> #include <sstream> #include <vector> #include <chrono> #include <opencv2/opencv.hpp> #include <dirent.h> #include "NvInfer.h" #include "cuda_runtime_api.h" #include "logging.h" #include "yololayer.h" #define CHECK(status) \ ...
{"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "C++", "repo_name": "minhanghuang/tensorrtx", "path": "yolov3-tiny/yolov3-tiny.cpp", "license": "mit", "size": 18668}
### File: yolov3/CMakeLists.txt cmake_minimum_required(VERSION 2.6) project(yolov3) add_definitions(-std=c++11) option(CUDA_USE_STATIC_CUDA_RUNTIME OFF) set(CMAKE_CXX_STANDARD 11) set(CMAKE_BUILD_TYPE Debug) find_package(CUDA REQUIRED) include_directories(${PROJECT_SOURCE_DIR}/include) # include and link dirs of c...
{"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "CMake", "repo_name": "minhanghuang/tensorrtx", "path": "yolov3/CMakeLists.txt", "license": "mit", "size": 1200}
### File: yolov3/calibrator.cpp #include <iostream> #include <iterator> #include <fstream> #include <opencv2/dnn/dnn.hpp> #include "calibrator.h" #include "cuda_runtime_api.h" #include "utils.h" Int8EntropyCalibrator2::Int8EntropyCalibrator2(int batchsize, int input_w, int input_h, const char* img_dir, const char* cal...
{"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "C++", "repo_name": "minhanghuang/tensorrtx", "path": "yolov3/calibrator.cpp", "license": "mit", "size": 2855}
### File: yolov3/calibrator.h #ifndef ENTROPY_CALIBRATOR_H #define ENTROPY_CALIBRATOR_H #include "NvInfer.h" #include <string> #include <vector> #include "macros.h" //! \class Int8EntropyCalibrator2 //! //! \brief Implements Entropy calibrator 2. //! CalibrationAlgoType is kENTROPY_CALIBRATION_2. //! class Int8Entro...
{"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "C++", "repo_name": "minhanghuang/tensorrtx", "path": "yolov3/calibrator.h", "license": "mit", "size": 1249}
### File: yolov3/gen_wts.py import struct import sys from models import * from utils.utils import * model = Darknet('cfg/yolov3.cfg', (608, 608)) weights = sys.argv[1] device = torch_utils.select_device('0') if weights.endswith('.pt'): # pytorch format model.load_state_dict(torch.load(weights, map_location=device...
{"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "Python", "repo_name": "minhanghuang/tensorrtx", "path": "yolov3/gen_wts.py", "license": "mit", "size": 740}
### File: yolov3/logging.h /* * Copyright (c) 2019, NVIDIA CORPORATION. All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICE...
{"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "C++", "repo_name": "minhanghuang/tensorrtx", "path": "yolov3/logging.h", "license": "mit", "size": 16675}
### File: yolov3/macros.h #ifndef __MACROS_H #define __MACROS_H #if NV_TENSORRT_MAJOR >= 8 #define TRT_NOEXCEPT noexcept #define TRT_CONST_ENQUEUE const #else #define TRT_NOEXCEPT #define TRT_CONST_ENQUEUE #endif #endif // __MACROS_H
{"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "C", "repo_name": "minhanghuang/tensorrtx", "path": "yolov3/macros.h", "license": "mit", "size": 211}
### File: yolov3/utils.h #ifndef __TRT_UTILS_H_ #define __TRT_UTILS_H_ #include <iostream> #include <vector> #include <algorithm> #include <cudnn.h> #include <dirent.h> #include <opencv2/opencv.hpp> #ifndef CUDA_CHECK #define CUDA_CHECK(callstr) \ ...
{"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "C++", "repo_name": "minhanghuang/tensorrtx", "path": "yolov3/utils.h", "license": "mit", "size": 2553}
### File: yolov3/yololayer.cu #include "yololayer.h" #include "utils.h" #include <assert.h> using namespace Yolo; namespace nvinfer1 { YoloLayerPlugin::YoloLayerPlugin() { mClassCount = CLASS_NUM; mYoloKernel.clear(); mYoloKernel.push_back(yolo1); mYoloKernel.push_back(yolo2); ...
{"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "Cuda", "repo_name": "minhanghuang/tensorrtx", "path": "yolov3/yololayer.cu", "license": "mit", "size": 9171}
### File: yolov3/yololayer.h #ifndef _YOLO_LAYER_H #define _YOLO_LAYER_H #include <iostream> #include <vector> #include "NvInfer.h" #include "macros.h" namespace Yolo { static constexpr int CHECK_COUNT = 3; static constexpr float IGNORE_THRESH = 0.1f; static constexpr int MAX_OUTPUT_BBOX_COUNT = 1000; ...
{"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "C++", "repo_name": "minhanghuang/tensorrtx", "path": "yolov3/yololayer.h", "license": "mit", "size": 5038}
### File: yolov3/yolov3.cpp #include <fstream> #include <iostream> #include <map> #include <sstream> #include <vector> #include <chrono> #include "NvInfer.h" #include "cuda_runtime_api.h" #include "utils.h" #include "logging.h" #include "yololayer.h" #include "calibrator.h" #define USE_FP16 // set USE_INT8 or USE_FP1...
{"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "C++", "repo_name": "minhanghuang/tensorrtx", "path": "yolov3/yolov3.cpp", "license": "mit", "size": 25291}
### File: yolov3/yolov3_trt.py """ An example that uses TensorRT's Python api to make inferences. """ import ctypes import os import shutil import random import sys import threading import time import cv2 import numpy as np import pycuda.autoinit import pycuda.driver as cuda import tensorrt as trt CONF_THRESH = 0.5 IO...
{"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "Python", "repo_name": "minhanghuang/tensorrtx", "path": "yolov3/yolov3_trt.py", "license": "mit", "size": 18556}
### File: yolov4/CMakeLists.txt cmake_minimum_required(VERSION 2.6) project(yolov4) add_definitions(-std=c++11) option(CUDA_USE_STATIC_CUDA_RUNTIME OFF) set(CMAKE_CXX_STANDARD 11) set(CMAKE_BUILD_TYPE Debug) find_package(CUDA REQUIRED) include_directories(${PROJECT_SOURCE_DIR}/include) # include and link dirs of c...
{"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "CMake", "repo_name": "minhanghuang/tensorrtx", "path": "yolov4/CMakeLists.txt", "license": "mit", "size": 1122}
### File: yolov4/gen_wts.py import struct import sys from models import * from utils.utils import * model = Darknet('cfg/yolov4.cfg', (608, 608)) weights = sys.argv[1] device = torch_utils.select_device('0') if weights.endswith('.pt'): # pytorch format model.load_state_dict(torch.load(weights, map_location=device...
{"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "Python", "repo_name": "minhanghuang/tensorrtx", "path": "yolov4/gen_wts.py", "license": "mit", "size": 719}
### File: yolov4/logging.h /* * Copyright (c) 2019, NVIDIA CORPORATION. All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICE...
{"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "C++", "repo_name": "minhanghuang/tensorrtx", "path": "yolov4/logging.h", "license": "mit", "size": 16550}
### File: yolov4/mish.cu #include <cmath> #include <stdio.h> #include <cassert> #include <iostream> #include "mish.h" namespace nvinfer1 { MishPlugin::MishPlugin() { } MishPlugin::~MishPlugin() { } // create the plugin at runtime from a byte stream MishPlugin::MishPlugin(const void* d...
{"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "Cuda", "repo_name": "minhanghuang/tensorrtx", "path": "yolov4/mish.cu", "license": "mit", "size": 5753}
### File: yolov4/mish.h #ifndef _MISH_PLUGIN_H #define _MISH_PLUGIN_H #include <string> #include <vector> #include "NvInfer.h" namespace nvinfer1 { class MishPlugin: public IPluginV2IOExt { public: explicit MishPlugin(); MishPlugin(const void* data, size_t length); ...
{"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "C++", "repo_name": "minhanghuang/tensorrtx", "path": "yolov4/mish.h", "license": "mit", "size": 3532}
### File: yolov4/utils.h #ifndef __TRT_UTILS_H_ #define __TRT_UTILS_H_ #include <iostream> #include <vector> #include <algorithm> #include <cudnn.h> #ifndef CUDA_CHECK #define CUDA_CHECK(callstr) \ { ...
{"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "C++", "repo_name": "minhanghuang/tensorrtx", "path": "yolov4/utils.h", "license": "mit", "size": 1183}
### File: yolov4/yololayer.cu #include <assert.h> #include "yololayer.h" #include "utils.h" using namespace Yolo; namespace nvinfer1 { YoloLayerPlugin::YoloLayerPlugin() { mClassCount = CLASS_NUM; mYoloKernel.clear(); mYoloKernel.push_back(yolo1); mYoloKernel.push_back(yolo2); ...
{"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "Cuda", "repo_name": "minhanghuang/tensorrtx", "path": "yolov4/yololayer.cu", "license": "mit", "size": 9406}
### File: yolov4/yololayer.h #ifndef _YOLO_LAYER_H #define _YOLO_LAYER_H #include <iostream> #include <vector> #include "NvInfer.h" namespace Yolo { static constexpr int CHECK_COUNT = 3; static constexpr float IGNORE_THRESH = 0.1f; static constexpr int MAX_OUTPUT_BBOX_COUNT = 1000; static constexpr in...
{"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "C++", "repo_name": "minhanghuang/tensorrtx", "path": "yolov4/yololayer.h", "license": "mit", "size": 4660}
### File: yolov4/yolov4.cpp #include <fstream> #include <iostream> #include <map> #include <sstream> #include <vector> #include <chrono> #include <opencv2/opencv.hpp> #include <dirent.h> #include "NvInfer.h" #include "utils.h" #include "cuda_runtime_api.h" #include "logging.h" #include "yololayer.h" #include "mish.h" ...
{"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "C++", "repo_name": "minhanghuang/tensorrtx", "path": "yolov4/yolov4.cpp", "license": "mit", "size": 33350}
### File: yolov5/CMakeLists.txt cmake_minimum_required(VERSION 3.10) project(yolov5) add_definitions(-std=c++11) add_definitions(-DAPI_EXPORTS) option(CUDA_USE_STATIC_CUDA_RUNTIME OFF) set(CMAKE_CXX_STANDARD 11) set(CMAKE_BUILD_TYPE Debug) # TODO(Call for PR): make cmake compatible with Windows set(CMAKE_CUDA_COMPIL...
{"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "CMake", "repo_name": "minhanghuang/tensorrtx", "path": "yolov5/CMakeLists.txt", "license": "mit", "size": 1805}
### File: yolov5/gen_wts.py import sys import argparse import os import struct import torch from utils.torch_utils import select_device def parse_args(): parser = argparse.ArgumentParser(description='Convert .pt file to .wts') parser.add_argument('-w', '--weights', required=True, help=...
{"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "Python", "repo_name": "minhanghuang/tensorrtx", "path": "yolov5/gen_wts.py", "license": "mit", "size": 2256}
### File: yolov5/plugin/yololayer.cu #include "yololayer.h" #include "cuda_utils.h" #include <cassert> #include <vector> #include <iostream> namespace Tn { template<typename T> void write(char*& buffer, const T& val) { *reinterpret_cast<T*>(buffer) = val; buffer += sizeof(T); } template<typename T> void read(c...
{"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "Cuda", "repo_name": "minhanghuang/tensorrtx", "path": "yolov5/plugin/yololayer.cu", "license": "mit", "size": 10428}
### File: yolov5/plugin/yololayer.h #pragma once #include "types.h" #include "macros.h" #include <vector> #include <string> namespace nvinfer1 { class API YoloLayerPlugin : public IPluginV2IOExt { public: YoloLayerPlugin(int classCount, int netWidth, int netHeight, int maxOut, bool is_segmentation, const std::vect...
{"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "C++", "repo_name": "minhanghuang/tensorrtx", "path": "yolov5/plugin/yololayer.h", "license": "mit", "size": 3600}
### File: yolov5/src/calibrator.cpp #include "calibrator.h" #include "cuda_utils.h" #include "utils.h" #include <iostream> #include <iterator> #include <fstream> #include <opencv2/opencv.hpp> #include <opencv2/dnn/dnn.hpp> static cv::Mat preprocess_img(cv::Mat& img, int input_w, int input_h) { int w, h, x, y; flo...
{"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "C++", "repo_name": "minhanghuang/tensorrtx", "path": "yolov5/src/calibrator.cpp", "license": "mit", "size": 3377}
### File: yolov5/src/calibrator.h #pragma once #include "macros.h" #include <string> #include <vector> //! \class Int8EntropyCalibrator2 //! //! \brief Implements Entropy calibrator 2. //! CalibrationAlgoType is kENTROPY_CALIBRATION_2. //! class Int8EntropyCalibrator2 : public nvinfer1::IInt8EntropyCalibrator2 { pu...
{"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "C++", "repo_name": "minhanghuang/tensorrtx", "path": "yolov5/src/calibrator.h", "license": "mit", "size": 1114}
### File: yolov5/src/config.h #pragma once /* -------------------------------------------------------- * These configs are related to tensorrt model, if these are changed, * please re-compile and re-serialize the tensorrt model. * --------------------------------------------------------*/ // For INT8, you need pre...
{"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "C++", "repo_name": "minhanghuang/tensorrtx", "path": "yolov5/src/config.h", "license": "mit", "size": 2061}
### File: yolov5/src/cuda_utils.h #ifndef TRTX_CUDA_UTILS_H_ #define TRTX_CUDA_UTILS_H_ #include <cuda_runtime_api.h> #ifndef CUDA_CHECK #define CUDA_CHECK(callstr)\ {\ cudaError_t error_code = callstr;\ if (error_code != cudaSuccess) {\ std::cerr << "CUDA error " << error_code << " at...
{"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "C++", "repo_name": "minhanghuang/tensorrtx", "path": "yolov5/src/cuda_utils.h", "license": "mit", "size": 417}
### File: yolov5/src/logging.h /* * Copyright (c) 2019, NVIDIA CORPORATION. All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/...
{"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "C++", "repo_name": "minhanghuang/tensorrtx", "path": "yolov5/src/logging.h", "license": "mit", "size": 16584}
### File: yolov5/src/macros.h #ifndef __MACROS_H #define __MACROS_H #include <NvInfer.h> #ifdef API_EXPORTS #if defined(_MSC_VER) #define API __declspec(dllexport) #else #define API __attribute__((visibility("default"))) #endif #else #if defined(_MSC_VER) #define API __declspec(dllimport) #else #define API #endif #e...
{"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "C", "repo_name": "minhanghuang/tensorrtx", "path": "yolov5/src/macros.h", "license": "mit", "size": 484}
### File: yolov5/src/model.cpp #include "model.h" #include "calibrator.h" #include "config.h" #include "yololayer.h" #include <iostream> #include <fstream> #include <map> #include <cassert> #include <cmath> #include <cstring> using namespace nvinfer1; // TensorRT weight files have a simple space delimited format: //...
{"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "C++", "repo_name": "minhanghuang/tensorrtx", "path": "yolov5/src/model.cpp", "license": "mit", "size": 33976}
### File: yolov5/src/model.h #pragma once #include <NvInfer.h> #include <string> nvinfer1::ICudaEngine* build_det_engine(unsigned int maxBatchSize, nvinfer1::IBuilder* builder, nvinfer1::IBuilderConfig* config, nvinfer1::DataType dt, floa...
{"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "C++", "repo_name": "minhanghuang/tensorrtx", "path": "yolov5/src/model.h", "license": "mit", "size": 1022}
### File: yolov5/src/postprocess.cpp #include "postprocess.h" #include "utils.h" cv::Rect get_rect(cv::Mat& img, float bbox[4]) { float l, r, t, b; float r_w = kInputW / (img.cols * 1.0); float r_h = kInputH / (img.rows * 1.0); if (r_h > r_w) { l = bbox[0] - bbox[2] / 2.f; r = bbox[0] + bbox[2] / 2.f; ...
{"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "C++", "repo_name": "minhanghuang/tensorrtx", "path": "yolov5/src/postprocess.cpp", "license": "mit", "size": 6962}
### File: yolov5/src/postprocess.h #pragma once #include "types.h" #include <opencv2/opencv.hpp> cv::Rect get_rect(cv::Mat& img, float bbox[4]); void nms(std::vector<Detection>& res, float *output, float conf_thresh, float nms_thresh = 0.5); void batch_nms(std::vector<std::vector<Detection>>& batch_res, float *outp...
{"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "C++", "repo_name": "minhanghuang/tensorrtx", "path": "yolov5/src/postprocess.h", "license": "mit", "size": 711}
### File: yolov5/src/preprocess.cu #include "preprocess.h" #include "cuda_utils.h" static uint8_t* img_buffer_host = nullptr; static uint8_t* img_buffer_device = nullptr; struct AffineMatrix { float value[6]; }; __global__ void warpaffine_kernel( uint8_t* src, int src_line_size, int src_width, int src_heig...
{"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "Cuda", "repo_name": "minhanghuang/tensorrtx", "path": "yolov5/src/preprocess.cu", "license": "mit", "size": 4566}
### File: yolov5/src/preprocess.h #pragma once #include <cuda_runtime.h> #include <cstdint> #include <opencv2/opencv.hpp> void cuda_preprocess_init(int max_image_size); void cuda_preprocess_destroy(); void cuda_preprocess(uint8_t* src, int src_width, int src_height, float* dst, int dst_width, int...
{"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "C++", "repo_name": "minhanghuang/tensorrtx", "path": "yolov5/src/preprocess.h", "license": "mit", "size": 522}
### File: yolov5/src/types.h #pragma once #include "config.h" struct YoloKernel { int width; int height; float anchors[kNumAnchor * 2]; }; struct alignas(float) Detection { float bbox[4]; // center_x center_y w h float conf; // bbox_conf * cls_conf float class_id; float mask[32]; };
{"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "C", "repo_name": "minhanghuang/tensorrtx", "path": "yolov5/src/types.h", "license": "mit", "size": 275}
### File: yolov5/src/utils.h #pragma once #include <dirent.h> #include <fstream> #include <unordered_map> #include <string> #include <sstream> #include <vector> #include <cstring> static inline int read_files_in_dir(const char* p_dir_name, std::vector<std::string>& file_names) { DIR *p_dir = opendir(p_dir_name); ...
{"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "C++", "repo_name": "minhanghuang/tensorrtx", "path": "yolov5/src/utils.h", "license": "mit", "size": 2012}
### File: yolov5/yolov5_cls.cpp #include "cuda_utils.h" #include "logging.h" #include "utils.h" #include "model.h" #include "config.h" #include <iostream> #include <chrono> #include <cmath> #include <numeric> #include <opencv2/opencv.hpp> using namespace nvinfer1; static Logger gLogger; const static int kOutputSize ...
{"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "C++", "repo_name": "minhanghuang/tensorrtx", "path": "yolov5/yolov5_cls.cpp", "license": "mit", "size": 9467}
### File: yolov5/yolov5_cls_trt.py """ An example that uses TensorRT's Python api to make inferences. """ import os import shutil import sys import threading import time import cv2 import numpy as np import torch import pycuda.autoinit import pycuda.driver as cuda import tensorrt as trt def get_img_path_batches(batch...
{"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "Python", "repo_name": "minhanghuang/tensorrtx", "path": "yolov5/yolov5_cls_trt.py", "license": "mit", "size": 8902}
### File: yolov5/yolov5_det.cpp #include "cuda_utils.h" #include "logging.h" #include "utils.h" #include "preprocess.h" #include "postprocess.h" #include "model.h" #include <iostream> #include <chrono> #include <cmath> using namespace nvinfer1; static Logger gLogger; const static int kOutputSize = kMaxNumOutputBbox ...
{"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "C++", "repo_name": "minhanghuang/tensorrtx", "path": "yolov5/yolov5_det.cpp", "license": "mit", "size": 7785}
### File: yolov5/yolov5_det_cuda_python.py """ An example that uses TensorRT's Python api to make inferences. """ import ctypes import os import shutil import random import sys import threading import time import cv2 import numpy as np from cuda import cudart import tensorrt as trt CONF_THRESH = 0.5 IOU_THRESHOLD = 0....
{"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "Python", "repo_name": "minhanghuang/tensorrtx", "path": "yolov5/yolov5_det_cuda_python.py", "license": "mit", "size": 18390}
### File: yolov5/yolov5_det_trt.py """ An example that uses TensorRT's Python api to make inferences. """ import ctypes import os import shutil import random import sys import threading import time import cv2 import numpy as np import pycuda.autoinit import pycuda.driver as cuda import tensorrt as trt CONF_THRESH = 0....
{"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "Python", "repo_name": "minhanghuang/tensorrtx", "path": "yolov5/yolov5_det_trt.py", "license": "mit", "size": 18301}
### File: yolov5/yolov5_seg.cpp #include "config.h" #include "cuda_utils.h" #include "logging.h" #include "utils.h" #include "preprocess.h" #include "postprocess.h" #include "model.h" #include <iostream> #include <chrono> #include <cmath> using namespace nvinfer1; static Logger gLogger; const static int kOutputSize1...
{"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "C++", "repo_name": "minhanghuang/tensorrtx", "path": "yolov5/yolov5_seg.cpp", "license": "mit", "size": 8799}
### File: yolov5/yolov5_seg_trt.py """ An example that uses TensorRT's Python api to make inferences. """ import ctypes import os import shutil import random import sys import threading import time import cv2 import numpy as np import pycuda.autoinit import pycuda.driver as cuda import tensorrt as trt CONF_THRESH = 0....
{"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "Python", "repo_name": "minhanghuang/tensorrtx", "path": "yolov5/yolov5_seg_trt.py", "license": "mit", "size": 22822}
### File: yolov7/CMakeLists.txt cmake_minimum_required(VERSION 3.10) project(yolov7) add_definitions(-std=c++11) add_definitions(-DAPI_EXPORTS) set(CMAKE_CXX_STANDARD 11) set(CMAKE_BUILD_TYPE Debug) set(CMAKE_CUDA_COMPILER /usr/local/cuda/bin/nvcc) enable_language(CUDA) include_directories(${PROJECT_SOURCE_DIR}/inc...
{"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "CMake", "repo_name": "minhanghuang/tensorrtx", "path": "yolov7/CMakeLists.txt", "license": "mit", "size": 1393}
### File: yolov7/gen_wts.py import sys import argparse import os import struct import torch from utils.torch_utils import select_device def parse_args(): parser = argparse.ArgumentParser(description='Convert .pt file to .wts') parser.add_argument('-w', '--weights', required=True, help='Input weights (.pt) fil...
{"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "Python", "repo_name": "minhanghuang/tensorrtx", "path": "yolov7/gen_wts.py", "license": "mit", "size": 1758}
### File: yolov7/include/block.h #pragma once #include "NvInfer.h" #include <string> #include <vector> #include <map> std::map<std::string, nvinfer1::Weights> loadWeights(const std::string file); nvinfer1::IElementWiseLayer* convBnSilu(nvinfer1::INetworkDefinition* network, std::map<std::string, nvinfer1::Weights>& ...
{"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "C++", "repo_name": "minhanghuang/tensorrtx", "path": "yolov7/include/block.h", "license": "mit", "size": 1531}
### File: yolov7/include/calibrator.h #ifndef ENTROPY_CALIBRATOR_H #define ENTROPY_CALIBRATOR_H #include <NvInfer.h> #include <string> #include <vector> #include "macros.h" //! \class Int8EntropyCalibrator2 //! //! \brief Implements Entropy calibrator 2. //! CalibrationAlgoType is kENTROPY_CALIBRATION_2. //! class I...
{"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "C++", "repo_name": "minhanghuang/tensorrtx", "path": "yolov7/include/calibrator.h", "license": "mit", "size": 1245}
### File: yolov7/include/config.h #pragma once /* -------------------------------------------------------- * These configs are related to tensorrt model, if these are changed, * please re-compile and re-serialize the tensorrt model. * --------------------------------------------------------*/ // For INT8, you need...
{"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "C", "repo_name": "minhanghuang/tensorrtx", "path": "yolov7/include/config.h", "license": "mit", "size": 1769}
### File: yolov7/include/cuda_utils.h #ifndef TRTX_CUDA_UTILS_H_ #define TRTX_CUDA_UTILS_H_ #include <cuda_runtime_api.h> #ifndef CUDA_CHECK #define CUDA_CHECK(callstr)\ {\ cudaError_t error_code = callstr;\ if (error_code != cudaSuccess) {\ std::cerr << "CUDA error " << error_code << ...
{"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "C++", "repo_name": "minhanghuang/tensorrtx", "path": "yolov7/include/cuda_utils.h", "license": "mit", "size": 417}
### File: yolov7/include/logging.h /* * Copyright (c) 2019, NVIDIA CORPORATION. All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licen...
{"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "C++", "repo_name": "minhanghuang/tensorrtx", "path": "yolov7/include/logging.h", "license": "mit", "size": 16584}
### File: yolov7/include/macros.h #ifndef __MACROS_H #define __MACROS_H #include "NvInfer.h" #ifdef API_EXPORTS #if defined(_MSC_VER) #define API __declspec(dllexport) #else #define API __attribute__((visibility("default"))) #endif #else #if defined(_MSC_VER) #define API __declspec(dllimport) #else #define API #endi...
{"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "C", "repo_name": "minhanghuang/tensorrtx", "path": "yolov7/include/macros.h", "license": "mit", "size": 484}
### File: yolov7/include/model.h #pragma once #include "NvInfer.h" #include <string> nvinfer1::IHostMemory* build_engine_yolov7e6e(unsigned int maxBatchSize, nvinfer1::IBuilder* builder, nvinfer1::IBuilderConfig* config, nvinfer1::DataType dt, const std::string& wts_path); nvinfer1::IHostMemory* build_engine_yolov7d6...
{"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "C++", "repo_name": "minhanghuang/tensorrtx", "path": "yolov7/include/model.h", "license": "mit", "size": 1365}
### File: yolov7/include/postprocess.h #pragma once #include "types.h" #include <opencv2/opencv.hpp> cv::Rect get_rect(cv::Mat& img, float bbox[4]); void nms(std::vector<Detection>& res, float *output, float conf_thresh, float nms_thresh = 0.5); void batch_nms(std::vector<std::vector<Detection>>& batch_res, float *...
{"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "C++", "repo_name": "minhanghuang/tensorrtx", "path": "yolov7/include/postprocess.h", "license": "mit", "size": 465}
### File: yolov7/include/preprocess.h #pragma once #include <cuda_runtime.h> #include <cstdint> #include <opencv2/opencv.hpp> void cuda_preprocess_init(int max_image_size); void cuda_preprocess_destroy(); void cuda_preprocess(uint8_t* src, int src_width, int src_height, float* dst, int dst_width,...
{"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "C++", "repo_name": "minhanghuang/tensorrtx", "path": "yolov7/include/preprocess.h", "license": "mit", "size": 522}
### File: yolov7/include/types.h #pragma once #include "config.h" struct YoloKernel { int width; int height; float anchors[kNumAnchor * 2]; }; struct alignas(float) Detection { //center_x center_y w h float bbox[4]; float conf; // bbox_conf * cls_conf float class_id; };
{"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "C", "repo_name": "minhanghuang/tensorrtx", "path": "yolov7/include/types.h", "license": "mit", "size": 257}
### File: yolov7/include/utils.h #ifndef TRTX_YOLOV7_UTILS_H_ #define TRTX_YOLOV7_UTILS_H_ #include <dirent.h> #include <opencv2/opencv.hpp> static inline cv::Mat preprocess_img(cv::Mat& img, int input_w, int input_h) { int w, h, x, y; float r_w = input_w / (img.cols*1.0); float r_h = input_h / (img.rows*...
{"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "C++", "repo_name": "minhanghuang/tensorrtx", "path": "yolov7/include/utils.h", "license": "mit", "size": 1463}
### File: yolov7/main.cpp #include "config.h" #include "model.h" #include "cuda_utils.h" #include "logging.h" #include "utils.h" #include "preprocess.h" #include "postprocess.h" #include <chrono> #include <fstream> using namespace nvinfer1; const static int kOutputSize = kMaxNumOutputBbox * sizeof(Detection) / sizeof...
{"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "C++", "repo_name": "minhanghuang/tensorrtx", "path": "yolov7/main.cpp", "license": "mit", "size": 7780}
### File: yolov7/plugin/yololayer.cu #include "yololayer.h" #include "cuda_utils.h" #include <assert.h> #include <vector> #include <iostream> namespace Tn { template<typename T> void write(char*& buffer, const T& val) { *reinterpret_cast<T*>(buffer) = val; buffer += sizeof(T); } template<typename T> void read(con...
{"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "Cuda", "repo_name": "minhanghuang/tensorrtx", "path": "yolov7/plugin/yololayer.cu", "license": "mit", "size": 10532}
### File: yolov7/plugin/yololayer.h #pragma once #include "macros.h" #include "types.h" #include <vector> #include <string> namespace nvinfer1 { class API YoloLayerPlugin : public IPluginV2IOExt { public: YoloLayerPlugin(int classCount, int netWidth, int netHeight, int maxOut, const std::vector<YoloKernel>& vYoloK...
{"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "C++", "repo_name": "minhanghuang/tensorrtx", "path": "yolov7/plugin/yololayer.h", "license": "mit", "size": 3580}
### File: yolov7/src/block.cpp #include "block.h" #include "yololayer.h" #include "NvInfer.h" #include <iostream> #include <fstream> #include <assert.h> #include <cmath> #include <cstring> using namespace nvinfer1; // TensorRT weight files have a simple space delimited format: // [type] [size] <data x size in hex> s...
{"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "C++", "repo_name": "minhanghuang/tensorrtx", "path": "yolov7/src/block.cpp", "license": "mit", "size": 11447}
### File: yolov7/src/calibrator.cpp #include <iostream> #include <iterator> #include <fstream> #include <opencv2/dnn/dnn.hpp> #include "calibrator.h" #include "cuda_utils.h" #include "utils.h" Int8EntropyCalibrator2::Int8EntropyCalibrator2(int batchsize, int input_w, int input_h, const char* img_dir, const char* calib...
{"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "C++", "repo_name": "minhanghuang/tensorrtx", "path": "yolov7/src/calibrator.cpp", "license": "mit", "size": 2849}
### File: yolov7/src/model.cpp #include "model.h" #include "block.h" // #include "yololayer.h" #include "config.h" #include "calibrator.h" #include <iostream> #include <cassert> using namespace nvinfer1; IHostMemory* build_engine_yolov7e6e(unsigned int maxBatchSize, IBuilder* builder, IBuilderConfig* config, DataType...
{"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "C++", "repo_name": "minhanghuang/tensorrtx", "path": "yolov7/src/model.cpp", "license": "mit", "size": 151508}
### File: yolov7/src/postprocess.cpp #include "postprocess.h" cv::Rect get_rect(cv::Mat& img, float bbox[4]) { float l, r, t, b; float r_w = kInputW / (img.cols * 1.0); float r_h = kInputH / (img.rows * 1.0); if (r_h > r_w) { l = bbox[0] - bbox[2] / 2.f; r = bbox[0] + bbox[2] / 2.f; t = bbox[1] - b...
{"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "C++", "repo_name": "minhanghuang/tensorrtx", "path": "yolov7/src/postprocess.cpp", "license": "mit", "size": 3301}
### File: yolov7/src/preprocess.cu #include "preprocess.h" #include "cuda_utils.h" static uint8_t* img_buffer_host = nullptr; static uint8_t* img_buffer_device = nullptr; struct AffineMatrix{ float value[6]; }; __global__ void warpaffine_kernel( uint8_t* src, int src_line_size, int src_width, int src_heigh...
{"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "Cuda", "repo_name": "minhanghuang/tensorrtx", "path": "yolov7/src/preprocess.cu", "license": "mit", "size": 4561}
### File: yolov7/yolov7_trt.py """ An example that uses TensorRT's Python api to make inferences. """ import ctypes import os import shutil import random import sys import threading import time import cv2 import numpy as np import pycuda.autoinit import pycuda.driver as cuda import tensorrt as trt CONF_THRESH = 0.5 IO...
{"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "Python", "repo_name": "minhanghuang/tensorrtx", "path": "yolov7/yolov7_trt.py", "license": "mit", "size": 18193}
### File: yolov8/CMakeLists.txt cmake_minimum_required(VERSION 3.10) project(yolov8) add_definitions(-std=c++11) add_definitions(-DAPI_EXPORTS) set(CMAKE_CXX_STANDARD 11) set(CMAKE_BUILD_TYPE Debug) set(CMAKE_CUDA_COMPILER /usr/local/cuda/bin/nvcc) enable_language(CUDA) include_directories(${PROJECT_SOURCE_DIR}/inc...
{"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "CMake", "repo_name": "minhanghuang/tensorrtx", "path": "yolov8/CMakeLists.txt", "license": "mit", "size": 1539}
### File: yolov8/gen_wts.py import sys import argparse import os import struct import torch pt_file = "./weights/yolov8s.pt" wts_file = "./weights/yolov8s.wts" # Initialize device = 'cpu' # Load model model = torch.load(pt_file, map_location=device)['model'].float() # load to FP32 anchor_grid = model.model[-1].anc...
{"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "Python", "repo_name": "minhanghuang/tensorrtx", "path": "yolov8/gen_wts.py", "license": "mit", "size": 747}
### File: yolov8/include/block.h #pragma once #include <map> #include <vector> #include <string> #include "NvInfer.h" std::map<std::string, nvinfer1::Weights> loadWeights(const std::string file); nvinfer1::IElementWiseLayer* convBnSiLU(nvinfer1::INetworkDefinition* network, std::map<std::string, nvinfer1::Weights> we...
{"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "C++", "repo_name": "minhanghuang/tensorrtx", "path": "yolov8/include/block.h", "license": "mit", "size": 1124}
### File: yolov8/include/calibrator.h #ifndef ENTROPY_CALIBRATOR_H #define ENTROPY_CALIBRATOR_H #include <NvInfer.h> #include <string> #include <vector> #include "macros.h" //! \class Int8EntropyCalibrator2 //! //! \brief Implements Entropy calibrator 2. //! CalibrationAlgoType is kENTROPY_CALIBRATION_2. //! class I...
{"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "C++", "repo_name": "minhanghuang/tensorrtx", "path": "yolov8/include/calibrator.h", "license": "mit", "size": 1244}
### File: yolov8/include/config.h #define USE_FP16 //#define USE_INT8 const static char *kInputTensorName = "images"; const static char *kOutputTensorName = "output"; const static int kNumClass = 80; const static int kBatchSize = 1; const static int kGpuId = 0; const static int kInputH = 640; const static int kInputW ...
{"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "C", "repo_name": "minhanghuang/tensorrtx", "path": "yolov8/include/config.h", "license": "mit", "size": 465}
### File: yolov8/include/cuda_utils.h #ifndef TRTX_CUDA_UTILS_H_ #define TRTX_CUDA_UTILS_H_ #include <cuda_runtime_api.h> #ifndef CUDA_CHECK #define CUDA_CHECK(callstr)\ {\ cudaError_t error_code = callstr;\ if (error_code != cudaSuccess) {\ std::cerr << "CUDA error " << error_code << ...
{"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "C++", "repo_name": "minhanghuang/tensorrtx", "path": "yolov8/include/cuda_utils.h", "license": "mit", "size": 417}
### File: yolov8/include/logging.h /* * Copyright (c) 2019, NVIDIA CORPORATION. All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licen...
{"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "C++", "repo_name": "minhanghuang/tensorrtx", "path": "yolov8/include/logging.h", "license": "mit", "size": 16584}
### File: yolov8/include/macros.h #ifndef __MACROS_H #define __MACROS_H #include "NvInfer.h" #ifdef API_EXPORTS #if defined(_MSC_VER) #define API __declspec(dllexport) #else #define API __attribute__((visibility("default"))) #endif #else #if defined(_MSC_VER) #define API __declspec(dllimport) #else #define API #endi...
{"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "C", "repo_name": "minhanghuang/tensorrtx", "path": "yolov8/include/macros.h", "license": "mit", "size": 484}
### File: yolov8/include/model.h #pragma once #include "NvInfer.h" #include <string> #include <assert.h> nvinfer1::IHostMemory* buildEngineYolov8n(nvinfer1::IBuilder* builder, nvinfer1::IBuilderConfig* config, nvinfer1::DataType dt, const std::string& wts_path); nvinfer1::IHostMemory* buildEngineYolov8s(nvinfer1::IBu...
{"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "C++", "repo_name": "minhanghuang/tensorrtx", "path": "yolov8/include/model.h", "license": "mit", "size": 867}
### File: yolov8/include/postprocess.h #pragma once #include "types.h" #include "NvInfer.h" #include <opencv2/opencv.hpp> cv::Rect get_rect(cv::Mat& img, float bbox[4]); void nms(std::vector<Detection>& res, float *output, float conf_thresh, float nms_thresh = 0.5); void batch_nms(std::vector<std::vector<Detection>...
{"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "C++", "repo_name": "minhanghuang/tensorrtx", "path": "yolov8/include/postprocess.h", "license": "mit", "size": 1011}
### File: yolov8/include/preprocess.h #pragma once #include <opencv2/opencv.hpp> #include "NvInfer.h" #include "types.h" #include <map> void cuda_preprocess_init(int max_image_size); void cuda_preprocess_destroy(); void cuda_preprocess(uint8_t *src, int src_width, int src_height, float *dst, int dst_width, int dst...
{"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "C++", "repo_name": "minhanghuang/tensorrtx", "path": "yolov8/include/preprocess.h", "license": "mit", "size": 440}
### File: yolov8/include/types.h #pragma once #include "config.h" struct alignas(float) Detection { //center_x center_y w h float bbox[4]; float conf; // bbox_conf * cls_conf float class_id; }; struct AffineMatrix { float value[6]; }; const int bbox_element = sizeof(AffineMatrix) / sizeof(float)+1; ...
{"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "C", "repo_name": "minhanghuang/tensorrtx", "path": "yolov8/include/types.h", "license": "mit", "size": 345}
### File: yolov8/include/utils.h #pragma once #include <opencv2/opencv.hpp> #include <dirent.h> static inline cv::Mat preprocess_img(cv::Mat& img, int input_w, int input_h) { int w, h, x, y; float r_w = input_w / (img.cols*1.0); float r_h = input_h / (img.rows*1.0); if (r_h > r_w) { w = input_w...
{"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "C++", "repo_name": "minhanghuang/tensorrtx", "path": "yolov8/include/utils.h", "license": "mit", "size": 1383}
### File: yolov8/main.cpp #include <iostream> #include <fstream> #include <opencv2/opencv.hpp> #include "model.h" #include "utils.h" #include "preprocess.h" #include "postprocess.h" #include "cuda_utils.h" #include "logging.h" Logger gLogger; using namespace nvinfer1; const int kOutputSize = kMaxNumOutputBbox * sizeo...
{"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "C++", "repo_name": "minhanghuang/tensorrtx", "path": "yolov8/main.cpp", "license": "mit", "size": 9923}
### File: yolov8/plugin/yololayer.cu #include "yololayer.h" #include "types.h" #include <assert.h> #include <math.h> #include "cuda_utils.h" #include <vector> #include <iostream> namespace Tn { template<typename T> void write(char*& buffer, const T& val) { *reinterpret_cast<T*>(buffer) = val; b...
{"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "Cuda", "repo_name": "minhanghuang/tensorrtx", "path": "yolov8/plugin/yololayer.cu", "license": "mit", "size": 8059}