Git Product home page Git Product logo

jderobot / detectionmetrics Goto Github PK

View Code? Open in Web Editor NEW
72.0 13.0 38.0 23.21 MB

Tool to evaluate deep-learning detection and segmentation models, and to create datasets

Home Page: https://jderobot.github.io/DetectionMetrics/

License: GNU General Public License v3.0

CMake 6.08% C++ 77.85% C 2.30% Python 12.46% Shell 0.29% Slice 0.77% Ruby 0.02% Dockerfile 0.22%
object-detection object-segmentation deep-learning coco imagenet pascal-voc tensorflow darknet keras

detectionmetrics's Introduction

JdeRobot

Current Release Version

THIS REPOSITORY HAS BEEN ARCHIVED AND IS DEPRECATED. Since 2020 we have adopted ROS as our main framework for developing Robotics, AI and ComputerVision applications and tools.

Introduction

JdeRobot is a software development suite for robotics, home-automation and computer vision applications. These domains include sensors for instance, cameras, actuators, and intelligent software in between. It has been designed to help in programming with such intelligent softwares. It is mainly written in C++ language and provides a distributed component-based programming environment where the application program is made up of a collection of several concurrent asynchronous components. Each component may run in different computers and they are connected using Ice communication middleware. Components may be written in C++, python, Java... and all of them interoperate through explicit Ice interfaces.

JdeRobot simplifies the access to hardware devices from the control program. Getting sensor measurements is as simple as calling a local function, and ordering motor commands as easy as calling another local function. The platform attaches those calls to the remote invocation on the components connected to the sensor or the actuator devices. They can be connected to real sensors and actuators or simulated ones, both locally or remotely using the network. Those functions build the API for the Hardware Abstraction Layer. The robotic application get the sensor readings and order the actuator commands using it to unfold its behavior. Several driver components have been developed to support different physical sensors, actuators and simulators. The drivers are used as components installed at will depending on your configuration. They are included in the official release. Currently supported robots and devices:

  • RGBD sensors: Kinect from Microsoft, Asus Xtion
  • Pioneer robot from MobileRobotics Inc.
  • Kobuki robot (TurtleBot) from Yujin Robot
  • Nao humanoid from Aldebaran
  • ArDrone quadrotor from Parrot
  • Firewire cameras, USB cameras, video files (mpeg, avi...), IP cameras (like Axis)
  • Pantilt unit PTU-D46 from Directed Perception Inc.
  • Laser Scanners: LMS from SICK and URG from Hokuyo
  • EVI PTZ camera from Sony
  • Gazebo and Stage simulators
  • Wiimote
  • X10 home automation devices

JdeRobot includes several robot programming tools and libraries. First, viewers and teleoperators for several robots, its sensors and motors. Second, a camera calibration component and a tuning tool for color filters. Third, VisualStates tool for programming robot behavior using hierarchical finite state machines. It includes many sample components using OpenCV, PCL, OpenGL, etc.. In addition, it also provides a library to develop fuzzy controllers, a library for projective geometry and some computer vision processing.

Each component may have its own independent Graphical User Interface or none at all. Currently, GTK and Qt libraries are supported, and several examples of OpenGL for 3D graphics with both libraries are included.

JdeRobot is open-source software, licensed as GPL and LGPL. It also uses third-party softwares like Gazebo simulator, OpenGL, GTK, Qt, Player, Stage, Gazebo, GSL, OpenCV, PCL, Eigen, Ogre.

JdeRobot is a project developed by Robotics Group of Universidad Rey Juan Carlos (Madrid, Spain).

Installation

Table of Contents

  • Add the latest ROS sources:
sudo sh -c 'echo "deb http://packages.ros.org/ros/ubuntu $(lsb_release -sc) main" > /etc/apt/sources.list.d/ros-latest.list'
sudo apt-key adv --keyserver 'hkp://keyserver.ubuntu.com:80' --recv-key C1CF6E31E6BADE8868B172B4F42ED6FBAB17C654
  • Add the latest Gazebo sources:
sudo sh -c 'echo "deb http://packages.osrfoundation.org/gazebo/ubuntu-stable `lsb_release -cs` main" > /etc/apt/sources.list.d/gazebo-stable.list'
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-key 67170598AF249743
  • Add the latest zeroc-ice sources:
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv B6391CB2CFBA643D
sudo apt-add-repository "deb http://zeroc.com/download/Ice/3.7/ubuntu18.04 stable main"
  • Add JdeRobot repository (using dedicated file /etc/apt/sources.list.d/jderobot.list):
sudo sh -c 'echo "deb [arch=amd64] http://wiki.jderobot.org/apt `lsb_release -cs` main" > /etc/apt/sources.list.d/jderobot.list''
  • Get and add the public key from the JdeRobot repository
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv 24E521A4
  • Update the repositories
sudo apt update
  • Install JdeRobot:
sudo apt install jderobot
sudo apt install jderobot-assets
  • After installing the package, you can close the terminal and reopen it to source the environment variables, OR just type:
source ~/.bashrc
  • If you already have a previous version of the packages installed, you only have to do:
sudo apt update && sudo apt upgrade

If you want to run JdeRobot in MS-Windows, MacOS or other Linux distributions you can use Docker containers. We have created a Docker image with current JdeRobot Release and all the necessary components to be used with JdeRobot-Academy. To download it, use:

docker pull jderobot/jderobot

For more information follow this link

Downloading the source code from the GitHub is strongly NOT RECOMMENDED for new users unless you know what you are doing.

You have two options here:

  1. Install all the dependencies from a binary package
  2. Install all the dependencies manually (NOT RECOMMENDED)

For the first one, you only have to type the following:

sudo apt install jderobot-deps-dev

and skip to the next section of this README.

For the second one... keep reading

JdeRobot has different external dependencies to build its structure. There are two types of dependencies: necessary dependencies and other dependencies. The firsts are needed to compile and install the basics of JdeRobot, that is, all its libraries and interfaces that are needed for the components or to develop components that use JdeRobot. The seconds are needed just for some components, but are not really necessary unless you want to use that components. For instance, the component gazeboserver uses Gazebo, a 3D robot simulator, so to use this component you may install Gazebo first.

First of all repeat the step Getting environment ready

Some libraries are required to compile, link or run JdeRobot. Just type the following commands:

  • Basic libraries:

sudo apt install build-essential libtool cmake g++ gcc git make

  • OpenGL libraries:

sudo apt install freeglut3 freeglut3-dev libgl1-mesa-dev libglu1-mesa

  • GTK2 libraries:
sudo apt install libgtk2.0-0 libgtk2.0-bin libgtk2.0-cil libgtk2.0-common libgtk2.0-dev libgtkgl2.0-1
sudo apt install libgtkgl2.0-dev libgtkglext1 libgtkglext1-dev libglademm-2.4-dev libgtkmm-2.4-dev 
sudo apt install libgnomecanvas2-0 libgnomecanvas2-dev  libgtkglext1-doc libgnomecanvasmm-2.6-dev
sudo apt install libgnomecanvasmm-2.6-1v5 libgtkglextmm-x11-1.2-0v5 libgtkglextmm-x11-1.2-dev
  • Gtk3 libraries:

sudo apt install libgoocanvasmm-2.0-6 libgoocanvasmm-2.0-dev

  • GSL libraries:

sudo apt install libgsl23 gsl-bin libgsl-dev

  • LibXML:

sudo apt install libxml++2.6-2v5 libxml++2.6-dev libtinyxml-dev

  • Eigen:

sudo apt install libeigen3-dev

  • Fireware:

sudo apt install libdc1394-22 libdc1394-22-dev

  • USB:

sudo apt install libusb-1.0-0 libusb-1.0-0-dev

  • CWIID:

sudo apt install libcwiid-dev

  • Python components:

sudo apt install python-matplotlib python-pyqt5 python-pip python-numpy python-pyqt5.qtsvg

  • Qfi

It can be compiled and installed from source: https://github.com/JdeRobot/ThirdParty/tree/master/qflightinstruments

  • Qt 5

sudo apt install qtbase5-dev libqt5script5 libqt5svg5-dev

  • Boost

sudo apt install libboost-system-dev libboost-filesystem-dev

  • ROS
sudo apt install ros-melodic-roscpp ros-melodic-std-msgs ros-melodic-cv-bridge ros-melodic-image-transport ros-melodic-roscpp-core ros-melodic-rospy ros-melodic-nav-msgs ros-melodic-geometry-msgs ros-melodic-mavros ros-melodic-gazebo-plugins ros-melodic-kobuki-msgs

Once all ros packages are installed, install the script that tunes the environment variables ROS in your .bashrc configuration file, and run it for the current shell:

echo "source /opt/ros/melodic/setup.bash" >> ~/.bashrc 
source ~/.bashrc 
  • Google glog (logging)

sudo apt install libgoogle-glog-dev

  • GStreamer

sudo apt-get install libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev

  • ICE
sudo apt install libdb5.3-dev libdb5.3++-dev libssl-dev libbz2-dev libmcpp-dev \
            libzeroc-ice3.7 libzeroc-icestorm3.7 zeroc-ice-slice libzeroc-ice-dev

compile ice:

git clone -b 3.7 https://github.com/zeroc-ice/ice.git 
cd ice/cpp
make CPP11=yes OPTIMIZE=yes
make install

Configure ICE for Python with pip

sudo pip2 install --upgrade pip
sudo pip2 install zeroc-ice==3.7.2
  • OpenNI 2

sudo apt-get install libopenni2-dev libopenni-dev

  • Point Cloud Library

sudo apt-get install libpcl-dev

  • OpenCV

sudo apt-get install libopencv-dev

  • NodeJS

sudo apt-get install nodejs

  • Kobuki robot libraries

You can find the source code in our git repository (http://github.com/jderobot/thirdparty.git)

  • SDK Parrot for ArDrone

If you want to install it manually from our third party repository, you only have to:

  1. Create a folder to compile the code mkdir ardronelib-build && cd ardronelib-build

  2. Download the installer, a CMakeLists.txt file

wget https://raw.githubusercontent.com/RoboticsURJC/JdeRobot-ThirdParty/master/ardronelib/CMakeLists.txt
wget https://raw.githubusercontent.com/RoboticsURJC/JdeRobot-ThirdParty/master/ardronelib/ffmpeg-0.8.pc.in
wget https://raw.githubusercontent.com/RoboticsURJC/JdeRobot-ThirdParty/master/ardronelib/ardronelib.pc.in
  1. Compile and install as usual:
cmake .
make
sudo make install

After installing all the dependencies you can compile the project, you can clone this repo and build it doing the following:

  • Download the source code from git:
git clone http://github.com/RoboticsURJC/JdeRobot.git
cd JdeRobot/
  • Check system and dependencies
mkdir build && cd build
cmake ..
  • Compile
make
  • Install
sudo make install

How To Contribute

To see the collaborate workflow and coding style of JdeRobot community, please refer to the wiki page.

Copyright and license

Copyright 2015 - JdeRobot Developers

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program.  If not, see <http://www.gnu.org/licenses/>.

=======

detectionmetrics's People

Contributors

ankit-dhankhar avatar chanfr avatar dependabot[bot] avatar eng-mohamedhussien avatar geofrivas avatar jessiffmm avatar jmplaza avatar mugoh avatar naxvm avatar preeti98 avatar rubenlucas93 avatar sergiopaniego avatar sleep-404 avatar stephengroat avatar vinay0410 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

detectionmetrics's Issues

Support for Keras (python) inference should be added

So DetectionSuite, which is written in C++, may invoke inference of a neural network from Keras-python for detection.

Maybe some pre-processing of the images can be required before injecting them into the Keras network.

Maybe some post-processing of the network results (bounding boxes...) can be required to deliver them in the right structure to compute statistics.

Robust Mapping between class names for Stable Conversion of datasets.

To Convert Datasets, there is a need to convert Classes from one dataset to another, especially to solve issues, like existence of synonyms between datasets for the same class. This can be solved by two methods listed below:

  1. Using a robust mapping technique which can map between synonyms, similar classes, like couch and sofa, or if one dataset contains a parent class and the other all the children, for instance one dataset contains furniture and another chair, sofa, table, etc.
    A suitable data structure has to be used to implement such a mapping.
    Still this has a drawback if the original dataset contain a class which the desired dataset doesn't, in that case some classes have to be discarded leading to losses.

  2. Writer also outputs a class names file, containing all the classes which have been encountered, but again this will make the reading process dependent on the resulting names file, and isn't a universal solution i.e wouldn't be valid outside DetectionSuite.

So, a good solution would be to incorporate both of them, i.e let the user decide, which one to opt for.

Extend DetectionSuite to include Python based detection networks

as those generated from TensorFlow and Keras. Their code should be run from the C++ DetectionSuite code.

A Python based model should be trained on its corresponding neural networks middleware, but its inference step should be called from DetectionSuite, providing it an image as input and reading its output bounding boxes from DetectionSuite too.

Calculation of Metrics in Evaluation

Hi @chanfr ,
I was going through the code written in DetectionsEvaluator.cpp here.
And, what if multiple objects of the same class are present. For example 4 chair(s) are present in a single sample. Then for a single detected chair, it will iterate over all the ground truth regions and the first one will be matched, which might not be the same object of the chair.

So, doesn't it assumes by default that detections are in the same order as Ground Truth Values.

Very Slow Parsing of large JSON files using boost property tree

In order to add support for COCO dataset #5 , it is necessary to parse large json files of the order of 300MB for 2014 and 450 MB for 2017.
This would require a fast JSON parser.
boost property tree is vaer slow and takes up all of the ram (8GB) and then hangs.
So, there are 2 possibilities which are must faster and can be used.

  1. rapidJSON: Parses in 14 seconds without taking much RAM.
  2. nholmann::json: Parses in 38 seconds without taking much RAM.

Therefore, I have decided to use rapidJSON, and is a header only library can be added to our code in the Deps folder.

Link to Comparision Code

Also, I will be adding rapidJSON in the Deps folder, so that there is no need to add extra documentation to install it, and is compatible across all environments, and also to improve version compatibility.

[1] https://github.com/Tencent/rapidjson
[2] https://github.com/nlohmann/json

Speeding up TensorFlow Inference

I just realized that tensorflow inference speed can be drastically improved by passing session as a parameter instead of graph to the inferencing function.
I will implement the same and submit a pull request

MacOS build support

Support for build on MacOS which uses Apple's LLVM Compiler. This would require some changes in CMake files, and build instructions for MacOS using brew as the packet manager.

Request for tutorial to run detector

Is there any way to save the inference files that we get with deployer? I want to save the bounding boxes and the frames of the video. I really appreciate if you can help me know it.

Support for TensorFlow (python) inference should be added

So DetectionSuite, which is written in C++, may invoke inference of a neural network from TensorFlow-python for detection.

Maybe some pre-processing of the images can be required before injecting them into the TensorFlow network.

Maybe some post-processing of the network results (bounding boxes...) can be required to deliver them in the right structure to compute statistics.

Add Support for Caffe Framework

Hi @chanfr ,
Actually, I wanted to discuss something about Caffe support. So, let me start with TensorFlow and Keras support first.
TensorFlow doesn't require anythink apart from the frozen_inference_graph.pb and is sufficient for generating inferences, for any network architecture, like SSD, Faster R-CNN, etc.
Whereas, Keras requires a config file and the weights for it, though, in newer versions only HDF5 file is enough which contains both.
But, it does require implementation of Custom functions like AnchorBoxesGenerator and L2Normalization which architectures like Faster R-CNN and SSD do require. And these functions have to be passed in the ModelBuilder.

Now, coming to Caffe, in order to implement support for networks like Faster R-CNN and SSD, people have made changes to the base repository, and reinstalled it support custom architectures like Faster R-CNN and SSD, because there is no support for them in the base repository, and these custom functions cannot be passed in the Model Builder.

So, we are left with 2 solutions to implementing Caffe support:

  1. Fork the base repository's code and change it according to our needs, but this will increase a dependency and users would have to build Caffe again for caffe support.
  2. OpenCV's dnn module has already implemented the same by writing all the custom layers required and custom fucntions in C++, and they have also written parsers for config file and .caffemodel weights file.
    And since OpenCV is already a dependency, we can use there module to implement caffe support.

Also, OpenCV doesn't have Keras support, and their TensorFlow support is too lengthy, and requires to generate a separate config file for the same.
So, we have better TensorFlow and Keras support, but we can use their Caffe implementation.

Test dl-DetectionSuite

Hi,

I'm trying to try DeepLearningSuite, but I don't know if I'm doing it the right way. I am able to run DatasetEvaluationApp, but I get a warning that I don't know if it should come out:



datasetPath
/sampleFiles/datasets/home
evaluationsPath
/sampleFiles/evaluations
inferencesPath
/sampleFiles/evaluations
namesPath
/sampleFiles/cfg/SampleGenerator
netCfgPath
/sampleFiles/cfg/darknet
weightsPath
/sampleFiles/weights/yolo_2017_07




datasetPath
/sampleFiles/datasets/home
evaluationsPath
/sampleFiles/evaluations
inferencesPath
/sampleFiles/evaluations
namesPath
/sampleFiles/cfg/SampleGenerator
netCfgPath
/sampleFiles/cfg/darknet
weightsPath
/sampleFiles/weights/yolo_2017_07


WARNING: Logging before InitGoogleLogging() is written to STDERR
W0129 17:31:21.528326 14332 ListViewConfig.cpp:89] path: /sampleFiles/weights/yolo_2017_07 does not exist
W0129 17:31:21.528415 14332 ListViewConfig.cpp:89] path: /sampleFiles/cfg/darknet does not exist
W0129 17:31:21.528518 14332 ListViewConfig.cpp:89] path: /sampleFiles/cfg/SampleGenerator does not exist

The result is:

evaluation

My appConfig.txt is:

--datasetPath
/mnt/large/pentalo/deep/datasets

--evaluationsPath
/mnt/large/pentalo/deep/evaluations

--weightsPath
/mnt/large/pentalo/deep/weights

--netCfgPath
/mnt/large/pentalo/deep/cfg/darknet

--namesPath
/mnt/large/pentalo/deep/cfg/SampleGenerator

--inferencesPath
/mnt/large/pentalo/deep/evaluations

Also, I tried to run SampleGenerationApp and the result is:

WARNING: Logging before InitGoogleLogging() is written to STDERR
W0129 17:25:17.989045 13853 SampleGenerationApp.cpp:99] Key: outputPath is not defined in the configuration file
W0129 17:25:17.989125 13853 SampleGenerationApp.cpp:99] Key: reader is not defined in the configuration file
W0129 17:25:17.989130 13853 SampleGenerationApp.cpp:99] Key: detector is not defined in the configuration file

The configuration file is:

--outputPath
/URJC

--dataPath
/sampleFiles/images
--detector
#datasetReader
deepLearning
#pentalo-bg

--inferencerImplementation
yolo

--inferencerNames
/sampleFiles/cfg/SampleGenerator/person1class.names

--inferencerConfig
/sampleFiles/cfg/darknet/yolo-voc-07-2017.cfg

--inferencerWeights
/sampleFiles/weights/yolo_2017_07/yolo-voc-07-2017.weights

--reader
#spinello
recorder-rgbd

--readerNames
none

Thank you very much,
Regards
.

Couldn't build detectionsuite

I am getting following error while linking DataSetEvaluationApp,

/opt/jderobot/lib/libJderobotInterfaces.so: undefined reference to `typeinfo for IceInternal::Cpp11FnCallbackNC' /opt/jderobot/lib/libJderobotInterfaces.so: undefined reference to `IceInternal::Cpp11FnCallbackNC::Cpp11FnCallbackNC(std::function<void (IceUtil::Exception const&)> const&, std::function<void (bool)> const&)' /opt/jderobot/lib/libJderobotInterfaces.so: undefined reference to `vtable for IceInternal::Cpp11FnCallbackNC' /opt/jderobot/lib/libJderobotInterfaces.so: undefined reference to `IceInternal::Cpp11FnCallbackNC::verify(IceInternal::Handle<Ice::LocalObject> const&)' /opt/jderobot/lib/libJderobotInterfaces.so: undefined reference to `IceInternal::Cpp11FnCallbackNC::exception(IceInternal::Handle<Ice::AsyncResult> const&, IceUtil::Exception const&) const' /opt/jderobot/lib/libJderobotInterfaces.so: undefined reference to `IceInternal::Cpp11FnCallbackNC::hasSentCallback() const' /opt/jderobot/lib/libJderobotInterfaces.so: undefined reference to `IceInternal::Cpp11FnCallbackNC::sent(IceInternal::Handle<Ice::AsyncResult> const&) const' collect2: error: ld returned 1 exit status DatasetEvaluationApp/CMakeFiles/DatasetEvaluationApp.dir/build.make:476: recipe for target 'DatasetEvaluationApp/DatasetEvaluationApp' failed make[2]: *** [DatasetEvaluationApp/DatasetEvaluationApp] Error 1 CMakeFiles/Makefile2:142: recipe for target 'DatasetEvaluationApp/CMakeFiles/DatasetEvaluationApp.dir/all' failed make[1]: *** [DatasetEvaluationApp/CMakeFiles/DatasetEvaluationApp.dir/all] Error 2 Makefile:83: recipe for target 'all' failed make: *** [all] Error 2

This possibly means that JdeRobotInterfaces isn't build using std=c++11, although it is supposed to.
Maybe, Ice isn't installed with c++11 standard.
I will try building ice from source and then try the same.

Viewing Spinello dataset

I was trying to view spinello's depth images. And the output I am getting is something like this.

image

And it doesn't match with the video.
So is there some problem in conversion from grayscale to color mapping of depth ?
Or this is the desired output ?

This is a sample conversion from grayscale
image

Image Format Specification for Inferencers

Inferencers generally accept rgb images for inferencing whereas opencv reads images in BGR format, therefore it might be necessary for some cases to swap R and B channels.
So, an option has to be integrated in the UI to take care of this factor.
And by default it should be RGB.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.