-
Notifications
You must be signed in to change notification settings - Fork 344
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #48 from NVIDIA-Jetson/2.0
redtail 2.0
- Loading branch information
Showing
132 changed files
with
7,751 additions
and
306 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
40 changes: 40 additions & 0 deletions
40
ros/packages/caffe_ros/include/caffe_ros/int8_calibrator.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
// Copyright (c) 2017, NVIDIA CORPORATION. All rights reserved. | ||
// Full license terms provided in LICENSE.md file. | ||
|
||
#ifndef CAFFE_ROS_INT8_CALIBRATOR_H | ||
#define CAFFE_ROS_INT8_CALIBRATOR_H | ||
|
||
#include <NvInfer.h> | ||
#include <string> | ||
#include "internal_utils.h" | ||
|
||
namespace caffe_ros | ||
{ | ||
class Int8EntropyCalibrator : public nvinfer1::IInt8EntropyCalibrator | ||
{ | ||
public: | ||
Int8EntropyCalibrator(ConstStr& src, ConstStr& calib_cache); | ||
~Int8EntropyCalibrator(); | ||
|
||
int getBatchSize() const override { return 1; } | ||
bool getBatch(void* bindings[], const char* names[], int nbBindings) override; | ||
|
||
const void* readCalibrationCache(size_t& length) override; | ||
void writeCalibrationCache(const void* cache, size_t length) override; | ||
|
||
void setInputDims(nvinfer1::DimsCHW dims); | ||
|
||
private: | ||
std::string src_; | ||
std::string calib_cache_; | ||
|
||
std::deque<std::string> files_; | ||
|
||
nvinfer1::DimsCHW dims_ = nvinfer1::DimsCHW(0, 0, 0); | ||
|
||
float* img_d_ = nullptr; | ||
}; | ||
|
||
} | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
// Copyright (c) 2017, NVIDIA CORPORATION. All rights reserved. | ||
// Full license terms provided in LICENSE.md file. | ||
|
||
#ifndef CAFFE_ROS_INTERNAL_UTILS_H | ||
#define CAFFE_ROS_INTERNAL_UTILS_H | ||
|
||
#include <opencv2/opencv.hpp> | ||
|
||
namespace caffe_ros | ||
{ | ||
using ConstStr = const std::string; | ||
|
||
// Formats of the input layer. BGR is usually used by most of the frameworks that use OpenCV. | ||
enum class InputFormat | ||
{ | ||
BGR = 0, | ||
RGB | ||
}; | ||
|
||
// Performs image preprocessing (resizing, scaling, format conversion etc) | ||
// that is done before feeding the image into the networ. | ||
cv::Mat preprocessImage(cv::Mat img, int dst_img_w, int dst_img_h, InputFormat inp_fmt, ConstStr& encoding, | ||
float inp_scale, float inp_shift); | ||
|
||
} | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.