Add shelfnet_mapillary, README_seg, resize of input

Signed-off-by: Micaela Verucchi <micaelaverucchi@gmail.com>
This commit is contained in:
Micaela Verucchi
2020-11-24 12:37:33 +01:00
parent 286e777300
commit a52e18b6e6
7 changed files with 498 additions and 24 deletions
+2 -2
View File
@@ -5,8 +5,8 @@
namespace tk { namespace dnn {
cv::Mat vizFloat2colorMap(cv::Mat map, double min=0, double max=0);
cv::Mat vizData2Mat(dnnType *dataInput, tk::dnn::dataDim_t dim, int imgdim, double min=0, double max=0);
cv::Mat vizFloat2colorMap(cv::Mat map, double min=0, double max=0, bool mapillary_15=false);
cv::Mat vizData2Mat(dnnType *dataInput, tk::dnn::dataDim_t dim, int imgdim, double min=0, double max=0, bool mapillary_15=false);
cv::Mat vizLayer2Mat(tk::dnn::Network *net, int layer, int imgdim = 1000);
}}
+4 -4
View File
@@ -97,7 +97,7 @@ class SegmentationNN {
*
* @param bi batch index
*/
void postprocess(const int bi=0, bool appy_colormap = true) {
void postprocess(const int bi=0, bool appy_colormap = true, bool mapillary_15=false) {
dnnType *rt_out = (dnnType *)netRT->buffersRT[1]+ netRT->buffersDIM[1].tot()*bi;
dataDim_t odim = netRT->output_dim;
@@ -112,7 +112,7 @@ class SegmentationNN {
cv::Mat colored;
if(appy_colormap)
colored = vizData2Mat(tmpOutData_h, vdim, 1024, 0, 18);
colored = vizData2Mat(tmpOutData_h, vdim, 1024, 0, classes, mapillary_15);
else{
cv::Mat colored_fp32 (cv::Size(odim.w, odim.h),CV_32FC1, tmpOutData_h);
colored_fp32.convertTo(colored, CV_8UC1);
@@ -234,7 +234,7 @@ class SegmentationNN {
}
}
void updateOriginal(cv::Mat frame, bool apply_colormap=true){
void updateOriginal(cv::Mat frame, bool apply_colormap=true, bool mapillary_15=false){
std::vector<cv::Mat> splitted_frames;
int H, W, net_H, net_W;
@@ -347,7 +347,7 @@ class SegmentationNN {
cv::Mat colored;
if(apply_colormap)
colored = vizData2Mat(tmpOutData_h, vdim, 1024, 0, 18);
colored = vizData2Mat(tmpOutData_h, vdim, 1024, 0, classes, mapillary_15);
else{
cv::Mat colored_fp32 (cv::Size(odim.w, odim.h),CV_32FC1, tmpOutData_h);
colored_fp32.convertTo(colored, CV_8UC1);