Skip to content

Commit 52982dc

Browse files
authored
Merge pull request #9 from llDev-Rootll/development
Merging development to master
2 parents 1c4a052 + 284956e commit 52982dc

File tree

179 files changed

+10903
-168
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

179 files changed

+10903
-168
lines changed

.travis.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,22 +22,22 @@ matrix:
2222

2323
before_install:
2424
- pip install --user cpp-coveralls
25-
- sudo chmod a+x scripts/getModels.sh
26-
- ./scripts/getModels.sh
25+
- sudo chmod a+x getModels.sh
26+
- ./getModels.sh
2727
install:
28-
- sudo chmod a+x scripts/install_dependencies.sh
29-
- ./scripts/install_dependencies.sh
28+
- sudo chmod a+x install_dependencies.sh
29+
- ./install_dependencies.sh
3030
script:
3131
- export CXX=$COMPILER;
3232
- mkdir build
3333
- cd build
3434
- cmake -DCOVERAGE=ON -DCMAKE_BUILD_TYPE=Debug ../
3535
- make
3636
- make code_coverage
37-
- test/cpp-test
37+
- test/human_detector_tracker_tests
3838

3939
after_success:
40-
- coveralls --root .. -E ".*external.*" -E ".*CMakeFiles.*" -E ".*test/.*.cpp.*"
40+
- coveralls --root .. -E ".*external.*" -E ".*CMakeFiles.*" -E ".*test/.*.cpp.*" -E ".*app/main.cpp" -E ".*opencv*"
4141

4242
notifications:
4343
email: false

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ option(COVERAGE "Generate Coverage Data" OFF)
1818
if (COVERAGE)
1919
include(CodeCoverage)
2020
set(LCOV_REMOVE_EXTRA "'vendor/*'")
21-
setup_target_for_coverage(code_coverage test/cpp-test coverage)
21+
setup_target_for_coverage(code_coverage test/human_detector_tracker_tests coverage)
2222
set(COVERAGE_SRCS src/Robot.cpp src/HumanDetector.cpp include/Humandetector.h include/Rohot.h)
2323

2424
SET(CMAKE_CXX_FLAGS "-g -O0 -fprofile-arcs -ftest-coverage")

README.md

Lines changed: 59 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11

2+
23
# Human_Detection_Tracking-CPP
34
[![Build Status](https://app.travis-ci.com/llDev-Rootll/Human_Detection_Tracking-CPP.svg?branch=master)](https://app.travis-ci.com/llDev-Rootll/Human_Detection_Tracking-CPP)
45
[![Coverage Status](https://coveralls.io/repos/github/llDev-Rootll/Human_Detection_Tracking-CPP/badge.svg?branch=master)](https://coveralls.io/github/llDev-Rootll/Human_Detection_Tracking-CPP?branch=master)
@@ -7,10 +8,13 @@
78
A C++ module to detect and track humans which outputs location information directly in a robot's reference frame.
89

910
## Authors
10-
11+
Sprint 1 -
1112
- Arunava Basu (Navigator)
1213
- Aditi Ramadwar (Driver)
1314

15+
Sprint 2 -
16+
- Arunava Basu (Driver)
17+
- Aditi Ramadwar (Navigator)
1418
## Introduction
1519
Human detection or person detection is the computer vision task of the localization and classification of human being(s) in an image. This is a key part in robotic applications for various reasons such as safety, obstacle avoidance, collaborative robotics, etc.
1620

@@ -43,8 +47,7 @@ Continuous integration is tracked by using Travis CI and code coverage is tracke
4347

4448
Run this command in the root directory to install the dependencies :
4549
```
46-
chmod a+x scripts/install_dependencies.sh
47-
./scripts/install_dependencies.sh
50+
sh install_dependencies.sh
4851
```
4952

5053
## System Architecture
@@ -54,29 +57,73 @@ The following shows the activity diagram for our proposed schema :
5457
*Fig 1 : Activity Diagram*
5558

5659
The corresponding class diagram can be found [here](https://github.com/llDev-Rootll/Human_Detection_Tracking-CPP/blob/development/UML/revised/Revised_Class_Diagram.pdf).
57-
## Testing
60+
61+
## Output Data Explained
62+
At the output of the Human Detection module from the `detectHumans` method we get a vector of Rects ('Rect' is a data type in OpenCV).
63+
64+
The structure of Rect is: (x, y, z, redundant); It has four parameters,
65+
the first three parameters indicate the coordinates of a point in terms of robot's reference frame (x, y, z)
66+
67+
These coordinates can be extracted from the Rect and used as per application.
68+
The redundant variable is part of the transformation vector which is not useful for us for showing the location of the human detected.
69+
70+
For each person detected in frame, two Rects are created. We are taking two location points of each human detected. To get an estimated location of the human in the entire frame, we need to extract the x, y, z coordinates from both the Rects created where,
71+
x is the distance of the human from the robot's reference frame,
72+
y is the horizontal component and
73+
z is the vertical component.
74+
75+
Example:
76+
If there are two humans detected in a frame, then we will get a vector of four Rects. Consider the output vector variable we got is 'positions'. Size of positions is 4 since in our example 2 humans are detected, then, first human's location will be extracted from Rects positions[0] and positions[1]
77+
second human's location will be extracted from Rects positions[2] and positions[3]
78+
Example for location extraction of one of the coordinates of the first human:
79+
80+
> x = position[0] (0)
81+
> y = position[0] (1)
82+
> z = position[0] (2)
83+
84+
## Steps to Run the application
85+
Run the following commands in the root folder to build and run the Human Detector and Tracker
86+
87+
sh getModels.sh
88+
sh build_with_coverage.sh
89+
sh run_app.sh
90+
91+
## Running Unit tests
5892
Unit Testing will be used to test each submodule and ensure complete code coverage. For this Google Gtest will be leveraged and identical test classes and methods will be created with minimal modification in order to facilitate testing.
93+
Execute these commands in the root folder to run the test cases:
94+
```
95+
sh run_tests.sh
96+
```
97+
## Running cpplint & cppcheck tests
98+
Run the following command in the root directory to generate cpplint results in **results** folder
5999

60-
Additionally, a small test subset of the COCO test data will be used to validate model accuracy.
100+
sh run_cpplint.sh
101+
102+
Run the following command in the root directory to generate cppcheck results in **results** folder
103+
104+
sh run_cppcheck.sh
61105

62106
## Building without code coverage
63-
Execute these commands in the root folder :
107+
Run the following command in the root folder :
64108
```
65-
chmod a+x scripts/build_without_coverage.sh
66-
./scripts/build_without_coverage.sh
109+
sh build_without_coverage.sh
67110
```
68111
## Building with code coverage
69112

70-
Execute these commands in the root folder :
113+
Run these commands in the root folder :
71114
```
72115
sudo apt-get install lcov
73-
chmod a+x scripts/build_with_coverage.sh
74-
./scripts/build_with_coverage.sh
116+
sh build_with_coverage.sh
75117
```
118+
## Generate Doxygen documentation
119+
Run the following command in the root folder:
120+
121+
sh create_doxy_docs.sh
122+
76123
## Phase 1
77124

78125
- Defined Robot, HumanDetector and test classes according to the UML diagrams.
79126
- Implemented all Robot and HumanDetector methods except for transformToRobotFrame method.
80127
- Definition and implementation of test cases are planned for Phase 2.
81-
Please refer to the backlog table, [here](https://docs.google.com/spreadsheets/d/1tjJKUd9B4bBSYAHnrwuMjWNl_lUBmqeB6lw7iTNKZSg/edit?usp=sharing), for an exhaustive list tasks completed in Phase 1.
128+
Please refer to the backlog table, [here](https://docs.google.com/spreadsheets/d/1tjJKUd9B4bBSYAHnrwuMjWNl_lUBmqeB6lw7iTNKZSg/edit?usp=sharing), for an exhaustive list tasks completed in Phase 1.
82129

34.7 KB
Binary file not shown.
30.5 KB
Binary file not shown.

app/CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
add_executable(shell-app main.cpp)
1+
add_executable(human_detector_tracker main.cpp)
22
include_directories(
33
${CMAKE_SOURCE_DIR}/include ${OpenCV_INCLUDE_DIRS} ${EIGEN3_INCLUDE_DIR}
44
)
55

66
find_package(OpenCV REQUIRED)
77
find_package(Eigen3 REQUIRED)
8-
target_link_libraries(shell-app PUBLIC detector_lib ${OpenCV_LIBS} ${EIGEN3_LIBS})
8+
target_link_libraries(human_detector_tracker PUBLIC detector_lib ${OpenCV_LIBS} ${EIGEN3_LIBS})

app/main.cpp

Lines changed: 25 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -15,16 +15,10 @@ using std::endl;
1515

1616
int main() {
1717
cout << "Human Detector and Tracker" << endl;
18-
Eigen::Matrix4d test_matrix;
19-
test_matrix << 1, 2, 0, 0,
20-
4, 1, 0, 0,
21-
0, 0, 1, 100,
22-
0, 0, 0, 1;
23-
Robot bot(test_matrix);//Eigen::Matrix4d::Identity());
18+
Robot bot(Eigen::Matrix4d::Identity());
2419
// Load the network
2520
Net net = bot.loadNetwork("../network/yolov3.cfg",
2621
"../network/yolov3.weights");
27-
2822
// Start video capture by activating camera
2923
cv::VideoCapture cap(0);
3024
// Test if camera is actually active or not
@@ -42,9 +36,30 @@ Eigen::Matrix4d test_matrix;
4236
vector<Rect> positions;
4337
while (true) {
4438
cap >> frame;
45-
// const char* str = "../assets/test.jpeg"; // Lena image
46-
// Mat frame = cv::imread(str);
47-
bot.detectHumans(frame, net);
39+
positions = bot.detectHumans(frame, net);
40+
// Print positions of humans detected
41+
if (positions.size() > 0) {
42+
cout << "Number of people detected: " << positions.size()/2
43+
<< endl;
44+
for (size_t i = 0; i < positions.size()/2; i++) {
45+
Rect upper_bound_position = positions[i*2];
46+
double x_u = upper_bound_position.x;
47+
double y_u = upper_bound_position.y;
48+
double z_u = upper_bound_position.width;
49+
50+
Rect lower_bound_position = positions[i*2+1];
51+
double x_l = lower_bound_position.x;
52+
double y_l = lower_bound_position.y;
53+
double z_l = lower_bound_position.width;
54+
55+
std::cout << "For person "<< i+1 << ", Postion is: (" << x_u
56+
<< ", "<< y_u <<", "<< z_u << ") and ("<<
57+
x_l << ", "<< y_l <<", "<< z_l << ")" << std::endl;
58+
}
59+
} else {
60+
std::cout << "No person detected" << std::endl;
61+
}
62+
positions.clear();
4863
// Show the frame captured on screen
4964
cv::imshow(window_name, frame);
5065
// To get continuous live video until ctrl+C is pressed

assets/accuracy_test.png

1.03 MB
Loading

0 commit comments

Comments
 (0)