text stringlengths 24 1.04M | metadata stringlengths 233 497 |
|---|---|
### File: resnet/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": "resnet/logging.h", "license": "mit", "size": 16550} |
### File: resnet/resnet18.cpp
#include "NvInfer.h"
#include "cuda_runtime_api.h"
#include "logging.h"
#include <fstream>
#include <iostream>
#include <map>
#include <sstream>
#include <vector>
#include <chrono>
#include <cmath>
#define CHECK(status) \
do\
{\
auto ret = (status);\
if (ret != 0)\... | {"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": "resnet/resnet18.cpp", "license": "mit", "size": 12873} |
### File: resnet/resnet34.cpp
#include "NvInfer.h"
#include "cuda_runtime_api.h"
#include "logging.h"
#include <fstream>
#include <iostream>
#include <map>
#include <sstream>
#include <vector>
#include <chrono>
#include <cmath>
#define CHECK(status) \
do\
{\
auto ret = (status);\
if(ret != 0)\
... | {"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": "resnet/resnet34.cpp", "license": "mit", "size": 13765} |
### File: resnet/resnet50.cpp
#include "NvInfer.h"
#include "cuda_runtime_api.h"
#include "logging.h"
#include <fstream>
#include <iostream>
#include <map>
#include <sstream>
#include <vector>
#include <chrono>
#include <cmath>
#define CHECK(status) \
do\
{\
auto ret = (status);\
if (ret != 0)\... | {"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": "resnet/resnet50.cpp", "license": "mit", "size": 13861} |
### File: resnet/resnet50.py
import argparse
import os
import struct
import sys
import numpy as np
import pycuda.autoinit # noqa
import pycuda.driver as cuda
import tensorrt as trt
BATCH_SIZE = 1
INPUT_H = 224
INPUT_W = 224
OUTPUT_SIZE = 1000
INPUT_BLOB_NAME = "data"
OUTPUT_BLOB_NAME = "prob"
EPS = 1e-5
WEIGHT_PATH... | {"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": "resnet/resnet50.py", "license": "mit", "size": 10214} |
### File: resnet/resnext50_32x4d.cpp
#include "NvInfer.h"
#include "cuda_runtime_api.h"
#include "logging.h"
#include <fstream>
#include <iostream>
#include <map>
#include <sstream>
#include <vector>
#include <chrono>
#include <cmath>
#define CHECK(status) \
do\
{\
auto ret = (status);\
if (ret... | {"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": "resnet/resnext50_32x4d.cpp", "license": "mit", "size": 13884} |
### File: resnet/wide_resnet50.py
import os
import sys
import struct
import argparse
import numpy as np
import pycuda.autoinit
import pycuda.driver as cuda
import tensorrt as trt
BATCH_SIZE = 1
INPUT_H = 224
INPUT_W = 224
OUTPUT_SIZE = 1000
BS = 1
INPUT_BLOB_NAME = "data"
OUTPUT_BLOB_NAME = "prob"
EPS = 1e-5
WEIGHT_... | {"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": "resnet/wide_resnet50.py", "license": "mit", "size": 9733} |
### File: resnet/wideresnet50.cpp
#include "NvInfer.h"
#include "cuda_runtime_api.h"
#include "logging.h"
#include <fstream>
#include <iostream>
#include <map>
#include <sstream>
#include <vector>
#include <chrono>
#include <cmath>
#define CHECK(status) \
do\
{\
auto ret = (status);\
if (ret !=... | {"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": "resnet/wideresnet50.cpp", "license": "mit", "size": 13872} |
### File: retinaface/CMakeLists.txt
cmake_minimum_required(VERSION 2.6)
project(retinaface)
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)
if (CMAKE_SYSTEM_PROCESSOR MATCHES "aarch64")
message("embed_platfo... | {"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": "retinaface/CMakeLists.txt", "license": "mit", "size": 1476} |
### File: retinaface/calibrator.cpp
#include <iostream>
#include <iterator>
#include <fstream>
#include <opencv2/dnn/dnn.hpp>
#include "calibrator.h"
#include "cuda_runtime_api.h"
#include "common.hpp"
Int8EntropyCalibrator2::Int8EntropyCalibrator2(int batchsize, int input_w, int input_h, const char* img_dir, const ch... | {"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": "retinaface/calibrator.cpp", "license": "mit", "size": 2842} |
### File: retinaface/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 Int8E... | {"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": "retinaface/calibrator.h", "license": "mit", "size": 1245} |
### File: retinaface/common.hpp
#ifndef RETINAFACE_COMMON_H_
#define RETINAFACE_COMMON_H_
#include <opencv2/opencv.hpp>
#include <dirent.h>
#include "NvInfer.h"
#include "decode.h"
using namespace nvinfer1;
#define CHECK(status) \
do\
{\
auto ret = (status);\
if (ret != 0)\
{\
... | {"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": "retinaface/common.hpp", "license": "mit", "size": 7118} |
### File: retinaface/decode.cu
#include "decode.h"
#include "stdio.h"
namespace nvinfer1
{
DecodePlugin::DecodePlugin()
{
}
DecodePlugin::~DecodePlugin()
{
}
// create the plugin at runtime from a byte stream
DecodePlugin::DecodePlugin(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": "Cuda", "repo_name": "minhanghuang/tensorrtx", "path": "retinaface/decode.cu", "license": "mit", "size": 9098} |
### File: retinaface/decode.h
#ifndef _DECODE_CU_H
#define _DECODE_CU_H
#include <string>
#include <vector>
#include "NvInfer.h"
#include "macros.h"
namespace decodeplugin
{
struct alignas(float) Detection{
float bbox[4]; //x1 y1 x2 y2
float class_confidence;
float landmark[10];
};
... | {"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": "retinaface/decode.h", "license": "mit", "size": 4179} |
### File: retinaface/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": "retinaface/logging.h", "license": "mit", "size": 16584} |
### File: retinaface/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": "retinaface/macros.h", "license": "mit", "size": 211} |
### File: retinaface/retina_mnet.cpp
#include <fstream>
#include <iostream>
#include <map>
#include <sstream>
#include <vector>
#include <chrono>
#include "cuda_runtime_api.h"
#include "logging.h"
#include "common.hpp"
#include "calibrator.h"
#define USE_FP16 // set USE_INT8 or USE_FP16 or USE_FP32
#define DEVICE 0 ... | {"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": "retinaface/retina_mnet.cpp", "license": "mit", "size": 18916} |
### File: retinaface/retina_r50.cpp
#include <fstream>
#include <iostream>
#include <map>
#include <sstream>
#include <vector>
#include <chrono>
#include "cuda_runtime_api.h"
#include "logging.h"
#include "common.hpp"
#include "calibrator.h"
#define USE_INT8 // set USE_INT8 or USE_FP16 or USE_FP32
#define DEVICE 0 /... | {"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": "retinaface/retina_r50.cpp", "license": "mit", "size": 19857} |
### File: retinaface/retinaface_trt.py
"""
Use TensorRT's Python api to make inferences.
"""
# -*- coding: utf-8 -*
import ctypes
import os
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
import torch
import ... | {"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": "retinaface/retinaface_trt.py", "license": "mit", "size": 12131} |
### File: retinafaceAntiCov/CMakeLists.txt
cmake_minimum_required(VERSION 2.6)
project(retinafaceAntiCov)
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 (CM... | {"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": "retinafaceAntiCov/CMakeLists.txt", "license": "mit", "size": 1186} |
### File: retinafaceAntiCov/decode.cu
#include "decode.h"
#include "stdio.h"
namespace nvinfer1
{
DecodePlugin::DecodePlugin()
{
}
DecodePlugin::~DecodePlugin()
{
}
// create the plugin at runtime from a byte stream
DecodePlugin::DecodePlugin(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": "Cuda", "repo_name": "minhanghuang/tensorrtx", "path": "retinafaceAntiCov/decode.cu", "license": "mit", "size": 7559} |
### File: retinafaceAntiCov/decode.h
#ifndef _DECODE_CU_H
#define _DECODE_CU_H
#include <string>
#include <vector>
#include "NvInfer.h"
namespace decodeplugin
{
struct alignas(float) Detection{
float bbox[4]; //x1 y1 x2 y2
float class_confidence;
float landmark[10];
float mask_con... | {"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": "retinafaceAntiCov/decode.h", "license": "mit", "size": 3758} |
### File: retinafaceAntiCov/gen_wts.py
import struct
from retinaface_cov import RetinaFaceCoV
gpuid = 0
model = RetinaFaceCoV('./cov2/mnet_cov2', 0, gpuid, 'net3l')
f = open('retinafaceAntiCov.wts', 'w')
f.write('{}\n'.format(len(model.model.get_params()[0].keys()) + len(model.model.get_params()[1].keys())))
for k, v... | {"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": "retinafaceAntiCov/gen_wts.py", "license": "mit", "size": 736} |
### File: retinafaceAntiCov/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/li... | {"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": "retinafaceAntiCov/logging.h", "license": "mit", "size": 16550} |
### File: retinafaceAntiCov/retinafaceAntiCov.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 "decode.h"
#define CHECK(stat... | {"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": "retinafaceAntiCov/retinafaceAntiCov.cpp", "license": "mit", "size": 27271} |
### File: scaled-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 di... | {"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": "scaled-yolov4/CMakeLists.txt", "license": "mit", "size": 1141} |
### File: scaled-yolov4/common.hpp
#include <fstream>
#include <map>
#include <sstream>
#include <vector>
#include <opencv2/opencv.hpp>
#include "NvInfer.h"
#include "yololayer.h"
#include "mish.h"
using namespace nvinfer1;
cv::Mat preprocess_img(cv::Mat& img) {
int w, h, x, y;
float r_w = Yolo::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": "scaled-yolov4/common.hpp", "license": "mit", "size": 7051} |
### File: scaled-yolov4/gen_wts.py
import struct
import sys
from models.models import *
from utils import *
model = Darknet('models/yolov4-csp.cfg', (512, 512))
weights = sys.argv[1]
device = torch_utils.select_device('0')
if weights.endswith('.pt'): # pytorch format
model.load_state_dict(torch.load(weights, map_... | {"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": "scaled-yolov4/gen_wts.py", "license": "mit", "size": 731} |
### File: scaled-yolov4/logging.h
/*
* Copyright (c) 2021, 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/licens... | {"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": "scaled-yolov4/logging.h", "license": "mit", "size": 16650} |
### File: scaled-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 ... | {"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": "scaled-yolov4/mish.cu", "license": "mit", "size": 5753} |
### File: scaled-yolov4/mish.h
#ifndef TRTX_MISH_PLUGIN_H
#define TRTX_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": "scaled-yolov4/mish.h", "license": "mit", "size": 3562} |
### File: scaled-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": "scaled-yolov4/utils.h", "license": "mit", "size": 1182} |
### File: scaled-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(y... | {"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": "scaled-yolov4/yololayer.cu", "license": "mit", "size": 9472} |
### File: scaled-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 const... | {"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": "scaled-yolov4/yololayer.h", "license": "mit", "size": 4661} |
### File: scaled-yolov4/yolov4_csp.cpp
#include <iostream>
#include <chrono>
#include <dirent.h>
#include "logging.h"
#include "utils.h"
#include "cuda_runtime_api.h"
#include "common.hpp"
#define USE_FP16 // comment out this if want to use FP32
#define DEVICE 0 // GPU id
#define NMS_THRESH 0.4
#define BBOX_CONF_TH... | {"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": "scaled-yolov4/yolov4_csp.cpp", "license": "mit", "size": 27365} |
### File: senet/CMakeLists.txt
cmake_minimum_required(VERSION 2.6)
project(senet)
add_definitions(-std=c++11)
option(CUDA_USE_STATIC_CUDA_RUNTIME OFF)
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_BUILD_TYPE Debug)
include_directories(${PROJECT_SOURCE_DIR}/include)
# include and link dirs of cuda and tensorrt, you need adap... | {"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": "senet/CMakeLists.txt", "license": "mit", "size": 697} |
### File: senet/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/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": "senet/logging.h", "license": "mit", "size": 16550} |
### File: senet/se_resnet50.cpp
#include "NvInfer.h"
#include "cuda_runtime_api.h"
#include "logging.h"
#include <fstream>
#include <iostream>
#include <map>
#include <sstream>
#include <vector>
#include <chrono>
#include <cmath>
#define CHECK(status) \
do\
{\
auto ret = (status);\
if (ret != 0... | {"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": "senet/se_resnet50.cpp", "license": "mit", "size": 14738} |
### File: shufflenetv2/CMakeLists.txt
cmake_minimum_required(VERSION 2.6)
project(shufflenet)
add_definitions(-std=c++11)
option(CUDA_USE_STATIC_CUDA_RUNTIME OFF)
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_BUILD_TYPE Debug)
include_directories(${PROJECT_SOURCE_DIR}/include)
# include and link dirs of cuda and tensorrt, y... | {"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": "shufflenetv2/CMakeLists.txt", "license": "mit", "size": 707} |
### File: shufflenetv2/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/license... | {"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": "shufflenetv2/logging.h", "license": "mit", "size": 16550} |
### File: shufflenetv2/shufflenet_v2.cpp
#include "NvInfer.h"
#include "cuda_runtime_api.h"
#include "logging.h"
#include <fstream>
#include <iostream>
#include <map>
#include <sstream>
#include <vector>
#include <chrono>
#include <cmath>
#define CHECK(status) \
do\
{\
auto ret = (status);\
if ... | {"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": "shufflenetv2/shufflenet_v2.cpp", "license": "mit", "size": 15874} |
### File: squeezenet/CMakeLists.txt
cmake_minimum_required(VERSION 2.6)
project(squeezenet)
add_definitions(-std=c++11)
option(CUDA_USE_STATIC_CUDA_RUNTIME OFF)
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_BUILD_TYPE Debug)
include_directories(${PROJECT_SOURCE_DIR}/include)
# include and link dirs of cuda and tensorrt, you... | {"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": "squeezenet/CMakeLists.txt", "license": "mit", "size": 704} |
### File: squeezenet/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": "squeezenet/logging.h", "license": "mit", "size": 16550} |
### File: squeezenet/squeezenet.cpp
#include "NvInfer.h"
#include "cuda_runtime_api.h"
#include "logging.h"
#include <fstream>
#include <iostream>
#include <map>
#include <sstream>
#include <vector>
#include <chrono>
#define CHECK(status) \
do\
{\
auto ret = (status);\
if (ret != 0)\
{\... | {"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": "squeezenet/squeezenet.cpp", "license": "mit", "size": 11165} |
### File: superpoint/CMakeLists.txt
cmake_minimum_required(VERSION 2.6)
project(SuperPointNet)
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 lin... | {"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": "superpoint/CMakeLists.txt", "license": "mit", "size": 989} |
### File: superpoint/gen_wts.py
import torch
import struct
from model import SuperPointNet
model_name = "superpoint_v1"
net = SuperPointNet()
net.load_state_dict(torch.load("superpoint_v1.pth"))
net = net.cuda()
net.eval()
f = open(model_name + ".wts", "w")
f.write("{}\n".format(len(net.state_dict().keys())))
for k,... | {"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": "superpoint/gen_wts.py", "license": "mit", "size": 505} |
### File: superpoint/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": "superpoint/logging.h", "license": "mit", "size": 16968} |
### File: superpoint/supernet.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"
//#define USE_FP16 // comment out ... | {"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": "superpoint/supernet.cpp", "license": "mit", "size": 8138} |
### File: superpoint/utils.cpp
#include "utils.h"
#include <dirent.h>
#include <string.h>
// Load weights from files shared with TensorRT samples.
// TensorRT weight files have a simple space delimited format:
// [type] [size] <data x size in hex>
std::map<std::string, Weights> loadWeights(const std::string file)
{
... | {"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": "superpoint/utils.cpp", "license": "mit", "size": 2584} |
### File: superpoint/utils.h
#pragma once
#include <map>
#include "NvInfer.h"
#include "cuda_runtime_api.h"
#include "assert.h"
#include <fstream>
#include <iostream>
#include <memory>
#include <vector>
#include <opencv2/opencv.hpp>
using namespace nvinfer1;
#define CHECK(status) \
d... | {"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": "superpoint/utils.h", "license": "mit", "size": 982} |
### File: swin-transformer/semantic-segmentation/UpsampleKernel.cu
#include "UpsmapleKernel.h"
/**
* @brief caculate the number of cuda kernel for upsample. (Cite from: 《GPU高性能编程CUDA实战》P46,P47)
*
* @param total_thread_num: the number of cuda thread of you want to used for upsample
* @param max_thread_num:... | {"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": "swin-transformer/semantic-segmentation/UpsampleKernel.cu", "license": "mit", "size": 5008} |
### File: swin-transformer/semantic-segmentation/UpsamplePlugin.cpp
#include <iostream>
#include "UpsmapleKernel.h"
#include "UpsamplePlugin.h"
#include <cassert>
#include <cstring>
using namespace nvinfer1;
// Upsample plugin specific constants
namespace {
static const char* UPSAMPLE_PLUGIN_VERSION{"... | {"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": "swin-transformer/semantic-segmentation/UpsamplePlugin.cpp", "license": "mit", "size": 6711} |
### File: swin-transformer/semantic-segmentation/UpsamplePlugin.h
#ifndef UPSAMPLE_PLUGIN_H
#define UPSAMPLE_PLUGIN_H
#include "NvInferPlugin.h"
#include <string>
#include <vector>
using namespace nvinfer1;
class UpsamplePlugin : public IPluginV2
{
public:
UpsamplePlugin(const std::string name, 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": "swin-transformer/semantic-segmentation/UpsamplePlugin.h", "license": "mit", "size": 2520} |
### File: swin-transformer/semantic-segmentation/UpsmapleKernel.h
#ifndef UPSAMPLE_KERNEL_H
#define UPSAMPLE_KERNEL_H
#include <iostream>
#include "NvInfer.h"
int UpsampleInference(
cudaStream_t stream,
int n,
int input_b,
int input_c,
int input_h,
int input_w,
float scale_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": "swin-transformer/semantic-segmentation/UpsmapleKernel.h", "license": "mit", "size": 333} |
### File: swin-transformer/semantic-segmentation/common.hpp
#ifndef COMMON_HPP
#define COMMON_HPP
#include "layerNorm.h"
#include "NvInfer.h"
#include "NvInfer.h"
#include "NvInferPlugin.h"
#include "cuda_runtime_api.h"
#include <assert.h>
#include <map>
#include <fstream>
#include<opencv2/core/core.hpp>
#... | {"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": "swin-transformer/semantic-segmentation/common.hpp", "license": "mit", "size": 35695} |
### File: swin-transformer/semantic-segmentation/fillmask.cu
#include "fillmask.h"
#include <math.h>
namespace nvinfer1
{
fillmask::fillmask()
{
}
fillmask::~fillmask()
{
}
// create the plugin at runtime from a byte stream
fillmask::fillmask(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": "Cuda", "repo_name": "minhanghuang/tensorrtx", "path": "swin-transformer/semantic-segmentation/fillmask.cu", "license": "mit", "size": 5257} |
### File: swin-transformer/semantic-segmentation/fillmask.h
#ifndef FILLMASK_H
#define FILLMASK_H
#include <vector>
#include <string>
#include "NvInfer.h"
#include "myhpp.h"
#include <assert.h>
#include "utilsn.h"
namespace nvinfer1
{
class fillmask:public IPluginV2IOExt
{
public:
... | {"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": "swin-transformer/semantic-segmentation/fillmask.h", "license": "mit", "size": 3556} |
### File: swin-transformer/semantic-segmentation/gelu.cu
#include "gelu.h"
#include <math.h>
namespace nvinfer1
{
gelu::gelu()
{
}
gelu::~gelu()
{
}
// create the plugin at runtime from a byte stream
gelu::gelu(const void* data, size_t length)
{
const char *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": "swin-transformer/semantic-segmentation/gelu.cu", "license": "mit", "size": 5112} |
### File: swin-transformer/semantic-segmentation/gelu.h
#ifndef GELU_H
#define GELU_H
#include <vector>
#include <string>
#include "NvInfer.h"
#include "myhpp.h"
#include <assert.h>
#include "utilsn.h"
#define M_PI 3.14159265358979323846 // pi
namespace nvinfer1
{
class gelu:public IPluginV2IOE... | {"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": "swin-transformer/semantic-segmentation/gelu.h", "license": "mit", "size": 3557} |
### File: swin-transformer/semantic-segmentation/gen_wts.py
import torch
import struct
import sys
# Initialize
pt_file = sys.argv[1]
# Load model
model = torch.load(pt_file, map_location=torch.device('cpu'))['model'].float() # load to FP32
model.to(device).eval()
with open(pt_file.split('.')[0] + '.wts', '... | {"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": "swin-transformer/semantic-segmentation/gen_wts.py", "license": "mit", "size": 592} |
### File: swin-transformer/semantic-segmentation/include/dirent.h
/*
* Dirent interface for Microsoft Visual Studio
*
* Copyright (C) 1998-2019 Toni Ronkko
* This file is part of dirent. Dirent may be freely distributed
* under the MIT license. For all details and documentation, see
* https://github.com/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": "swin-transformer/semantic-segmentation/include/dirent.h", "license": "mit", "size": 27961} |
### File: swin-transformer/semantic-segmentation/layerNorm.cu
#include <assert.h>
#include "layerNorm.h"
#include "utilsn.h"
#include <assert.h>
#include <vector>
namespace nvinfer1
{
layernorm::layernorm()
{
}
layernorm::~layernorm()
{
}
layernorm::layernorm(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": "Cuda", "repo_name": "minhanghuang/tensorrtx", "path": "swin-transformer/semantic-segmentation/layerNorm.cu", "license": "mit", "size": 5268} |
### File: swin-transformer/semantic-segmentation/layerNorm.h
#ifndef LAYERNORM_H
#define LAYERNORM_H
#include <vector>
#include <string>
#include <iostream>
#include <NvInfer.h>
#include <memory>
#include <string.h>
#include <cstdint>
#include <stdlib.h>
using namespace std;
struct welford
{
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": "swin-transformer/semantic-segmentation/layerNorm.h", "license": "mit", "size": 3595} |
### File: swin-transformer/semantic-segmentation/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
*
* ... | {"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": "swin-transformer/semantic-segmentation/logging.h", "license": "mit", "size": 17053} |
### File: swin-transformer/semantic-segmentation/main.cpp
#include <iostream>
using namespace std;
| {"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": "swin-transformer/semantic-segmentation/main.cpp", "license": "mit", "size": 57} |
### File: swin-transformer/semantic-segmentation/myhpp.h
#ifndef MYHPP_H
#define MYHPP_H
#include <assert.h>
#include <iostream>
#include<vector>
#include<map>
#define _USE_MATH_DEFINES
#include <math.h>
#include <cmath>
#include<string>
#include<fstream>
#include<streambuf>
#include<ctime>
#include<chro... | {"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": "swin-transformer/semantic-segmentation/myhpp.h", "license": "mit", "size": 754} |
### File: swin-transformer/semantic-segmentation/trainsform.cpp
#include "common.hpp"
#include "logging.h"
#include <fstream>
#include <iostream>
#include <map>
#include <sstream>
#include <vector>
#include <chrono>
#define USE_FP32
static Logger gLogger;
const char *INPUT_BLOB_NAME = "data";
const cha... | {"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": "swin-transformer/semantic-segmentation/trainsform.cpp", "license": "mit", "size": 14553} |
### File: swin-transformer/semantic-segmentation/utilsn.h
#ifndef UTILSN_H
#define UTILSN_H
#include <iostream>
#include <vector>
#include <algorithm>
#include <cudnn.h>
#include <NvInfer.h>
#include "myhpp.h"
using namespace std;
#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": "swin-transformer/semantic-segmentation/utilsn.h", "license": "mit", "size": 3081} |
### File: tsm/CMakeLists.txt
cmake_minimum_required(VERSION 2.6)
project(TSM)
add_definitions(-std=c++11)
option(CUDA_USE_STATIC_CUDA_RUNTIME OFF)
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_BUILD_TYPE Debug)
include_directories(${PROJECT_SOURCE_DIR}/include)
# include and link dirs of cuda and tensorrt, you need adapt th... | {"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": "tsm/CMakeLists.txt", "license": "mit", "size": 685} |
### File: tsm/demo.sh
# Step 1: Get checkpoints from mmaction2
# https://github.com/open-mmlab/mmaction2/tree/master/configs/recognition/tsm
wget https://download.openmmlab.com/mmaction/recognition/tsm/tsm_r50_1x1x8_50e_kinetics400_rgb/tsm_r50_1x1x8_50e_kinetics400_rgb_20200607-af7fb746.pth
# Step 2: Convert pytorch c... | {"idx": "gitee_code", "domain": "code", "domain2": "gitee-permissive", "header_footer": "", "lang": "en", "source": "gitee_code-0.jsonl", "prog_lang": "Shell", "repo_name": "minhanghuang/tensorrtx", "path": "tsm/demo.sh", "license": "mit", "size": 2442} |
### File: tsm/gen_wts.py
import argparse
import struct
import torch
import numpy as np
def write_one_weight(writer, name, weight):
assert isinstance(weight, np.ndarray)
values = weight.reshape(-1)
writer.write('{} {}'.format(name, len(values)))
for value in values:
writer.write(' ')
#... | {"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": "tsm/gen_wts.py", "license": "mit", "size": 1577} |
### File: tsm/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/LICENSE... | {"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": "tsm/logging.h", "license": "mit", "size": 16550} |
### File: tsm/mmaction2_tsm_r50_config.py
# model settings
model = dict(
type='Recognizer2D',
backbone=dict(
type='ResNetTSM',
pretrained='torchvision://resnet50',
depth=50,
norm_eval=False,
shift_div=8),
cls_head=dict(
type='TSMHead',
num_classes=400,... | {"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": "tsm/mmaction2_tsm_r50_config.py", "license": "mit", "size": 563} |
### File: tsm/tsm_r50.cpp
#include "NvInfer.h"
#include "cuda_runtime_api.h"
#include "logging.h"
#include <fstream>
#include <iostream>
#include <map>
#include <sstream>
#include <vector>
#include <chrono>
#include <cmath>
#include <cstring>
#define CHECK(status) \
do\
{\
auto ret = (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": "tsm/tsm_r50.cpp", "license": "mit", "size": 17152} |
### File: tsm/tsm_r50.py
import argparse
import os
import struct
import numpy as np
import pycuda.autoinit # noqa
import pycuda.driver as cuda
import tensorrt as trt
BATCH_SIZE = 1
NUM_SEGMENTS = 8
INPUT_H = 224
INPUT_W = 224
OUTPUT_SIZE = 400
SHIFT_DIV = 8
assert INPUT_H % 32 == 0 and INPUT_W % 32 == 0, \
"Inp... | {"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": "tsm/tsm_r50.py", "license": "mit", "size": 19252} |
### File: ufld/CMakeLists.txt
cmake_minimum_required(VERSION 2.6)
project(lane_det)
add_definitions(-std=c++11)
option(CUDA_USE_STATIC_CUDA_RUNTIME OFF)
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_BUILD_TYPE Debug)
# cuda directory
include_directories(/usr/local/cuda/include/)
link_directories(/usr/local/cuda/lib64/)
# t... | {"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": "ufld/CMakeLists.txt", "license": "mit", "size": 695} |
### File: ufld/common.hpp
#ifndef LANE_DET_COMMON_H_
#define LANE_DET_COMMON_H_
#include <iostream>
#include <fstream>
#include <map>
#include <string>
#include <sstream>
#include <vector>
#include <opencv2/opencv.hpp>
#include "dirent.h"
#include "NvInfer.h"
#include <chrono>
#define CHECK(status) \
do\
{\
... | {"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": "ufld/common.hpp", "license": "mit", "size": 6435} |
### File: ufld/gen_wts.py
import torch
import struct
#import models.crnn as crnn
from model.model import parsingNet
# Initialize
model = parsingNet(pretrained = False, backbone='18', cls_dim = (101, 56, 4), use_aux=False)
device = 'cpu'
# Load model
state_dict = torch.load('tusimple_18.pth', map_location='cpu')['model... | {"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": "ufld/gen_wts.py", "license": "mit", "size": 613} |
### File: ufld/lane_det.cpp
#include <iostream>
#include <chrono>
#include <string>
#include <sstream>
#include "cuda_runtime_api.h"
#include "logging.h"
#include "common.hpp"
#define USE_FP16 // comment out this if want to use FP32
#define DEVICE 0 // GPU id
#define BATCH_SIZE 1
static const int INPUT_C = 3;
static... | {"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": "ufld/lane_det.cpp", "license": "mit", "size": 16119} |
### File: ufld/logging.h
#ifndef TENSORRT_LOGGING_H
#define TENSORRT_LOGGING_H
#include "NvInferRuntimeCommon.h"
#include <cassert>
#include <ctime>
#include <iomanip>
#include <iostream>
#include <ostream>
#include <sstream>
#include <string>
#include "macros.h"
using Severity = nvinfer1::ILogger::Severity;
class L... | {"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": "ufld/logging.h", "license": "mit", "size": 15954} |
### File: ufld/macros.h
#ifndef __MACROS_H
#define __MACROS_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
#endif // API_EXPORTS
#if NV... | {"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": "ufld/macros.h", "license": "mit", "size": 462} |
### File: ufld/pth2onnx.py
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
from torchvision import datasets, transforms
import torch.onnx as torch_onnx
from model.model import parsingNet
MODELPATH = "tusimple_18.pth"
net = parsingNet(pretrained = False, backbone='18', cl... | {"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": "ufld/pth2onnx.py", "license": "mit", "size": 579} |
### File: unet/CMakeLists.txt
cmake_minimum_required(VERSION 2.6)
project(unet)
add_definitions(-std=c++11)
option(CUDA_USE_STATIC_CUDA_RUNTIME OFF)
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_BUILD_TYPE Debug)
# cuda directory
include_directories(/usr/local/cuda/include/)
link_directories(/usr/local/cuda/lib64/)
# tenso... | {"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": "unet/CMakeLists.txt", "license": "mit", "size": 718} |
### File: unet/common.hpp
#ifndef UNET_COMMON_H_
#define UNET_COMMON_H_
#include <fstream>
#include <map>
#include <sstream>
#include <vector>
#include <opencv2/opencv.hpp>
#include "NvInfer.h"
#define CHECK(status) \
do\
{\
auto ret = (status);\
if (ret != 0)\
{\
std::cerr... | {"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": "unet/common.hpp", "license": "mit", "size": 2944} |
### File: unet/gen_wts.py
import torch
import sys
import struct
def main():
device = torch.device('cpu')
state_dict = torch.load(sys.argv[1], map_location=device)
f = open("unet.wts", 'w')
f.write("{}\n".format(len(state_dict.keys())))
for k, v in state_dict.items():
print('key: ', k)
print('value: ... | {"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": "unet/gen_wts.py", "license": "mit", "size": 538} |
### File: unet/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/LICENS... | {"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": "unet/logging.h", "license": "mit", "size": 16584} |
### File: unet/macros.h
#ifndef __MACROS_H
#define __MACROS_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
#endif // API_EXPORTS
#if NV... | {"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": "unet/macros.h", "license": "mit", "size": 462} |
### File: unet/unet.cpp
#include <iostream>
#include <chrono>
#include "cuda_runtime_api.h"
#include "logging.h"
#include "common.hpp"
#define DEVICE 0
#define USE_FP32 // USE_FP32 or USE_FP16
#define CONF_THRESH 0.5
#define BATCH_SIZE 1
#define cls 2
#define BILINEAR false
// stuff we know about the network and the... | {"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": "unet/unet.cpp", "license": "mit", "size": 12283} |
### File: vgg/CMakeLists.txt
cmake_minimum_required(VERSION 2.6)
project(vgg)
add_definitions(-std=c++11)
option(CUDA_USE_STATIC_CUDA_RUNTIME OFF)
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_BUILD_TYPE Debug)
include_directories(${PROJECT_SOURCE_DIR}/include)
# include and link dirs of cuda and tensorrt, you need adapt th... | {"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": "vgg/CMakeLists.txt", "license": "mit", "size": 671} |
### File: vgg/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/LICENSE... | {"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": "vgg/logging.h", "license": "mit", "size": 16550} |
### File: vgg/vgg11.cpp
#include "NvInfer.h"
#include "cuda_runtime_api.h"
#include <fstream>
#include <iostream>
#include <map>
#include <sstream>
#include <vector>
#include <chrono>
#include "logging.h"
#define CHECK(status) \
do\
{\
auto ret = (status);\
if (ret != 0)\
{\
... | {"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": "vgg/vgg11.cpp", "license": "mit", "size": 11163} |
### File: yolop/CMakeLists.txt
cmake_minimum_required(VERSION 2.6)
project(yolop)
add_definitions(-std=c++11)
option(CUDA_USE_STATIC_CUDA_RUNTIME OFF)
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_BUILD_TYPE Release)
find_package(CUDA REQUIRED)
include_directories(${PROJECT_SOURCE_DIR}/include)
find_package(OpenCV REQUIR... | {"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": "yolop/CMakeLists.txt", "license": "mit", "size": 992} |
### File: yolop/common.hpp
#pragma once
#include <fstream>
#include <map>
#include <sstream>
#include <vector>
#include <opencv2/opencv.hpp>
#include "NvInfer.h"
#include "yololayer.h"
using namespace nvinfer1;
cv::Rect get_rect(cv::Mat& img, float bbox[4]) {
int l, r, t, b;
float r_w = Yolo::INPUT_W / (img.... | {"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/common.hpp", "license": "mit", "size": 15244} |
### File: yolop/cuda_utils.h
#pragma once
#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 " << __FILE__ << ":" << __LINE__;\
... | {"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/cuda_utils.h", "license": "mit", "size": 344} |
### File: yolop/gen_wts.py
import os, sys
import torch
import struct
# TODO: YOLOP_BASE_DIR is the root of YOLOP
print("[WARN] Please download/clone YOLOP, then set YOLOP_BASE_DIR to the root of YOLOP")
#YOLOP_BASE_DIR = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
YOLOP_BASE_DIR = "/h... | {"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/gen_wts.py", "license": "mit", "size": 1026} |
### File: yolop/logging.h
// create by ausk(jinlj) 2022/10/25
#pragma once
#include "NvInferRuntimeCommon.h"
#include <cassert>
#include <ctime>
#include <iomanip>
#include <iostream>
#include <ostream>
#include <sstream>
#include <string>
#include "macros.h"
#if NV_TENSORRT_MAJOR >= 8
#define TRT_NOEXCEPT noexcept
#... | {"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/logging.h", "license": "mit", "size": 606} |
### File: yolop/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": "yolop/macros.h", "license": "mit", "size": 210} |
### File: yolop/utils.h
#pragma once
#include <dirent.h>
#include <opencv2/opencv.hpp>
#include <iostream>
#include "common.hpp"
#define SHOW_IMG
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 / (im... | {"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/utils.h", "license": "mit", "size": 1529} |
### File: yolop/yololayer.cu
#include <assert.h>
#include <vector>
#include <iostream>
#include "yololayer.h"
#include "cuda_utils.h"
namespace Tn
{
template<typename T>
void write(char*& buffer, const T& val)
{
*reinterpret_cast<T*>(buffer) = val;
buffer += sizeof(T);
}
template<t... | {"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": "yolop/yololayer.cu", "license": "mit", "size": 12508} |
### File: yolop/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;
struct YoloKernel
{
int width;
int he... | {"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/yololayer.h", "license": "mit", "size": 4736} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.