Merge with master, add yolov4tiny_512
Signed-off-by: tk <micaelaverucchi@gmail.com>
This commit is contained in:
@@ -479,6 +479,18 @@ int main()
|
||||
//print network model
|
||||
net.print();
|
||||
|
||||
// for(int i=0; i<net.num_layers; i++) {
|
||||
// if(net.layers[i]->getLayerType() == tk::dnn::LAYER_CONV2D) {
|
||||
// tk::dnn::Conv2d *c = (tk::dnn::Conv2d*) net.layers[i];
|
||||
// c->releaseDevice();
|
||||
// c->releaseHost(true, false);
|
||||
// }
|
||||
// if(net.layers[i]->dstData != nullptr) {
|
||||
// cudaFree(net.layers[i]->dstData);
|
||||
// net.layers[i]->dstData = nullptr;
|
||||
// }
|
||||
// }
|
||||
|
||||
//convert network to tensorRT
|
||||
tk::dnn::NetworkRT netRT(&net, net.getNetworkRTName("dla34_cnet"));
|
||||
|
||||
|
||||
@@ -353,6 +353,18 @@ int main()
|
||||
//print network model
|
||||
net.print();
|
||||
|
||||
// for(int i=0; i<net.num_layers; i++) {
|
||||
// if(net.layers[i]->getLayerType() == tk::dnn::LAYER_CONV2D) {
|
||||
// tk::dnn::Conv2d *c = (tk::dnn::Conv2d*) net.layers[i];
|
||||
// c->releaseDevice();
|
||||
// c->releaseHost(true, false);
|
||||
// }
|
||||
// if(net.layers[i]->dstData != nullptr) {
|
||||
// cudaFree(net.layers[i]->dstData);
|
||||
// net.layers[i]->dstData = nullptr;
|
||||
// }
|
||||
// }
|
||||
|
||||
//convert network to tensorRT
|
||||
tk::dnn::NetworkRT netRT(&net, net.getNetworkRTName("resnet101_cnet"));
|
||||
|
||||
|
||||
@@ -0,0 +1,281 @@
|
||||
[net]
|
||||
# Testing
|
||||
#batch=1
|
||||
#subdivisions=1
|
||||
# Training
|
||||
batch=64
|
||||
subdivisions=1
|
||||
width=416
|
||||
height=416
|
||||
channels=3
|
||||
momentum=0.9
|
||||
decay=0.0005
|
||||
angle=0
|
||||
saturation = 1.5
|
||||
exposure = 1.5
|
||||
hue=.1
|
||||
|
||||
learning_rate=0.00261
|
||||
burn_in=1000
|
||||
max_batches = 500200
|
||||
policy=steps
|
||||
steps=400000,450000
|
||||
scales=.1,.1
|
||||
|
||||
[convolutional]
|
||||
batch_normalize=1
|
||||
filters=32
|
||||
size=3
|
||||
stride=2
|
||||
pad=1
|
||||
activation=leaky
|
||||
|
||||
[convolutional]
|
||||
batch_normalize=1
|
||||
filters=64
|
||||
size=3
|
||||
stride=2
|
||||
pad=1
|
||||
activation=leaky
|
||||
|
||||
[convolutional]
|
||||
batch_normalize=1
|
||||
filters=64
|
||||
size=3
|
||||
stride=1
|
||||
pad=1
|
||||
activation=leaky
|
||||
|
||||
[route]
|
||||
layers=-1
|
||||
groups=2
|
||||
group_id=1
|
||||
|
||||
[convolutional]
|
||||
batch_normalize=1
|
||||
filters=32
|
||||
size=3
|
||||
stride=1
|
||||
pad=1
|
||||
activation=leaky
|
||||
|
||||
[convolutional]
|
||||
batch_normalize=1
|
||||
filters=32
|
||||
size=3
|
||||
stride=1
|
||||
pad=1
|
||||
activation=leaky
|
||||
|
||||
[route]
|
||||
layers = -1,-2
|
||||
|
||||
[convolutional]
|
||||
batch_normalize=1
|
||||
filters=64
|
||||
size=1
|
||||
stride=1
|
||||
pad=1
|
||||
activation=leaky
|
||||
|
||||
[route]
|
||||
layers = -6,-1
|
||||
|
||||
[maxpool]
|
||||
size=2
|
||||
stride=2
|
||||
|
||||
[convolutional]
|
||||
batch_normalize=1
|
||||
filters=128
|
||||
size=3
|
||||
stride=1
|
||||
pad=1
|
||||
activation=leaky
|
||||
|
||||
[route]
|
||||
layers=-1
|
||||
groups=2
|
||||
group_id=1
|
||||
|
||||
[convolutional]
|
||||
batch_normalize=1
|
||||
filters=64
|
||||
size=3
|
||||
stride=1
|
||||
pad=1
|
||||
activation=leaky
|
||||
|
||||
[convolutional]
|
||||
batch_normalize=1
|
||||
filters=64
|
||||
size=3
|
||||
stride=1
|
||||
pad=1
|
||||
activation=leaky
|
||||
|
||||
[route]
|
||||
layers = -1,-2
|
||||
|
||||
[convolutional]
|
||||
batch_normalize=1
|
||||
filters=128
|
||||
size=1
|
||||
stride=1
|
||||
pad=1
|
||||
activation=leaky
|
||||
|
||||
[route]
|
||||
layers = -6,-1
|
||||
|
||||
[maxpool]
|
||||
size=2
|
||||
stride=2
|
||||
|
||||
[convolutional]
|
||||
batch_normalize=1
|
||||
filters=256
|
||||
size=3
|
||||
stride=1
|
||||
pad=1
|
||||
activation=leaky
|
||||
|
||||
[route]
|
||||
layers=-1
|
||||
groups=2
|
||||
group_id=1
|
||||
|
||||
[convolutional]
|
||||
batch_normalize=1
|
||||
filters=128
|
||||
size=3
|
||||
stride=1
|
||||
pad=1
|
||||
activation=leaky
|
||||
|
||||
[convolutional]
|
||||
batch_normalize=1
|
||||
filters=128
|
||||
size=3
|
||||
stride=1
|
||||
pad=1
|
||||
activation=leaky
|
||||
|
||||
[route]
|
||||
layers = -1,-2
|
||||
|
||||
[convolutional]
|
||||
batch_normalize=1
|
||||
filters=256
|
||||
size=1
|
||||
stride=1
|
||||
pad=1
|
||||
activation=leaky
|
||||
|
||||
[route]
|
||||
layers = -6,-1
|
||||
|
||||
[maxpool]
|
||||
size=2
|
||||
stride=2
|
||||
|
||||
[convolutional]
|
||||
batch_normalize=1
|
||||
filters=512
|
||||
size=3
|
||||
stride=1
|
||||
pad=1
|
||||
activation=leaky
|
||||
|
||||
##################################
|
||||
|
||||
[convolutional]
|
||||
batch_normalize=1
|
||||
filters=256
|
||||
size=1
|
||||
stride=1
|
||||
pad=1
|
||||
activation=leaky
|
||||
|
||||
[convolutional]
|
||||
batch_normalize=1
|
||||
filters=512
|
||||
size=3
|
||||
stride=1
|
||||
pad=1
|
||||
activation=leaky
|
||||
|
||||
[convolutional]
|
||||
size=1
|
||||
stride=1
|
||||
pad=1
|
||||
filters=255
|
||||
activation=linear
|
||||
|
||||
|
||||
|
||||
[yolo]
|
||||
mask = 3,4,5
|
||||
anchors = 10,14, 23,27, 37,58, 81,82, 135,169, 344,319
|
||||
classes=80
|
||||
num=6
|
||||
jitter=.3
|
||||
scale_x_y = 1.05
|
||||
cls_normalizer=1.0
|
||||
iou_normalizer=0.07
|
||||
iou_loss=ciou
|
||||
ignore_thresh = .7
|
||||
truth_thresh = 1
|
||||
random=0
|
||||
resize=1.5
|
||||
nms_kind=greedynms
|
||||
beta_nms=0.6
|
||||
|
||||
[route]
|
||||
layers = -4
|
||||
|
||||
[convolutional]
|
||||
batch_normalize=1
|
||||
filters=128
|
||||
size=1
|
||||
stride=1
|
||||
pad=1
|
||||
activation=leaky
|
||||
|
||||
[upsample]
|
||||
stride=2
|
||||
|
||||
[route]
|
||||
layers = -1, 23
|
||||
|
||||
[convolutional]
|
||||
batch_normalize=1
|
||||
filters=256
|
||||
size=3
|
||||
stride=1
|
||||
pad=1
|
||||
activation=leaky
|
||||
|
||||
[convolutional]
|
||||
size=1
|
||||
stride=1
|
||||
pad=1
|
||||
filters=255
|
||||
activation=linear
|
||||
|
||||
[yolo]
|
||||
mask = 1,2,3
|
||||
anchors = 10,14, 23,27, 37,58, 81,82, 135,169, 344,319
|
||||
classes=80
|
||||
num=6
|
||||
jitter=.3
|
||||
scale_x_y = 1.05
|
||||
cls_normalizer=1.0
|
||||
iou_normalizer=0.07
|
||||
iou_loss=ciou
|
||||
ignore_thresh = .7
|
||||
truth_thresh = 1
|
||||
random=0
|
||||
resize=1.5
|
||||
nms_kind=greedynms
|
||||
beta_nms=0.6
|
||||
@@ -0,0 +1,281 @@
|
||||
[net]
|
||||
# Testing
|
||||
#batch=1
|
||||
#subdivisions=1
|
||||
# Training
|
||||
batch=64
|
||||
subdivisions=1
|
||||
width=512
|
||||
height=512
|
||||
channels=3
|
||||
momentum=0.9
|
||||
decay=0.0005
|
||||
angle=0
|
||||
saturation = 1.5
|
||||
exposure = 1.5
|
||||
hue=.1
|
||||
|
||||
learning_rate=0.00261
|
||||
burn_in=1000
|
||||
max_batches = 500200
|
||||
policy=steps
|
||||
steps=400000,450000
|
||||
scales=.1,.1
|
||||
|
||||
[convolutional]
|
||||
batch_normalize=1
|
||||
filters=32
|
||||
size=3
|
||||
stride=2
|
||||
pad=1
|
||||
activation=leaky
|
||||
|
||||
[convolutional]
|
||||
batch_normalize=1
|
||||
filters=64
|
||||
size=3
|
||||
stride=2
|
||||
pad=1
|
||||
activation=leaky
|
||||
|
||||
[convolutional]
|
||||
batch_normalize=1
|
||||
filters=64
|
||||
size=3
|
||||
stride=1
|
||||
pad=1
|
||||
activation=leaky
|
||||
|
||||
[route]
|
||||
layers=-1
|
||||
groups=2
|
||||
group_id=1
|
||||
|
||||
[convolutional]
|
||||
batch_normalize=1
|
||||
filters=32
|
||||
size=3
|
||||
stride=1
|
||||
pad=1
|
||||
activation=leaky
|
||||
|
||||
[convolutional]
|
||||
batch_normalize=1
|
||||
filters=32
|
||||
size=3
|
||||
stride=1
|
||||
pad=1
|
||||
activation=leaky
|
||||
|
||||
[route]
|
||||
layers = -1,-2
|
||||
|
||||
[convolutional]
|
||||
batch_normalize=1
|
||||
filters=64
|
||||
size=1
|
||||
stride=1
|
||||
pad=1
|
||||
activation=leaky
|
||||
|
||||
[route]
|
||||
layers = -6,-1
|
||||
|
||||
[maxpool]
|
||||
size=2
|
||||
stride=2
|
||||
|
||||
[convolutional]
|
||||
batch_normalize=1
|
||||
filters=128
|
||||
size=3
|
||||
stride=1
|
||||
pad=1
|
||||
activation=leaky
|
||||
|
||||
[route]
|
||||
layers=-1
|
||||
groups=2
|
||||
group_id=1
|
||||
|
||||
[convolutional]
|
||||
batch_normalize=1
|
||||
filters=64
|
||||
size=3
|
||||
stride=1
|
||||
pad=1
|
||||
activation=leaky
|
||||
|
||||
[convolutional]
|
||||
batch_normalize=1
|
||||
filters=64
|
||||
size=3
|
||||
stride=1
|
||||
pad=1
|
||||
activation=leaky
|
||||
|
||||
[route]
|
||||
layers = -1,-2
|
||||
|
||||
[convolutional]
|
||||
batch_normalize=1
|
||||
filters=128
|
||||
size=1
|
||||
stride=1
|
||||
pad=1
|
||||
activation=leaky
|
||||
|
||||
[route]
|
||||
layers = -6,-1
|
||||
|
||||
[maxpool]
|
||||
size=2
|
||||
stride=2
|
||||
|
||||
[convolutional]
|
||||
batch_normalize=1
|
||||
filters=256
|
||||
size=3
|
||||
stride=1
|
||||
pad=1
|
||||
activation=leaky
|
||||
|
||||
[route]
|
||||
layers=-1
|
||||
groups=2
|
||||
group_id=1
|
||||
|
||||
[convolutional]
|
||||
batch_normalize=1
|
||||
filters=128
|
||||
size=3
|
||||
stride=1
|
||||
pad=1
|
||||
activation=leaky
|
||||
|
||||
[convolutional]
|
||||
batch_normalize=1
|
||||
filters=128
|
||||
size=3
|
||||
stride=1
|
||||
pad=1
|
||||
activation=leaky
|
||||
|
||||
[route]
|
||||
layers = -1,-2
|
||||
|
||||
[convolutional]
|
||||
batch_normalize=1
|
||||
filters=256
|
||||
size=1
|
||||
stride=1
|
||||
pad=1
|
||||
activation=leaky
|
||||
|
||||
[route]
|
||||
layers = -6,-1
|
||||
|
||||
[maxpool]
|
||||
size=2
|
||||
stride=2
|
||||
|
||||
[convolutional]
|
||||
batch_normalize=1
|
||||
filters=512
|
||||
size=3
|
||||
stride=1
|
||||
pad=1
|
||||
activation=leaky
|
||||
|
||||
##################################
|
||||
|
||||
[convolutional]
|
||||
batch_normalize=1
|
||||
filters=256
|
||||
size=1
|
||||
stride=1
|
||||
pad=1
|
||||
activation=leaky
|
||||
|
||||
[convolutional]
|
||||
batch_normalize=1
|
||||
filters=512
|
||||
size=3
|
||||
stride=1
|
||||
pad=1
|
||||
activation=leaky
|
||||
|
||||
[convolutional]
|
||||
size=1
|
||||
stride=1
|
||||
pad=1
|
||||
filters=255
|
||||
activation=linear
|
||||
|
||||
|
||||
|
||||
[yolo]
|
||||
mask = 3,4,5
|
||||
anchors = 10,14, 23,27, 37,58, 81,82, 135,169, 344,319
|
||||
classes=80
|
||||
num=6
|
||||
jitter=.3
|
||||
scale_x_y = 1.05
|
||||
cls_normalizer=1.0
|
||||
iou_normalizer=0.07
|
||||
iou_loss=ciou
|
||||
ignore_thresh = .7
|
||||
truth_thresh = 1
|
||||
random=0
|
||||
resize=1.5
|
||||
nms_kind=greedynms
|
||||
beta_nms=0.6
|
||||
|
||||
[route]
|
||||
layers = -4
|
||||
|
||||
[convolutional]
|
||||
batch_normalize=1
|
||||
filters=128
|
||||
size=1
|
||||
stride=1
|
||||
pad=1
|
||||
activation=leaky
|
||||
|
||||
[upsample]
|
||||
stride=2
|
||||
|
||||
[route]
|
||||
layers = -1, 23
|
||||
|
||||
[convolutional]
|
||||
batch_normalize=1
|
||||
filters=256
|
||||
size=3
|
||||
stride=1
|
||||
pad=1
|
||||
activation=leaky
|
||||
|
||||
[convolutional]
|
||||
size=1
|
||||
stride=1
|
||||
pad=1
|
||||
filters=255
|
||||
activation=linear
|
||||
|
||||
[yolo]
|
||||
mask = 1,2,3
|
||||
anchors = 10,14, 23,27, 37,58, 81,82, 135,169, 344,319
|
||||
classes=80
|
||||
num=6
|
||||
jitter=.3
|
||||
scale_x_y = 1.05
|
||||
cls_normalizer=1.0
|
||||
iou_normalizer=0.07
|
||||
iou_loss=ciou
|
||||
ignore_thresh = .7
|
||||
truth_thresh = 1
|
||||
random=0
|
||||
resize=1.5
|
||||
nms_kind=greedynms
|
||||
beta_nms=0.6
|
||||
@@ -15,8 +15,8 @@ int main() {
|
||||
bin_path + "/debug/layer137_out.bin"
|
||||
};
|
||||
std::string wgs_path = bin_path + "/layers";
|
||||
std::string cfg_path = "../tests/darknet/cfg/csresnext50-panet-spp.cfg";
|
||||
std::string name_path = "../tests/darknet/names/coco.names";
|
||||
std::string cfg_path = std::string(TKDNN_PATH) + "/tests/darknet/cfg/csresnext50-panet-spp.cfg";
|
||||
std::string name_path = std::string(TKDNN_PATH) + "/tests/darknet/names/coco.names";
|
||||
downloadWeightsifDoNotExist(input_bins[0], bin_path, "https://cloud.hipert.unimore.it/s/Kcs4xBozwY4wFx8/download");
|
||||
|
||||
// parse darknet network
|
||||
|
||||
@@ -15,10 +15,9 @@ int main() {
|
||||
bin_path + "/debug/layer137_out.bin"
|
||||
};
|
||||
std::string wgs_path = bin_path + "/layers";
|
||||
std::string cfg_path = "../tests/darknet/cfg/csresnext50-panet-spp_berkeley.cfg";
|
||||
std::string name_path = "../tests/darknet/names/berkeley.names";
|
||||
// FIXME: wrong weights
|
||||
// downloadWeightsifDoNotExist(input_bins[0], bin_path, "https://cloud.hipert.unimore.it/s//download");
|
||||
std::string cfg_path = std::string(TKDNN_PATH) + "/tests/darknet/cfg/csresnext50-panet-spp_berkeley.cfg";
|
||||
std::string name_path = std::string(TKDNN_PATH) + "/tests/darknet/names/berkeley.names";
|
||||
downloadWeightsifDoNotExist(input_bins[0], bin_path, "https://cloud.hipert.unimore.it/s/q82qHAtqpoaFYo5/download");
|
||||
|
||||
// parse darknet network
|
||||
tk::dnn::Network *net = tk::dnn::darknetParser(cfg_path, wgs_path, name_path);
|
||||
|
||||
@@ -0,0 +1,70 @@
|
||||
#include<iostream>
|
||||
#include<vector>
|
||||
#include <opencv2/highgui/highgui.hpp>
|
||||
#include <opencv2/imgproc/imgproc.hpp>
|
||||
|
||||
#include "tkdnn.h"
|
||||
#include "test.h"
|
||||
#include "DarknetParser.h"
|
||||
#include "NetworkViz.h"
|
||||
|
||||
int main(int argc, char *argv[]) {
|
||||
if(argc <2)
|
||||
FatalError("you must provide an input image");
|
||||
std::string input_image = argv[1];
|
||||
std::string bin_path = "yolo3";
|
||||
std::string wgs_path = bin_path + "/layers";
|
||||
std::string cfg_path = std::string(TKDNN_PATH) + "/tests/darknet/cfg/yolo3.cfg";
|
||||
std::string name_path = std::string(TKDNN_PATH) + "/tests/darknet/names/coco.names";
|
||||
downloadWeightsifDoNotExist(wgs_path, bin_path, "https://cloud.hipert.unimore.it/s/jPXmHyptpLoNdNR/download");
|
||||
|
||||
// parse darknet network
|
||||
tk::dnn::Network *net = tk::dnn::darknetParser(cfg_path, wgs_path, name_path);
|
||||
net->print();
|
||||
|
||||
// input data
|
||||
dnnType *input_d;
|
||||
checkCuda( cudaMalloc(&input_d, sizeof(dnnType)*net->input_dim.tot()));
|
||||
|
||||
// load image
|
||||
cv::Mat frame, frameFloat;
|
||||
frame = cv::imread(input_image);
|
||||
cv::resize(frame, frame, cv::Size(net->input_dim.w, net->input_dim.h));
|
||||
frame.convertTo(frameFloat, CV_32FC3, 1/255.0);
|
||||
|
||||
//split channels
|
||||
cv::Mat bgr[3];
|
||||
cv::split(frameFloat,bgr);//split source
|
||||
|
||||
//write channels
|
||||
for(int i=0; i<net->input_dim.c; i++) {
|
||||
int idx = i*frameFloat.rows*frameFloat.cols;
|
||||
int ch = net->input_dim.c-1 -i;
|
||||
checkCuda( cudaMemcpy(input_d + idx, (void*)bgr[ch].data, frameFloat.rows*frameFloat.cols*sizeof(dnnType), cudaMemcpyHostToDevice));
|
||||
}
|
||||
|
||||
tk::dnn::dataDim_t dim = net->input_dim;
|
||||
dim.print();
|
||||
std::cout<<"infer\n";
|
||||
net->infer(dim, input_d);
|
||||
|
||||
// output directory
|
||||
std::string output_viz = "viz/";
|
||||
system( (std::string("mkdir -p ") + output_viz).c_str() );
|
||||
|
||||
for(int i=0; i<net->num_layers; i++) {
|
||||
std::string output_png = output_viz + "/layer" + std::to_string(i) + ".png";
|
||||
std::cout<<"saving "<<output_png<<"\n";
|
||||
cv::Mat viz = vizLayer2Mat(net, i);
|
||||
cv::imwrite(output_png, viz);
|
||||
//cv::imshow("layer", viz);
|
||||
//cv::waitKey(0);
|
||||
}
|
||||
|
||||
checkCuda(cudaFree(input_d));
|
||||
net->releaseLayers();
|
||||
delete net;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -13,8 +13,8 @@ int main() {
|
||||
bin_path + "/layers/output.bin"
|
||||
};
|
||||
std::string wgs_path = bin_path + "/layers";
|
||||
std::string cfg_path = "../tests/darknet/cfg/yolo2.cfg";
|
||||
std::string name_path = "../tests/darknet/names/coco.names";
|
||||
std::string cfg_path = std::string(TKDNN_PATH) + "/tests/darknet/cfg/yolo2.cfg";
|
||||
std::string name_path = std::string(TKDNN_PATH) + "/tests/darknet/names/coco.names";
|
||||
downloadWeightsifDoNotExist(input_bins[0], bin_path, "https://cloud.hipert.unimore.it/s/nf4PJ3k8bxBETwL/download");
|
||||
|
||||
// parse darknet network
|
||||
|
||||
@@ -13,8 +13,8 @@ int main() {
|
||||
bin_path + "/layers/output.bin"
|
||||
};
|
||||
std::string wgs_path = bin_path + "/layers";
|
||||
std::string cfg_path = "../tests/darknet/cfg/yolo2_voc.cfg";
|
||||
std::string name_path = "../tests/darknet/names/voc.names";
|
||||
std::string cfg_path = std::string(TKDNN_PATH) + "/tests/darknet/cfg/yolo2_voc.cfg";
|
||||
std::string name_path = std::string(TKDNN_PATH) + "/tests/darknet/names/voc.names";
|
||||
downloadWeightsifDoNotExist(input_bins[0], bin_path, "https://cloud.hipert.unimore.it/s/DJC5Fi2pEjfNDP9/download");
|
||||
|
||||
// parse darknet network
|
||||
|
||||
@@ -13,8 +13,8 @@ int main() {
|
||||
bin_path + "/layers/output.bin"
|
||||
};
|
||||
std::string wgs_path = bin_path + "/layers";
|
||||
std::string cfg_path = "../tests/darknet/cfg/yolo2tiny.cfg";
|
||||
std::string name_path = "../tests/darknet/names/coco.names";
|
||||
std::string cfg_path = std::string(TKDNN_PATH) + "/tests/darknet/cfg/yolo2tiny.cfg";
|
||||
std::string name_path = std::string(TKDNN_PATH) + "/tests/darknet/names/coco.names";
|
||||
// FIXME: wrong weights
|
||||
//downloadWeightsifDoNotExist(input_bins[0], bin_path, "https://cloud.hipert.unimore.it/s//download");
|
||||
|
||||
|
||||
@@ -15,8 +15,8 @@ int main() {
|
||||
bin_path + "/debug/layer106_out.bin"
|
||||
};
|
||||
std::string wgs_path = bin_path + "/layers";
|
||||
std::string cfg_path = "../tests/darknet/cfg/yolo3.cfg";
|
||||
std::string name_path = "../tests/darknet/names/coco.names";
|
||||
std::string cfg_path = std::string(TKDNN_PATH) + "/tests/darknet/cfg/yolo3.cfg";
|
||||
std::string name_path = std::string(TKDNN_PATH) + "/tests/darknet/names/coco.names";
|
||||
downloadWeightsifDoNotExist(input_bins[0], bin_path, "https://cloud.hipert.unimore.it/s/jPXmHyptpLoNdNR/download");
|
||||
|
||||
// parse darknet network
|
||||
@@ -31,4 +31,4 @@ int main() {
|
||||
delete net;
|
||||
delete netRT;
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
@@ -15,14 +15,26 @@ int main() {
|
||||
bin_path + "/debug/layer106_out.bin"
|
||||
};
|
||||
std::string wgs_path = bin_path + "/layers";
|
||||
std::string cfg_path = "../tests/darknet/cfg/yolo3_512.cfg";
|
||||
std::string name_path = "../tests/darknet/names/coco.names";
|
||||
std::string cfg_path = std::string(TKDNN_PATH) + "/tests/darknet/cfg/yolo3_512.cfg";
|
||||
std::string name_path = std::string(TKDNN_PATH) + "/tests/darknet/names/coco.names";
|
||||
downloadWeightsifDoNotExist(input_bins[0], bin_path, "https://cloud.hipert.unimore.it/s/RGecMeGLD4cXEWL/download");
|
||||
|
||||
// parse darknet network
|
||||
tk::dnn::Network *net = tk::dnn::darknetParser(cfg_path, wgs_path, name_path);
|
||||
net->print();
|
||||
|
||||
// for(int i=0; i<net->num_layers; i++) {
|
||||
// if(net->layers[i]->getLayerType() == tk::dnn::LAYER_CONV2D) {
|
||||
// tk::dnn::Conv2d *c = (tk::dnn::Conv2d*) net->layers[i];
|
||||
// c->releaseDevice();
|
||||
// c->releaseHost(true, false);
|
||||
// }
|
||||
// if(net->layers[i]->dstData != nullptr) {
|
||||
// cudaFree(net->layers[i]->dstData);
|
||||
// net->layers[i]->dstData = nullptr;
|
||||
// }
|
||||
// }
|
||||
|
||||
//convert network to tensorRT
|
||||
tk::dnn::NetworkRT *netRT = new tk::dnn::NetworkRT(net, net->getNetworkRTName(bin_path.c_str()));
|
||||
|
||||
|
||||
@@ -15,8 +15,8 @@ int main() {
|
||||
bin_path + "/debug/layer106_out.bin"
|
||||
};
|
||||
std::string wgs_path = bin_path + "/layers";
|
||||
std::string cfg_path = "../tests/darknet/cfg/yolo3_berkeley.cfg";
|
||||
std::string name_path = "../tests/darknet/names/berkeley.names";
|
||||
std::string cfg_path = std::string(TKDNN_PATH) + "/tests/darknet/cfg/yolo3_berkeley.cfg";
|
||||
std::string name_path = std::string(TKDNN_PATH) + "/tests/darknet/names/berkeley.names";
|
||||
downloadWeightsifDoNotExist(input_bins[0], bin_path, "https://cloud.hipert.unimore.it/s/o5cHa4AjTKS64oD/download");
|
||||
|
||||
// parse darknet network
|
||||
|
||||
@@ -15,8 +15,8 @@ int main() {
|
||||
bin_path + "/debug/layer106_out.bin"
|
||||
};
|
||||
std::string wgs_path = bin_path + "/layers";
|
||||
std::string cfg_path = "../tests/darknet/cfg/yolo3_coco4.cfg";
|
||||
std::string name_path = "../tests/darknet/names/coco4.names";
|
||||
std::string cfg_path = std::string(TKDNN_PATH) + "/tests/darknet/cfg/yolo3_coco4.cfg";
|
||||
std::string name_path = std::string(TKDNN_PATH) + "/tests/darknet/names/coco4.names";
|
||||
downloadWeightsifDoNotExist(input_bins[0], bin_path, "https://cloud.hipert.unimore.it/s/o27NDzSAartbyc4/download");
|
||||
|
||||
// parse darknet network
|
||||
|
||||
@@ -15,8 +15,8 @@ int main() {
|
||||
bin_path + "/debug/layer106_out.bin"
|
||||
};
|
||||
std::string wgs_path = bin_path + "/layers";
|
||||
std::string cfg_path = "../tests/darknet/cfg/yolo3_flir.cfg";
|
||||
std::string name_path = "../tests/darknet/names/flir.names";
|
||||
std::string cfg_path = std::string(TKDNN_PATH) + "/tests/darknet/cfg/yolo3_flir.cfg";
|
||||
std::string name_path = std::string(TKDNN_PATH) + "/tests/darknet/names/flir.names";
|
||||
downloadWeightsifDoNotExist(input_bins[0], bin_path, "https://cloud.hipert.unimore.it/s/62DECncmF6bMMiH/download");
|
||||
|
||||
// parse darknet network
|
||||
|
||||
@@ -14,8 +14,8 @@ int main() {
|
||||
bin_path + "/debug/layer23_out.bin",
|
||||
};
|
||||
std::string wgs_path = bin_path + "/layers";
|
||||
std::string cfg_path = "../tests/darknet/cfg/yolo3tiny.cfg";
|
||||
std::string name_path = "../tests/darknet/names/coco.names";
|
||||
std::string cfg_path = std::string(TKDNN_PATH) + "/tests/darknet/cfg/yolo3tiny.cfg";
|
||||
std::string name_path = std::string(TKDNN_PATH) + "/tests/darknet/names/coco.names";
|
||||
downloadWeightsifDoNotExist(input_bins[0], bin_path, "https://cloud.hipert.unimore.it/s/LMcSHtWaLeps8yN/download");
|
||||
|
||||
// parse darknet network
|
||||
|
||||
@@ -14,14 +14,27 @@ int main() {
|
||||
bin_path + "/debug/layer23_out.bin",
|
||||
};
|
||||
std::string wgs_path = bin_path + "/layers";
|
||||
std::string cfg_path = "../tests/darknet/cfg/yolo3tiny_512.cfg";
|
||||
std::string name_path = "../tests/darknet/names/coco.names";
|
||||
std::string cfg_path = std::string(TKDNN_PATH) + "/tests/darknet/cfg/yolo3tiny_512.cfg";
|
||||
std::string name_path = std::string(TKDNN_PATH) + "/tests/darknet/names/coco.names";
|
||||
downloadWeightsifDoNotExist(input_bins[0], bin_path, "https://cloud.hipert.unimore.it/s/8Zt6bHwHADqP4JC/download");
|
||||
|
||||
// parse darknet network
|
||||
tk::dnn::Network *net = tk::dnn::darknetParser(cfg_path, wgs_path, name_path);
|
||||
net->print();
|
||||
|
||||
// for(int i=0; i<net->num_layers; i++) {
|
||||
// if(net->layers[i]->getLayerType() == tk::dnn::LAYER_CONV2D) {
|
||||
// tk::dnn::Conv2d *c = (tk::dnn::Conv2d*) net->layers[i];
|
||||
// c->releaseDevice();
|
||||
// c->releaseHost(true, false);
|
||||
// }
|
||||
// if(net->layers[i]->dstData != nullptr) {
|
||||
// cudaFree(net->layers[i]->dstData);
|
||||
// net->layers[i]->dstData = nullptr;
|
||||
// }
|
||||
// }
|
||||
|
||||
|
||||
//convert network to tensorRT
|
||||
tk::dnn::NetworkRT *netRT = new tk::dnn::NetworkRT(net, net->getNetworkRTName(bin_path.c_str()));
|
||||
|
||||
|
||||
@@ -23,6 +23,19 @@ int main() {
|
||||
tk::dnn::Network *net = tk::dnn::darknetParser(cfg_path, wgs_path, name_path);
|
||||
net->print();
|
||||
|
||||
// for(int i=0; i<net->num_layers; i++) {
|
||||
// if(net->layers[i]->getLayerType() == tk::dnn::LAYER_CONV2D) {
|
||||
// tk::dnn::Conv2d *c = (tk::dnn::Conv2d*) net->layers[i];
|
||||
// c->releaseDevice();
|
||||
// c->releaseHost(true, false);
|
||||
// }
|
||||
// if(net->layers[i]->dstData != nullptr) {
|
||||
// cudaFree(net->layers[i]->dstData);
|
||||
// net->layers[i]->dstData = nullptr;
|
||||
// }
|
||||
// }
|
||||
|
||||
|
||||
//convert network to tensorRT
|
||||
tk::dnn::NetworkRT *netRT = new tk::dnn::NetworkRT(net, net->getNetworkRTName(bin_path.c_str()));
|
||||
|
||||
|
||||
@@ -15,8 +15,8 @@ int main() {
|
||||
bin_path + "/debug/layer161_out.bin"
|
||||
};
|
||||
std::string wgs_path = bin_path + "/layers";
|
||||
std::string cfg_path = "../tests/darknet/cfg/yolo4_berkeley.cfg";
|
||||
std::string name_path = "../tests/darknet/names/berkeley.names";
|
||||
std::string cfg_path = std::string(TKDNN_PATH) + "/tests/darknet/cfg/yolo4_berkeley.cfg";
|
||||
std::string name_path = std::string(TKDNN_PATH) + "/tests/darknet/names/berkeley.names";
|
||||
downloadWeightsifDoNotExist(input_bins[0], bin_path, "https://cloud.hipert.unimore.it/s/nkWFa5fgb4NTdnB/download");
|
||||
|
||||
// parse darknet network
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
#include<iostream>
|
||||
#include<vector>
|
||||
#include "tkdnn.h"
|
||||
#include "test.h"
|
||||
#include "DarknetParser.h"
|
||||
|
||||
int main() {
|
||||
std::string bin_path = "yolo4tiny";
|
||||
std::vector<std::string> input_bins = {
|
||||
bin_path + "/layers/input.bin"
|
||||
};
|
||||
std::vector<std::string> output_bins = {
|
||||
bin_path + "/debug/layer30_out.bin",
|
||||
bin_path + "/debug/layer37_out.bin"
|
||||
};
|
||||
std::string wgs_path = bin_path + "/layers";
|
||||
std::string cfg_path = std::string(TKDNN_PATH) + "/tests/darknet/cfg/yolo4tiny.cfg";
|
||||
std::string name_path = std::string(TKDNN_PATH) + "/tests/darknet/names/coco.names";
|
||||
downloadWeightsifDoNotExist(input_bins[0], bin_path, "https://cloud.hipert.unimore.it/s/iRnc4pSqmx78gJs/download");
|
||||
|
||||
// parse darknet network
|
||||
tk::dnn::Network *net = tk::dnn::darknetParser(cfg_path, wgs_path, name_path);
|
||||
net->print();
|
||||
|
||||
//convert network to tensorRT
|
||||
tk::dnn::NetworkRT *netRT = new tk::dnn::NetworkRT(net, net->getNetworkRTName(bin_path.c_str()));
|
||||
|
||||
int ret = testInference(input_bins, output_bins, net, netRT);
|
||||
net->releaseLayers();
|
||||
delete net;
|
||||
delete netRT;
|
||||
return ret;
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
#include<iostream>
|
||||
#include<vector>
|
||||
#include "tkdnn.h"
|
||||
#include "test.h"
|
||||
#include "DarknetParser.h"
|
||||
|
||||
int main() {
|
||||
std::string bin_path = "yolo4tiny_512";
|
||||
std::vector<std::string> input_bins = {
|
||||
bin_path + "/layers/input.bin"
|
||||
};
|
||||
std::vector<std::string> output_bins = {
|
||||
bin_path + "/debug/layer30_out.bin",
|
||||
bin_path + "/debug/layer37_out.bin"
|
||||
};
|
||||
std::string wgs_path = bin_path + "/layers";
|
||||
std::string cfg_path = std::string(TKDNN_PATH) + "/tests/darknet/cfg/yolo4tiny_512.cfg";
|
||||
std::string name_path = std::string(TKDNN_PATH) + "/tests/darknet/names/coco.names";
|
||||
downloadWeightsifDoNotExist(input_bins[0], bin_path, "https://cloud.hipert.unimore.it/s/qa2ws4GXg7mS5nN/download");
|
||||
|
||||
// parse darknet network
|
||||
tk::dnn::Network *net = tk::dnn::darknetParser(cfg_path, wgs_path, name_path);
|
||||
net->print();
|
||||
|
||||
// for(int i=0; i<net->num_layers; i++) {
|
||||
// if(net->layers[i]->getLayerType() == tk::dnn::LAYER_CONV2D) {
|
||||
// tk::dnn::Conv2d *c = (tk::dnn::Conv2d*) net->layers[i];
|
||||
// c->releaseDevice();
|
||||
// c->releaseHost(true, false);
|
||||
// }
|
||||
// if(net->layers[i]->dstData != nullptr) {
|
||||
// cudaFree(net->layers[i]->dstData);
|
||||
// net->layers[i]->dstData = nullptr;
|
||||
// }
|
||||
// }
|
||||
|
||||
//convert network to tensorRT
|
||||
tk::dnn::NetworkRT *netRT = new tk::dnn::NetworkRT(net, net->getNetworkRTName(bin_path.c_str()));
|
||||
|
||||
int ret = testInference(input_bins, output_bins, net, netRT);
|
||||
net->releaseLayers();
|
||||
delete net;
|
||||
delete netRT;
|
||||
return ret;
|
||||
}
|
||||
@@ -469,6 +469,19 @@ int main()
|
||||
//print network model
|
||||
net.print();
|
||||
|
||||
// for(int i=0; i<net.num_layers; i++) {
|
||||
// if(net.layers[i]->getLayerType() == tk::dnn::LAYER_CONV2D) {
|
||||
// tk::dnn::Conv2d *c = (tk::dnn::Conv2d*) net.layers[i];
|
||||
// c->releaseDevice();
|
||||
// c->releaseHost(true, false);
|
||||
// }
|
||||
// if(net.layers[i]->dstData != nullptr) {
|
||||
// cudaFree(net.layers[i]->dstData);
|
||||
// net.layers[i]->dstData = nullptr;
|
||||
// }
|
||||
// }
|
||||
|
||||
|
||||
// convert network to tensorRT
|
||||
tk::dnn::NetworkRT netRT(&net, net.getNetworkRTName("mobilenetv2ssd512"));
|
||||
|
||||
|
||||
Reference in New Issue
Block a user