This commit is contained in:
Francesco Gatti
2019-02-19 09:03:33 +00:00
parent 1aa4f0275d
commit de04ae1cab
2 changed files with 13 additions and 8 deletions
+2 -2
View File
@@ -44,8 +44,8 @@ rm yolo3_berkeley.rt # be sure to delete(or move) old tensorRT files
```
this will genereate a yolo3_berkeley.rt file that can be used for live detection:
```
./demo # launch detection on a demo video
./demo /dev/video0 # launch detection on device 0
./yolo3_demo # launch detection on a demo video
./yolo3_demo yolo3_berkeley.rt /dev/video0 # launch detection on device 0
```
+11 -6
View File
@@ -23,15 +23,19 @@ int main(int argc, char *argv[]) {
std::cout<<"detection\n";
signal(SIGINT, sig_handler);
char *net = "yolo3_berkeley.rt";
if(argc > 1)
net = argv[1];
char *input = "../demo/yolo_test.mp4";
if(argc > 2)
input = argv[1];
tk::dnn::Yolo3Detection yolo;
yolo.init("yolo3_berkeley.rt");
yolo.init(net);
gRun = true;
char *input = "../demo/yolo_test.mp4";
if(argc > 1)
input = argv[1];
cv::VideoCapture cap(input);
if(!cap.isOpened())
gRun = false;
@@ -41,7 +45,6 @@ int main(int argc, char *argv[]) {
cv::Mat frame;
cv::Mat dnn_input;
cv::namedWindow("detection", cv::WINDOW_NORMAL);
cv::resizeWindow("detection", 544*1.2, 320*1.2);
while(gRun) {
cap >> frame;
@@ -49,7 +52,9 @@ int main(int argc, char *argv[]) {
continue;
}
// this will be resized to the net format
dnn_input = frame.clone();
// TODO: async infer
yolo.update(dnn_input);
// draw dets