├── README.md
├── darknet_ros_old
├── LICENSE
├── README.md
├── darknet
│ ├── LICENSE
│ ├── LICENSE.fuck
│ ├── LICENSE.gen
│ ├── LICENSE.gpl
│ ├── LICENSE.meta
│ ├── LICENSE.mit
│ ├── LICENSE.v1
│ ├── Makefile
│ ├── README.md
│ ├── cfg
│ │ ├── alexnet.cfg
│ │ ├── cifar.cfg
│ │ ├── cifar.test.cfg
│ │ ├── coco.data
│ │ ├── combine9k.data
│ │ ├── darknet.cfg
│ │ ├── darknet19.cfg
│ │ ├── darknet19_448.cfg
│ │ ├── darknet9000.cfg
│ │ ├── densenet201.cfg
│ │ ├── extraction.cfg
│ │ ├── extraction.conv.cfg
│ │ ├── extraction22k.cfg
│ │ ├── go.cfg
│ │ ├── go.test.cfg
│ │ ├── gru.cfg
│ │ ├── imagenet1k.data
│ │ ├── imagenet22k.dataset
│ │ ├── imagenet9k.hierarchy.dataset
│ │ ├── jnet-conv.cfg
│ │ ├── resnet152.cfg
│ │ ├── resnet50.cfg
│ │ ├── rnn.cfg
│ │ ├── rnn.train.cfg
│ │ ├── strided.cfg
│ │ ├── t1.test.cfg
│ │ ├── tiny.cfg
│ │ ├── vgg-16.cfg
│ │ ├── vgg-conv.cfg
│ │ ├── voc.data
│ │ ├── writing.cfg
│ │ ├── yolo9000.cfg
│ │ ├── yolov1-tiny.cfg
│ │ ├── yolov1.cfg
│ │ ├── yolov2-tiny-voc.cfg
│ │ ├── yolov2-tiny.cfg
│ │ ├── yolov2-voc.cfg
│ │ ├── yolov2.cfg
│ │ ├── yolov3-voc.cfg
│ │ └── yolov3.cfg
│ ├── examples
│ │ ├── art.c
│ │ ├── attention.c
│ │ ├── captcha.c
│ │ ├── cifar.c
│ │ ├── classifier.c
│ │ ├── coco.c
│ │ ├── darknet.c
│ │ ├── detector-scipy-opencv.py
│ │ ├── detector.c
│ │ ├── detector.py
│ │ ├── dice.c
│ │ ├── go.c
│ │ ├── lsd.c
│ │ ├── nightmare.c
│ │ ├── regressor.c
│ │ ├── rnn.c
│ │ ├── rnn_vid.c
│ │ ├── segmenter.c
│ │ ├── super.c
│ │ ├── swag.c
│ │ ├── tag.c
│ │ ├── voxel.c
│ │ ├── writing.c
│ │ └── yolo.c
│ ├── include
│ │ └── darknet.h
│ ├── python
│ │ ├── darknet.py
│ │ └── proverbot.py
│ ├── scripts
│ │ ├── dice_label.sh
│ │ ├── gen_tactic.sh
│ │ ├── get_coco_dataset.sh
│ │ ├── imagenet_label.sh
│ │ └── voc_label.py
│ └── src
│ │ ├── activation_kernels.cu
│ │ ├── activation_layer.c
│ │ ├── activation_layer.h
│ │ ├── activations.c
│ │ ├── activations.h
│ │ ├── avgpool_layer.c
│ │ ├── avgpool_layer.h
│ │ ├── avgpool_layer_kernels.cu
│ │ ├── batchnorm_layer.c
│ │ ├── batchnorm_layer.h
│ │ ├── blas.c
│ │ ├── blas.h
│ │ ├── blas_kernels.cu
│ │ ├── box.c
│ │ ├── box.h
│ │ ├── classifier.h
│ │ ├── col2im.c
│ │ ├── col2im.h
│ │ ├── col2im_kernels.cu
│ │ ├── compare.c
│ │ ├── connected_layer.c
│ │ ├── connected_layer.h
│ │ ├── convolutional_kernels.cu
│ │ ├── convolutional_layer.c
│ │ ├── convolutional_layer.h
│ │ ├── cost_layer.c
│ │ ├── cost_layer.h
│ │ ├── crnn_layer.c
│ │ ├── crnn_layer.h
│ │ ├── crop_layer.c
│ │ ├── crop_layer.h
│ │ ├── crop_layer_kernels.cu
│ │ ├── cuda.c
│ │ ├── cuda.h
│ │ ├── data.c
│ │ ├── data.h
│ │ ├── deconvolutional_kernels.cu
│ │ ├── deconvolutional_layer.c
│ │ ├── deconvolutional_layer.h
│ │ ├── demo.c
│ │ ├── demo.h
│ │ ├── detection_layer.c
│ │ ├── detection_layer.h
│ │ ├── dropout_layer.c
│ │ ├── dropout_layer.h
│ │ ├── dropout_layer_kernels.cu
│ │ ├── gemm.c
│ │ ├── gemm.h
│ │ ├── gru_layer.c
│ │ ├── gru_layer.h
│ │ ├── im2col.c
│ │ ├── im2col.h
│ │ ├── im2col_kernels.cu
│ │ ├── image.c
│ │ ├── image.h
│ │ ├── l2norm_layer.c
│ │ ├── l2norm_layer.h
│ │ ├── layer.c
│ │ ├── layer.h
│ │ ├── list.c
│ │ ├── list.h
│ │ ├── local_layer.c
│ │ ├── local_layer.h
│ │ ├── logistic_layer.c
│ │ ├── logistic_layer.h
│ │ ├── lstm_layer.c
│ │ ├── lstm_layer.h
│ │ ├── matrix.c
│ │ ├── matrix.h
│ │ ├── maxpool_layer.c
│ │ ├── maxpool_layer.h
│ │ ├── maxpool_layer_kernels.cu
│ │ ├── network.c
│ │ ├── network.h
│ │ ├── normalization_layer.c
│ │ ├── normalization_layer.h
│ │ ├── option_list.c
│ │ ├── option_list.h
│ │ ├── parser.c
│ │ ├── parser.h
│ │ ├── region_layer.c
│ │ ├── region_layer.h
│ │ ├── reorg_layer.c
│ │ ├── reorg_layer.h
│ │ ├── rnn_layer.c
│ │ ├── rnn_layer.h
│ │ ├── route_layer.c
│ │ ├── route_layer.h
│ │ ├── shortcut_layer.c
│ │ ├── shortcut_layer.h
│ │ ├── softmax_layer.c
│ │ ├── softmax_layer.h
│ │ ├── stb_image.h
│ │ ├── stb_image_write.h
│ │ ├── tree.c
│ │ ├── tree.h
│ │ ├── upsample_layer.c
│ │ ├── upsample_layer.h
│ │ ├── utils.c
│ │ ├── utils.h
│ │ ├── yolo_layer.c
│ │ └── yolo_layer.h
├── darknet_ros
│ ├── CHANGELOG.rst
│ ├── CMakeLists.txt
│ ├── config
│ │ ├── ros.yaml
│ │ ├── yolov2-tiny-voc.yaml
│ │ ├── yolov2-tiny.yaml
│ │ ├── yolov2-voc.yaml
│ │ ├── yolov2.yaml
│ │ ├── yolov3-voc.yaml
│ │ └── yolov3.yaml
│ ├── doc
│ │ ├── quadruped_anymal_and_person.JPG
│ │ ├── test_detection.png
│ │ └── test_detection_anymal.png
│ ├── include
│ │ └── darknet_ros
│ │ │ ├── YoloObjectDetector.hpp
│ │ │ └── image_interface.h
│ ├── launch
│ │ ├── darknet_ros.launch
│ │ ├── darknet_ros_gdb.launch
│ │ └── yolo_v3.launch
│ ├── package.xml
│ ├── src
│ │ ├── YoloObjectDetector.cpp
│ │ ├── image_interface.c
│ │ └── yolo_object_detector_node.cpp
│ ├── test
│ │ ├── ObjectDetection.cpp
│ │ ├── object_detection.test
│ │ ├── test_main.cpp
│ │ └── yolov2.yaml
│ └── yolo_network_config
│ │ ├── cfg
│ │ ├── yolov2-tiny-voc.cfg
│ │ ├── yolov2-tiny.cfg
│ │ ├── yolov2-voc.cfg
│ │ ├── yolov2.cfg
│ │ ├── yolov3-voc.cfg
│ │ └── yolov3.cfg
│ │ └── weights
│ │ ├── .gitignore
│ │ └── how_to_download_weights.txt
├── darknet_ros_msgs
│ ├── CHANGELOG.rst
│ ├── CMakeLists.txt
│ ├── action
│ │ └── CheckForObjects.action
│ ├── msg
│ │ ├── BoundingBox.msg
│ │ └── BoundingBoxes.msg
│ └── package.xml
└── jenkins-pipeline
├── depthGet
├── CMakeLists.txt
├── msg
│ ├── BboxL.msg
│ ├── BboxLes.msg
│ ├── BoundingBox.msg
│ └── BoundingBoxes.msg
├── package.xml
└── src
│ └── depthget.cpp
├── figure
├── data.jpg
├── fact.png
├── grid.png
├── kitti_player.png
├── pclvis.png
├── result.gif
├── roibox.png
├── rosnode.jpg
└── yolov3.png
├── kitti_player
├── CMakeLists.txt
├── Makefile
├── README.md
├── README_reference.md
├── cfg
│ ├── kitti_player.cfg
│ └── rviz_kitti_player.rviz
├── launch
│ ├── kittiplayer_libviso2.launch
│ └── kittiplayer_standalone.launch
├── package.xml
└── src
│ └── kitti_player.cpp
├── opencv_deal
├── CMakeLists.txt
├── msg
│ ├── BboxL.msg
│ └── BboxLes.msg
├── package.xml
└── src
│ ├── calib.txt
│ └── showROI.cpp
└── pcl_deal
├── CMakeLists.txt
├── PCLConfig.cmake
├── package.xml
└── src
├── ROIviewer.cpp
├── pclvirualtest.cpp
├── pclvis.cpp
└── pointdeal.cpp
/README.md:
--------------------------------------------------------------------------------
1 | # Camera-Lidar-Fusion-ROS
2 |
3 | ## Introduction
4 |
5 | There are 5 ros package:
6 |
7 | - kitti_player : publish KITTI data.
8 | - pcl_deal : contain `/PointCloudDeal` and `/ROIviewer`. Objects are detected by simple height threshold.
9 | - opencv_deal : 3D box to 2D. 3D-2Dbox overlap is simply solved by IoU and several rules. (The origin idea is to detection on `/ROIpicture`, but the result is not very good. `/ROI2D` is results of the 3D-2Dbox.)
10 | - darknet_ros_old : Yolov3 detection node. It is a old version of [eggedrobotics/darknet_ros](https://github.com/leggedrobotics/darknet_ros). Thanks to their job.
11 | - depthGet : fuse 3D-2Dbox and 2D-YOLObox in picture Coordinate by simple IoU.
12 |
13 | The ROS node graph is as below.
14 |
15 | 
16 |
17 | ## Result
18 |
19 | The light blue box is result of Lidar. The light red box is result of YOLO. The dark red box is result of fusion.
20 |
21 | 
22 |
23 | ## How to run
24 |
25 | ### Requirement
26 |
27 | ROS;OpenCV;PCL
28 |
29 | ### Prepare
30 |
31 | - Download KITTI dataset into `kitti_player/`. You can get from [Baidu Wangpan]( https://pan.baidu.com/s/1LEUfrkkqPEM3rdOwEa7liQ) password: w4qk.
32 | - Download the Yolo weight into `darknet_ros_old/darknet_ros/yolo_network_config/weights/`. Please do as [eggedrobotics/darknet_ros](https://github.com/leggedrobotics/darknet_ros). Or you can also get YOLOv3 weights from [Baidu Wangpan]( https://pan.baidu.com/s/1LEUfrkkqPEM3rdOwEa7liQ) password: w4qk.
33 |
34 | ### Build
35 |
36 | Check the data path and ros topic name (if you use your own dataset).
37 |
38 | Finally, `catkin_make`.
39 |
40 | ### Run
41 |
42 | - Punlish kitti data
43 |
44 | ```
45 | roslaunch kitti_player kittiplayer_standalone.launch
46 | ```
47 |
48 | 
49 |
50 |
51 |
52 | - Point cloud detection
53 |
54 | ```
55 | rosrun pcl_deal pointdeal
56 | ```
57 |
58 | Three monitoring method are provided.
59 |
60 | - You can use `rosrun pcl_de pclvis` to see point cloud in PCL.
61 |
62 |
63 |
64 |
65 |
66 | - You can use `rviz` to subscribe `/ROIpoint` topic in order to see the 2D grid results.
67 |
68 |
69 |
70 | - You can use `rosrun pcl_de ROIviewer` to monitor the point cloud detection result.
71 |
72 |
73 |
74 | - 3D boxes to 2D
75 |
76 | ```
77 | rosrun opencv_deal showROI
78 | ```
79 |
80 | - YOLOv3
81 |
82 | ```
83 | roslaunch darknet_ros_old yolo_v3.launch
84 | ```
85 |
86 |
87 |
88 | - Finally, fuse category and location
89 |
90 | ```
91 | rosrun depthG depthget
92 | ```
93 |
94 | Then, have fun ! You can see the result through `/depthMap` topic.
95 |
96 | ## Note
97 |
98 | It's a part of my undergraduate thesis. There are likely many spelling mistake and redundant code. And the codes are ugly. But I will be happy if this repo can help you. Please feel free to open an issue if you have any questions.
99 |
--------------------------------------------------------------------------------
/darknet_ros_old/LICENSE:
--------------------------------------------------------------------------------
1 | Copyright (c) 2017, Marko Bjelonic, Robotic Systems Lab, ETH Zurich
2 | All rights reserved.
3 |
4 | Redistribution and use in source and binary forms, with or without
5 | modification, are permitted provided that the following conditions are met:
6 | * Redistributions of source code must retain the above copyright
7 | notice, this list of conditions and the following disclaimer.
8 | * Redistributions in binary form must reproduce the above copyright
9 | notice, this list of conditions and the following disclaimer in the
10 | documentation and/or other materials provided with the distribution.
11 | * Neither the name of the copyright holder nor the names of its
12 | contributors may be used to endorse or promote products derived
13 | from this software without specific prior written permission.
14 |
15 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
16 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
17 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
18 | DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY
19 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
20 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
21 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
22 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
24 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25 |
--------------------------------------------------------------------------------
/darknet_ros_old/darknet/LICENSE:
--------------------------------------------------------------------------------
1 | YOLO LICENSE
2 | Version 2, July 29 2016
3 |
4 | THIS SOFTWARE LICENSE IS PROVIDED "ALL CAPS" SO THAT YOU KNOW IT IS SUPER
5 | SERIOUS AND YOU DON'T MESS AROUND WITH COPYRIGHT LAW BECAUSE YOU WILL GET IN
6 | TROUBLE HERE ARE SOME OTHER BUZZWORDS COMMONLY IN THESE THINGS WARRANTIES
7 | LIABILITY CONTRACT TORT LIABLE CLAIMS RESTRICTION MERCHANTABILITY. NOW HERE'S
8 | THE REAL LICENSE:
9 |
10 | 0. Darknet is public domain.
11 | 1. Do whatever you want with it.
12 | 2. Stop emailing me about it!
13 |
--------------------------------------------------------------------------------
/darknet_ros_old/darknet/LICENSE.fuck:
--------------------------------------------------------------------------------
1 | DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
2 | Version 2, December 2004
3 |
4 | Copyright (C) 2004 Sam Hocevar
5 |
6 | Everyone is permitted to copy and distribute verbatim or modified
7 | copies of this license document, and changing it is allowed as long
8 | as the name is changed.
9 |
10 | DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
11 | TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
12 |
13 | 0. You just DO WHAT THE FUCK YOU WANT TO.
14 |
--------------------------------------------------------------------------------
/darknet_ros_old/darknet/LICENSE.meta:
--------------------------------------------------------------------------------
1 | META-LICENSE
2 | Version 1, June 21 2017
3 |
4 | Any and all licenses may be applied to the software either individually
5 | or in concert. Any issues, ambiguities, paradoxes, or metaphysical quandries
6 | arising from this combination should be discussed with a local faith leader,
7 | hermit, or guru. The Oxford comma shall be used.
8 |
9 |
--------------------------------------------------------------------------------
/darknet_ros_old/darknet/LICENSE.mit:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2017 Joseph Redmon
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
23 |
--------------------------------------------------------------------------------
/darknet_ros_old/darknet/LICENSE.v1:
--------------------------------------------------------------------------------
1 | YOLO LICENSE
2 | Version 1, July 10 2015
3 |
4 | THIS SOFTWARE LICENSE IS PROVIDED "ALL CAPS" SO THAT YOU KNOW IT IS SUPER
5 | SERIOUS AND YOU DON'T MESS AROUND WITH COPYRIGHT LAW BECAUSE YOU WILL GET IN
6 | TROUBLE HERE ARE SOME OTHER BUZZWORDS COMMONLY IN THESE THINGS WARRANTIES
7 | LIABILITY CONTRACT TORT LIABLE CLAIMS RESTRICTION MERCHANTABILITY SUBJECT TO
8 | THE FOLLOWING CONDITIONS:
9 |
10 | 1. #yolo
11 | 2. #swag
12 | 3. #blazeit
13 |
14 |
--------------------------------------------------------------------------------
/darknet_ros_old/darknet/Makefile:
--------------------------------------------------------------------------------
1 | GPU=0
2 | CUDNN=0
3 | OPENCV=0
4 | OPENMP=0
5 | DEBUG=0
6 |
7 | ARCH= -gencode arch=compute_30,code=sm_30 \
8 | -gencode arch=compute_35,code=sm_35 \
9 | -gencode arch=compute_50,code=[sm_50,compute_50] \
10 | -gencode arch=compute_52,code=[sm_52,compute_52]
11 | # -gencode arch=compute_20,code=[sm_20,sm_21] \ This one is deprecated?
12 |
13 | # This is what I use, uncomment if you know your arch and want to specify
14 | # ARCH= -gencode arch=compute_52,code=compute_52
15 |
16 | VPATH=./src/:./examples
17 | SLIB=libdarknet.so
18 | ALIB=libdarknet.a
19 | EXEC=darknet
20 | OBJDIR=./obj/
21 |
22 | CC=gcc
23 | NVCC=nvcc
24 | AR=ar
25 | ARFLAGS=rcs
26 | OPTS=-Ofast
27 | LDFLAGS= -lm -pthread
28 | COMMON= -Iinclude/ -Isrc/
29 | CFLAGS=-Wall -Wno-unused-result -Wno-unknown-pragmas -Wfatal-errors -fPIC
30 |
31 | ifeq ($(OPENMP), 1)
32 | CFLAGS+= -fopenmp
33 | endif
34 |
35 | ifeq ($(DEBUG), 1)
36 | OPTS=-O0 -g
37 | endif
38 |
39 | CFLAGS+=$(OPTS)
40 |
41 | ifeq ($(OPENCV), 1)
42 | COMMON+= -DOPENCV
43 | CFLAGS+= -DOPENCV
44 | LDFLAGS+= `pkg-config --libs opencv`
45 | COMMON+= `pkg-config --cflags opencv`
46 | endif
47 |
48 | ifeq ($(GPU), 1)
49 | COMMON+= -DGPU -I/usr/local/cuda/include/
50 | CFLAGS+= -DGPU
51 | LDFLAGS+= -L/usr/local/cuda/lib64 -lcuda -lcudart -lcublas -lcurand
52 | endif
53 |
54 | ifeq ($(CUDNN), 1)
55 | COMMON+= -DCUDNN
56 | CFLAGS+= -DCUDNN
57 | LDFLAGS+= -lcudnn
58 | endif
59 |
60 | OBJ=gemm.o utils.o cuda.o deconvolutional_layer.o convolutional_layer.o list.o image.o activations.o im2col.o col2im.o blas.o crop_layer.o dropout_layer.o maxpool_layer.o softmax_layer.o data.o matrix.o network.o connected_layer.o cost_layer.o parser.o option_list.o detection_layer.o route_layer.o upsample_layer.o box.o normalization_layer.o avgpool_layer.o layer.o local_layer.o shortcut_layer.o logistic_layer.o activation_layer.o rnn_layer.o gru_layer.o crnn_layer.o demo.o batchnorm_layer.o region_layer.o reorg_layer.o tree.o lstm_layer.o l2norm_layer.o yolo_layer.o
61 | EXECOBJA=captcha.o lsd.o super.o art.o tag.o cifar.o go.o rnn.o segmenter.o regressor.o classifier.o coco.o yolo.o detector.o nightmare.o darknet.o
62 | ifeq ($(GPU), 1)
63 | LDFLAGS+= -lstdc++
64 | OBJ+=convolutional_kernels.o deconvolutional_kernels.o activation_kernels.o im2col_kernels.o col2im_kernels.o blas_kernels.o crop_layer_kernels.o dropout_layer_kernels.o maxpool_layer_kernels.o avgpool_layer_kernels.o
65 | endif
66 |
67 | EXECOBJ = $(addprefix $(OBJDIR), $(EXECOBJA))
68 | OBJS = $(addprefix $(OBJDIR), $(OBJ))
69 | DEPS = $(wildcard src/*.h) Makefile include/darknet.h
70 |
71 | #all: obj backup results $(SLIB) $(ALIB) $(EXEC)
72 | all: obj results $(SLIB) $(ALIB) $(EXEC)
73 |
74 |
75 | $(EXEC): $(EXECOBJ) $(ALIB)
76 | $(CC) $(COMMON) $(CFLAGS) $^ -o $@ $(LDFLAGS) $(ALIB)
77 |
78 | $(ALIB): $(OBJS)
79 | $(AR) $(ARFLAGS) $@ $^
80 |
81 | $(SLIB): $(OBJS)
82 | $(CC) $(CFLAGS) -shared $^ -o $@ $(LDFLAGS)
83 |
84 | $(OBJDIR)%.o: %.c $(DEPS)
85 | $(CC) $(COMMON) $(CFLAGS) -c $< -o $@
86 |
87 | $(OBJDIR)%.o: %.cu $(DEPS)
88 | $(NVCC) $(ARCH) $(COMMON) --compiler-options "$(CFLAGS)" -c $< -o $@
89 |
90 | obj:
91 | mkdir -p obj
92 | backup:
93 | mkdir -p backup
94 | results:
95 | mkdir -p results
96 |
97 | .PHONY: clean
98 |
99 | clean:
100 | rm -rf $(OBJS) $(SLIB) $(ALIB) $(EXEC) $(EXECOBJ) $(OBJDIR)/*
101 |
102 |
--------------------------------------------------------------------------------
/darknet_ros_old/darknet/README.md:
--------------------------------------------------------------------------------
1 | 
2 |
3 | # Darknet #
4 | Darknet is an open source neural network framework written in C and CUDA. It is fast, easy to install, and supports CPU and GPU computation.
5 |
6 | For more information see the [Darknet project website](http://pjreddie.com/darknet).
7 |
8 | For questions or issues please use the [Google Group](https://groups.google.com/forum/#!forum/darknet).
9 |
--------------------------------------------------------------------------------
/darknet_ros_old/darknet/cfg/alexnet.cfg:
--------------------------------------------------------------------------------
1 | [net]
2 | batch=128
3 | subdivisions=1
4 | height=227
5 | width=227
6 | channels=3
7 | momentum=0.9
8 | decay=0.0005
9 | max_crop=256
10 |
11 | learning_rate=0.01
12 | policy=poly
13 | power=4
14 | max_batches=800000
15 |
16 | angle=7
17 | hue = .1
18 | saturation=.75
19 | exposure=.75
20 | aspect=.75
21 |
22 | [convolutional]
23 | filters=96
24 | size=11
25 | stride=4
26 | pad=0
27 | activation=relu
28 |
29 | [maxpool]
30 | size=3
31 | stride=2
32 | padding=0
33 |
34 | [convolutional]
35 | filters=256
36 | size=5
37 | stride=1
38 | pad=1
39 | activation=relu
40 |
41 | [maxpool]
42 | size=3
43 | stride=2
44 | padding=0
45 |
46 | [convolutional]
47 | filters=384
48 | size=3
49 | stride=1
50 | pad=1
51 | activation=relu
52 |
53 | [convolutional]
54 | filters=384
55 | size=3
56 | stride=1
57 | pad=1
58 | activation=relu
59 |
60 | [convolutional]
61 | filters=256
62 | size=3
63 | stride=1
64 | pad=1
65 | activation=relu
66 |
67 | [maxpool]
68 | size=3
69 | stride=2
70 | padding=0
71 |
72 | [connected]
73 | output=4096
74 | activation=relu
75 |
76 | [dropout]
77 | probability=.5
78 |
79 | [connected]
80 | output=4096
81 | activation=relu
82 |
83 | [dropout]
84 | probability=.5
85 |
86 | [connected]
87 | output=1000
88 | activation=linear
89 |
90 | [softmax]
91 | groups=1
92 |
93 | [cost]
94 | type=sse
95 |
96 |
--------------------------------------------------------------------------------
/darknet_ros_old/darknet/cfg/cifar.cfg:
--------------------------------------------------------------------------------
1 | [net]
2 | batch=128
3 | subdivisions=1
4 | height=28
5 | width=28
6 | channels=3
7 | max_crop=32
8 | min_crop=32
9 |
10 | hue=.1
11 | saturation=.75
12 | exposure=.75
13 |
14 | learning_rate=0.4
15 | policy=poly
16 | power=4
17 | max_batches = 5000
18 | momentum=0.9
19 | decay=0.0005
20 |
21 |
22 | [convolutional]
23 | batch_normalize=1
24 | filters=128
25 | size=3
26 | stride=1
27 | pad=1
28 | activation=leaky
29 |
30 | [convolutional]
31 | batch_normalize=1
32 | filters=128
33 | size=3
34 | stride=1
35 | pad=1
36 | activation=leaky
37 |
38 | [convolutional]
39 | batch_normalize=1
40 | filters=128
41 | size=3
42 | stride=1
43 | pad=1
44 | activation=leaky
45 |
46 | [maxpool]
47 | size=2
48 | stride=2
49 |
50 | [dropout]
51 | probability=.5
52 |
53 | [convolutional]
54 | batch_normalize=1
55 | filters=256
56 | size=3
57 | stride=1
58 | pad=1
59 | activation=leaky
60 |
61 | [convolutional]
62 | batch_normalize=1
63 | filters=256
64 | size=3
65 | stride=1
66 | pad=1
67 | activation=leaky
68 |
69 | [convolutional]
70 | batch_normalize=1
71 | filters=256
72 | size=3
73 | stride=1
74 | pad=1
75 | activation=leaky
76 |
77 | [maxpool]
78 | size=2
79 | stride=2
80 |
81 | [dropout]
82 | probability=.5
83 |
84 | [convolutional]
85 | batch_normalize=1
86 | filters=512
87 | size=3
88 | stride=1
89 | pad=1
90 | activation=leaky
91 |
92 | [convolutional]
93 | batch_normalize=1
94 | filters=512
95 | size=3
96 | stride=1
97 | pad=1
98 | activation=leaky
99 |
100 | [convolutional]
101 | batch_normalize=1
102 | filters=512
103 | size=3
104 | stride=1
105 | pad=1
106 | activation=leaky
107 |
108 | [dropout]
109 | probability=.5
110 |
111 | [convolutional]
112 | filters=10
113 | size=1
114 | stride=1
115 | pad=1
116 | activation=leaky
117 |
118 | [avgpool]
119 |
120 | [softmax]
121 | groups=1
122 |
123 | [cost]
124 |
125 |
--------------------------------------------------------------------------------
/darknet_ros_old/darknet/cfg/cifar.test.cfg:
--------------------------------------------------------------------------------
1 | [net]
2 | batch=128
3 | subdivisions=1
4 | height=32
5 | width=32
6 | channels=3
7 | momentum=0.9
8 | decay=0.0005
9 |
10 | learning_rate=0.4
11 | policy=poly
12 | power=4
13 | max_batches = 50000
14 |
15 |
16 | [convolutional]
17 | batch_normalize=1
18 | filters=128
19 | size=3
20 | stride=1
21 | pad=1
22 | activation=leaky
23 |
24 | [convolutional]
25 | batch_normalize=1
26 | filters=128
27 | size=3
28 | stride=1
29 | pad=1
30 | activation=leaky
31 |
32 | [convolutional]
33 | batch_normalize=1
34 | filters=128
35 | size=3
36 | stride=1
37 | pad=1
38 | activation=leaky
39 |
40 | [maxpool]
41 | size=2
42 | stride=2
43 |
44 | [dropout]
45 | probability=.5
46 |
47 | [convolutional]
48 | batch_normalize=1
49 | filters=256
50 | size=3
51 | stride=1
52 | pad=1
53 | activation=leaky
54 |
55 | [convolutional]
56 | batch_normalize=1
57 | filters=256
58 | size=3
59 | stride=1
60 | pad=1
61 | activation=leaky
62 |
63 | [convolutional]
64 | batch_normalize=1
65 | filters=256
66 | size=3
67 | stride=1
68 | pad=1
69 | activation=leaky
70 |
71 | [maxpool]
72 | size=2
73 | stride=2
74 |
75 | [dropout]
76 | probability=.5
77 |
78 | [convolutional]
79 | batch_normalize=1
80 | filters=512
81 | size=3
82 | stride=1
83 | pad=1
84 | activation=leaky
85 |
86 | [convolutional]
87 | batch_normalize=1
88 | filters=512
89 | size=3
90 | stride=1
91 | pad=1
92 | activation=leaky
93 |
94 | [convolutional]
95 | batch_normalize=1
96 | filters=512
97 | size=3
98 | stride=1
99 | pad=1
100 | activation=leaky
101 |
102 | [dropout]
103 | probability=.5
104 |
105 | [convolutional]
106 | filters=10
107 | size=1
108 | stride=1
109 | pad=1
110 | activation=leaky
111 |
112 | [avgpool]
113 |
114 | [softmax]
115 | groups=1
116 | temperature=3
117 |
118 | [cost]
119 |
120 |
--------------------------------------------------------------------------------
/darknet_ros_old/darknet/cfg/coco.data:
--------------------------------------------------------------------------------
1 | classes= 80
2 | train = /home/pjreddie/data/coco/trainvalno5k.txt
3 | #valid = coco_testdev
4 | valid = data/coco_val_5k.list
5 | names = data/coco.names
6 | backup = /home/pjreddie/backup/
7 | eval=coco
8 |
9 |
--------------------------------------------------------------------------------
/darknet_ros_old/darknet/cfg/combine9k.data:
--------------------------------------------------------------------------------
1 | classes= 9418
2 | #train = /home/pjreddie/data/coco/trainvalno5k.txt
3 | train = data/combine9k.train.list
4 | valid = /home/pjreddie/data/imagenet/det.val.files
5 | labels = data/9k.labels
6 | names = data/9k.names
7 | backup = backup/
8 | map = data/inet9k.map
9 | eval = imagenet
10 | results = results
11 |
--------------------------------------------------------------------------------
/darknet_ros_old/darknet/cfg/darknet.cfg:
--------------------------------------------------------------------------------
1 | [net]
2 | # Train
3 | batch=128
4 | subdivisions=1
5 | # Test
6 | #batch=1
7 | #subdivisions=1
8 | height=256
9 | width=256
10 | channels=3
11 | momentum=0.9
12 | decay=0.0005
13 | max_crop=320
14 |
15 | learning_rate=0.1
16 | policy=poly
17 | power=4
18 | max_batches=1600000
19 |
20 | [convolutional]
21 | batch_normalize=1
22 | filters=16
23 | size=3
24 | stride=1
25 | pad=1
26 | activation=leaky
27 |
28 | [maxpool]
29 | size=2
30 | stride=2
31 |
32 | [convolutional]
33 | batch_normalize=1
34 | filters=32
35 | size=3
36 | stride=1
37 | pad=1
38 | activation=leaky
39 |
40 | [maxpool]
41 | size=2
42 | stride=2
43 |
44 | [convolutional]
45 | batch_normalize=1
46 | filters=64
47 | size=3
48 | stride=1
49 | pad=1
50 | activation=leaky
51 |
52 | [maxpool]
53 | size=2
54 | stride=2
55 |
56 | [convolutional]
57 | batch_normalize=1
58 | filters=128
59 | size=3
60 | stride=1
61 | pad=1
62 | activation=leaky
63 |
64 | [maxpool]
65 | size=2
66 | stride=2
67 |
68 | [convolutional]
69 | batch_normalize=1
70 | filters=256
71 | size=3
72 | stride=1
73 | pad=1
74 | activation=leaky
75 |
76 | [maxpool]
77 | size=2
78 | stride=2
79 |
80 | [convolutional]
81 | batch_normalize=1
82 | filters=512
83 | size=3
84 | stride=1
85 | pad=1
86 | activation=leaky
87 |
88 | [maxpool]
89 | size=2
90 | stride=2
91 |
92 | [convolutional]
93 | batch_normalize=1
94 | filters=1024
95 | size=3
96 | stride=1
97 | pad=1
98 | activation=leaky
99 |
100 | [convolutional]
101 | filters=1000
102 | size=1
103 | stride=1
104 | pad=1
105 | activation=leaky
106 |
107 | [avgpool]
108 |
109 | [softmax]
110 | groups=1
111 |
112 |
--------------------------------------------------------------------------------
/darknet_ros_old/darknet/cfg/darknet19.cfg:
--------------------------------------------------------------------------------
1 | [net]
2 | # Training
3 | #batch=128
4 | #subdivisions=2
5 |
6 | # Testing
7 | batch=1
8 | subdivisions=1
9 |
10 | height=256
11 | width=256
12 | min_crop=128
13 | max_crop=448
14 | channels=3
15 | momentum=0.9
16 | decay=0.0005
17 |
18 | burn_in=1000
19 | learning_rate=0.1
20 | policy=poly
21 | power=4
22 | max_batches=800000
23 |
24 | angle=7
25 | hue=.1
26 | saturation=.75
27 | exposure=.75
28 | aspect=.75
29 |
30 | [convolutional]
31 | batch_normalize=1
32 | filters=32
33 | size=3
34 | stride=1
35 | pad=1
36 | activation=leaky
37 |
38 | [maxpool]
39 | size=2
40 | stride=2
41 |
42 | [convolutional]
43 | batch_normalize=1
44 | filters=64
45 | size=3
46 | stride=1
47 | pad=1
48 | activation=leaky
49 |
50 | [maxpool]
51 | size=2
52 | stride=2
53 |
54 | [convolutional]
55 | batch_normalize=1
56 | filters=128
57 | size=3
58 | stride=1
59 | pad=1
60 | activation=leaky
61 |
62 | [convolutional]
63 | batch_normalize=1
64 | filters=64
65 | size=1
66 | stride=1
67 | pad=1
68 | activation=leaky
69 |
70 | [convolutional]
71 | batch_normalize=1
72 | filters=128
73 | size=3
74 | stride=1
75 | pad=1
76 | activation=leaky
77 |
78 | [maxpool]
79 | size=2
80 | stride=2
81 |
82 | [convolutional]
83 | batch_normalize=1
84 | filters=256
85 | size=3
86 | stride=1
87 | pad=1
88 | activation=leaky
89 |
90 | [convolutional]
91 | batch_normalize=1
92 | filters=128
93 | size=1
94 | stride=1
95 | pad=1
96 | activation=leaky
97 |
98 | [convolutional]
99 | batch_normalize=1
100 | filters=256
101 | size=3
102 | stride=1
103 | pad=1
104 | activation=leaky
105 |
106 | [maxpool]
107 | size=2
108 | stride=2
109 |
110 | [convolutional]
111 | batch_normalize=1
112 | filters=512
113 | size=3
114 | stride=1
115 | pad=1
116 | activation=leaky
117 |
118 | [convolutional]
119 | batch_normalize=1
120 | filters=256
121 | size=1
122 | stride=1
123 | pad=1
124 | activation=leaky
125 |
126 | [convolutional]
127 | batch_normalize=1
128 | filters=512
129 | size=3
130 | stride=1
131 | pad=1
132 | activation=leaky
133 |
134 | [convolutional]
135 | batch_normalize=1
136 | filters=256
137 | size=1
138 | stride=1
139 | pad=1
140 | activation=leaky
141 |
142 | [convolutional]
143 | batch_normalize=1
144 | filters=512
145 | size=3
146 | stride=1
147 | pad=1
148 | activation=leaky
149 |
150 | [maxpool]
151 | size=2
152 | stride=2
153 |
154 | [convolutional]
155 | batch_normalize=1
156 | filters=1024
157 | size=3
158 | stride=1
159 | pad=1
160 | activation=leaky
161 |
162 | [convolutional]
163 | batch_normalize=1
164 | filters=512
165 | size=1
166 | stride=1
167 | pad=1
168 | activation=leaky
169 |
170 | [convolutional]
171 | batch_normalize=1
172 | filters=1024
173 | size=3
174 | stride=1
175 | pad=1
176 | activation=leaky
177 |
178 | [convolutional]
179 | batch_normalize=1
180 | filters=512
181 | size=1
182 | stride=1
183 | pad=1
184 | activation=leaky
185 |
186 | [convolutional]
187 | batch_normalize=1
188 | filters=1024
189 | size=3
190 | stride=1
191 | pad=1
192 | activation=leaky
193 |
194 | [convolutional]
195 | filters=1000
196 | size=1
197 | stride=1
198 | pad=1
199 | activation=linear
200 |
201 | [avgpool]
202 |
203 | [softmax]
204 | groups=1
205 |
206 | [cost]
207 | type=sse
208 |
209 |
--------------------------------------------------------------------------------
/darknet_ros_old/darknet/cfg/darknet19_448.cfg:
--------------------------------------------------------------------------------
1 | [net]
2 | batch=128
3 | subdivisions=4
4 | height=448
5 | width=448
6 | max_crop=512
7 | channels=3
8 | momentum=0.9
9 | decay=0.0005
10 |
11 | learning_rate=0.001
12 | policy=poly
13 | power=4
14 | max_batches=100000
15 |
16 | angle=7
17 | hue = .1
18 | saturation=.75
19 | exposure=.75
20 | aspect=.75
21 |
22 | [convolutional]
23 | batch_normalize=1
24 | filters=32
25 | size=3
26 | stride=1
27 | pad=1
28 | activation=leaky
29 |
30 | [maxpool]
31 | size=2
32 | stride=2
33 |
34 | [convolutional]
35 | batch_normalize=1
36 | filters=64
37 | size=3
38 | stride=1
39 | pad=1
40 | activation=leaky
41 |
42 | [maxpool]
43 | size=2
44 | stride=2
45 |
46 | [convolutional]
47 | batch_normalize=1
48 | filters=128
49 | size=3
50 | stride=1
51 | pad=1
52 | activation=leaky
53 |
54 | [convolutional]
55 | batch_normalize=1
56 | filters=64
57 | size=1
58 | stride=1
59 | pad=1
60 | activation=leaky
61 |
62 | [convolutional]
63 | batch_normalize=1
64 | filters=128
65 | size=3
66 | stride=1
67 | pad=1
68 | activation=leaky
69 |
70 | [maxpool]
71 | size=2
72 | stride=2
73 |
74 | [convolutional]
75 | batch_normalize=1
76 | filters=256
77 | size=3
78 | stride=1
79 | pad=1
80 | activation=leaky
81 |
82 | [convolutional]
83 | batch_normalize=1
84 | filters=128
85 | size=1
86 | stride=1
87 | pad=1
88 | activation=leaky
89 |
90 | [convolutional]
91 | batch_normalize=1
92 | filters=256
93 | size=3
94 | stride=1
95 | pad=1
96 | activation=leaky
97 |
98 | [maxpool]
99 | size=2
100 | stride=2
101 |
102 | [convolutional]
103 | batch_normalize=1
104 | filters=512
105 | size=3
106 | stride=1
107 | pad=1
108 | activation=leaky
109 |
110 | [convolutional]
111 | batch_normalize=1
112 | filters=256
113 | size=1
114 | stride=1
115 | pad=1
116 | activation=leaky
117 |
118 | [convolutional]
119 | batch_normalize=1
120 | filters=512
121 | size=3
122 | stride=1
123 | pad=1
124 | activation=leaky
125 |
126 | [convolutional]
127 | batch_normalize=1
128 | filters=256
129 | size=1
130 | stride=1
131 | pad=1
132 | activation=leaky
133 |
134 | [convolutional]
135 | batch_normalize=1
136 | filters=512
137 | size=3
138 | stride=1
139 | pad=1
140 | activation=leaky
141 |
142 | [maxpool]
143 | size=2
144 | stride=2
145 |
146 | [convolutional]
147 | batch_normalize=1
148 | filters=1024
149 | size=3
150 | stride=1
151 | pad=1
152 | activation=leaky
153 |
154 | [convolutional]
155 | batch_normalize=1
156 | filters=512
157 | size=1
158 | stride=1
159 | pad=1
160 | activation=leaky
161 |
162 | [convolutional]
163 | batch_normalize=1
164 | filters=1024
165 | size=3
166 | stride=1
167 | pad=1
168 | activation=leaky
169 |
170 | [convolutional]
171 | batch_normalize=1
172 | filters=512
173 | size=1
174 | stride=1
175 | pad=1
176 | activation=leaky
177 |
178 | [convolutional]
179 | batch_normalize=1
180 | filters=1024
181 | size=3
182 | stride=1
183 | pad=1
184 | activation=leaky
185 |
186 | [convolutional]
187 | filters=1000
188 | size=1
189 | stride=1
190 | pad=1
191 | activation=linear
192 |
193 | [avgpool]
194 |
195 | [softmax]
196 | groups=1
197 |
198 | [cost]
199 | type=sse
200 |
201 |
--------------------------------------------------------------------------------
/darknet_ros_old/darknet/cfg/darknet9000.cfg:
--------------------------------------------------------------------------------
1 | [net]
2 | # Training
3 | # batch=128
4 | # subdivisions=4
5 | # Testing
6 | batch = 1
7 | subdivisions = 1
8 | height=448
9 | width=448
10 | max_crop=512
11 | channels=3
12 | momentum=0.9
13 | decay=0.0005
14 |
15 | learning_rate=0.001
16 | policy=poly
17 | power=4
18 | max_batches=100000
19 |
20 | angle=7
21 | hue=.1
22 | saturation=.75
23 | exposure=.75
24 | aspect=.75
25 |
26 | [convolutional]
27 | batch_normalize=1
28 | filters=32
29 | size=3
30 | stride=1
31 | pad=1
32 | activation=leaky
33 |
34 | [maxpool]
35 | size=2
36 | stride=2
37 |
38 | [convolutional]
39 | batch_normalize=1
40 | filters=64
41 | size=3
42 | stride=1
43 | pad=1
44 | activation=leaky
45 |
46 | [maxpool]
47 | size=2
48 | stride=2
49 |
50 | [convolutional]
51 | batch_normalize=1
52 | filters=128
53 | size=3
54 | stride=1
55 | pad=1
56 | activation=leaky
57 |
58 | [convolutional]
59 | batch_normalize=1
60 | filters=64
61 | size=1
62 | stride=1
63 | pad=1
64 | activation=leaky
65 |
66 | [convolutional]
67 | batch_normalize=1
68 | filters=128
69 | size=3
70 | stride=1
71 | pad=1
72 | activation=leaky
73 |
74 | [maxpool]
75 | size=2
76 | stride=2
77 |
78 | [convolutional]
79 | batch_normalize=1
80 | filters=256
81 | size=3
82 | stride=1
83 | pad=1
84 | activation=leaky
85 |
86 | [convolutional]
87 | batch_normalize=1
88 | filters=128
89 | size=1
90 | stride=1
91 | pad=1
92 | activation=leaky
93 |
94 | [convolutional]
95 | batch_normalize=1
96 | filters=256
97 | size=3
98 | stride=1
99 | pad=1
100 | activation=leaky
101 |
102 | [maxpool]
103 | size=2
104 | stride=2
105 |
106 | [convolutional]
107 | batch_normalize=1
108 | filters=512
109 | size=3
110 | stride=1
111 | pad=1
112 | activation=leaky
113 |
114 | [convolutional]
115 | batch_normalize=1
116 | filters=256
117 | size=1
118 | stride=1
119 | pad=1
120 | activation=leaky
121 |
122 | [convolutional]
123 | batch_normalize=1
124 | filters=512
125 | size=3
126 | stride=1
127 | pad=1
128 | activation=leaky
129 |
130 | [convolutional]
131 | batch_normalize=1
132 | filters=256
133 | size=1
134 | stride=1
135 | pad=1
136 | activation=leaky
137 |
138 | [convolutional]
139 | batch_normalize=1
140 | filters=512
141 | size=3
142 | stride=1
143 | pad=1
144 | activation=leaky
145 |
146 | [maxpool]
147 | size=2
148 | stride=2
149 |
150 | [convolutional]
151 | batch_normalize=1
152 | filters=1024
153 | size=3
154 | stride=1
155 | pad=1
156 | activation=leaky
157 |
158 | [convolutional]
159 | batch_normalize=1
160 | filters=512
161 | size=1
162 | stride=1
163 | pad=1
164 | activation=leaky
165 |
166 | [convolutional]
167 | batch_normalize=1
168 | filters=1024
169 | size=3
170 | stride=1
171 | pad=1
172 | activation=leaky
173 |
174 | [convolutional]
175 | batch_normalize=1
176 | filters=512
177 | size=1
178 | stride=1
179 | pad=1
180 | activation=leaky
181 |
182 | [convolutional]
183 | batch_normalize=1
184 | filters=1024
185 | size=3
186 | stride=1
187 | pad=1
188 | activation=leaky
189 |
190 | [convolutional]
191 | filters=9418
192 | size=1
193 | stride=1
194 | pad=1
195 | activation=linear
196 |
197 | [avgpool]
198 |
199 | [softmax]
200 | groups=1
201 | tree=data/9k.tree
202 |
203 | [cost]
204 | type=masked
205 |
206 |
--------------------------------------------------------------------------------
/darknet_ros_old/darknet/cfg/extraction.cfg:
--------------------------------------------------------------------------------
1 | [net]
2 | batch=128
3 | subdivisions=1
4 | height=224
5 | width=224
6 | max_crop=320
7 | channels=3
8 | momentum=0.9
9 | decay=0.0005
10 |
11 | learning_rate=0.1
12 | policy=poly
13 | power=4
14 | max_batches=1600000
15 |
16 | [convolutional]
17 | batch_normalize=1
18 | filters=64
19 | size=7
20 | stride=2
21 | pad=1
22 | activation=leaky
23 |
24 | [maxpool]
25 | size=2
26 | stride=2
27 |
28 | [convolutional]
29 | batch_normalize=1
30 | filters=192
31 | size=3
32 | stride=1
33 | pad=1
34 | activation=leaky
35 |
36 | [maxpool]
37 | size=2
38 | stride=2
39 |
40 | [convolutional]
41 | batch_normalize=1
42 | filters=128
43 | size=1
44 | stride=1
45 | pad=1
46 | activation=leaky
47 |
48 | [convolutional]
49 | batch_normalize=1
50 | filters=256
51 | size=3
52 | stride=1
53 | pad=1
54 | activation=leaky
55 |
56 | [convolutional]
57 | batch_normalize=1
58 | filters=256
59 | size=1
60 | stride=1
61 | pad=1
62 | activation=leaky
63 |
64 | [convolutional]
65 | batch_normalize=1
66 | filters=512
67 | size=3
68 | stride=1
69 | pad=1
70 | activation=leaky
71 |
72 | [maxpool]
73 | size=2
74 | stride=2
75 |
76 | [convolutional]
77 | batch_normalize=1
78 | filters=256
79 | size=1
80 | stride=1
81 | pad=1
82 | activation=leaky
83 |
84 | [convolutional]
85 | batch_normalize=1
86 | filters=512
87 | size=3
88 | stride=1
89 | pad=1
90 | activation=leaky
91 |
92 | [convolutional]
93 | batch_normalize=1
94 | filters=256
95 | size=1
96 | stride=1
97 | pad=1
98 | activation=leaky
99 |
100 | [convolutional]
101 | batch_normalize=1
102 | filters=512
103 | size=3
104 | stride=1
105 | pad=1
106 | activation=leaky
107 |
108 | [convolutional]
109 | batch_normalize=1
110 | filters=256
111 | size=1
112 | stride=1
113 | pad=1
114 | activation=leaky
115 |
116 | [convolutional]
117 | batch_normalize=1
118 | filters=512
119 | size=3
120 | stride=1
121 | pad=1
122 | activation=leaky
123 |
124 | [convolutional]
125 | batch_normalize=1
126 | filters=256
127 | size=1
128 | stride=1
129 | pad=1
130 | activation=leaky
131 |
132 | [convolutional]
133 | batch_normalize=1
134 | filters=512
135 | size=3
136 | stride=1
137 | pad=1
138 | activation=leaky
139 |
140 | [convolutional]
141 | batch_normalize=1
142 | filters=512
143 | size=1
144 | stride=1
145 | pad=1
146 | activation=leaky
147 |
148 | [convolutional]
149 | batch_normalize=1
150 | filters=1024
151 | size=3
152 | stride=1
153 | pad=1
154 | activation=leaky
155 |
156 | [maxpool]
157 | size=2
158 | stride=2
159 |
160 | [convolutional]
161 | batch_normalize=1
162 | filters=512
163 | size=1
164 | stride=1
165 | pad=1
166 | activation=leaky
167 |
168 | [convolutional]
169 | batch_normalize=1
170 | filters=1024
171 | size=3
172 | stride=1
173 | pad=1
174 | activation=leaky
175 |
176 | [convolutional]
177 | batch_normalize=1
178 | filters=512
179 | size=1
180 | stride=1
181 | pad=1
182 | activation=leaky
183 |
184 | [convolutional]
185 | batch_normalize=1
186 | filters=1024
187 | size=3
188 | stride=1
189 | pad=1
190 | activation=leaky
191 |
192 | [convolutional]
193 | filters=1000
194 | size=1
195 | stride=1
196 | pad=1
197 | activation=leaky
198 |
199 | [avgpool]
200 |
201 | [softmax]
202 | groups=1
203 |
204 | [cost]
205 | type=sse
206 |
207 |
--------------------------------------------------------------------------------
/darknet_ros_old/darknet/cfg/extraction.conv.cfg:
--------------------------------------------------------------------------------
1 | [net]
2 | batch=1
3 | subdivisions=1
4 | height=256
5 | width=256
6 | channels=3
7 | momentum=0.9
8 | decay=0.0005
9 |
10 | learning_rate=0.5
11 | policy=poly
12 | power=6
13 | max_batches=500000
14 |
15 | [convolutional]
16 | filters=64
17 | size=7
18 | stride=2
19 | pad=1
20 | activation=leaky
21 |
22 | [maxpool]
23 | size=2
24 | stride=2
25 |
26 | [convolutional]
27 | filters=192
28 | size=3
29 | stride=1
30 | pad=1
31 | activation=leaky
32 |
33 | [maxpool]
34 | size=2
35 | stride=2
36 |
37 | [convolutional]
38 | filters=128
39 | size=1
40 | stride=1
41 | pad=1
42 | activation=leaky
43 |
44 | [convolutional]
45 | filters=256
46 | size=3
47 | stride=1
48 | pad=1
49 | activation=leaky
50 |
51 | [convolutional]
52 | filters=256
53 | size=1
54 | stride=1
55 | pad=1
56 | activation=leaky
57 |
58 | [convolutional]
59 | filters=512
60 | size=3
61 | stride=1
62 | pad=1
63 | activation=leaky
64 |
65 | [maxpool]
66 | size=2
67 | stride=2
68 |
69 | [convolutional]
70 | filters=256
71 | size=1
72 | stride=1
73 | pad=1
74 | activation=leaky
75 |
76 | [convolutional]
77 | filters=512
78 | size=3
79 | stride=1
80 | pad=1
81 | activation=leaky
82 |
83 | [convolutional]
84 | filters=256
85 | size=1
86 | stride=1
87 | pad=1
88 | activation=leaky
89 |
90 | [convolutional]
91 | filters=512
92 | size=3
93 | stride=1
94 | pad=1
95 | activation=leaky
96 |
97 | [convolutional]
98 | filters=256
99 | size=1
100 | stride=1
101 | pad=1
102 | activation=leaky
103 |
104 | [convolutional]
105 | filters=512
106 | size=3
107 | stride=1
108 | pad=1
109 | activation=leaky
110 |
111 | [convolutional]
112 | filters=256
113 | size=1
114 | stride=1
115 | pad=1
116 | activation=leaky
117 |
118 | [convolutional]
119 | filters=512
120 | size=3
121 | stride=1
122 | pad=1
123 | activation=leaky
124 |
125 | [convolutional]
126 | filters=512
127 | size=1
128 | stride=1
129 | pad=1
130 | activation=leaky
131 |
132 | [convolutional]
133 | filters=1024
134 | size=3
135 | stride=1
136 | pad=1
137 | activation=leaky
138 |
139 | [maxpool]
140 | size=2
141 | stride=2
142 |
143 | [convolutional]
144 | filters=512
145 | size=1
146 | stride=1
147 | pad=1
148 | activation=leaky
149 |
150 | [convolutional]
151 | filters=1024
152 | size=3
153 | stride=1
154 | pad=1
155 | activation=leaky
156 |
157 | [convolutional]
158 | filters=512
159 | size=1
160 | stride=1
161 | pad=1
162 | activation=leaky
163 |
164 | [convolutional]
165 | filters=1024
166 | size=3
167 | stride=1
168 | pad=1
169 | activation=leaky
170 |
171 | [avgpool]
172 |
173 | [connected]
174 | output=1000
175 | activation=leaky
176 |
177 | [softmax]
178 | groups=1
179 |
180 |
--------------------------------------------------------------------------------
/darknet_ros_old/darknet/cfg/extraction22k.cfg:
--------------------------------------------------------------------------------
1 | [net]
2 | batch=128
3 | subdivisions=1
4 | height=224
5 | width=224
6 | max_crop=320
7 | channels=3
8 | momentum=0.9
9 | decay=0.0005
10 |
11 | learning_rate=0.01
12 | max_batches = 0
13 | policy=steps
14 | steps=444000,590000,970000
15 | scales=.5,.2,.1
16 |
17 | #policy=sigmoid
18 | #gamma=.00008
19 | #step=100000
20 | #max_batches=200000
21 |
22 | [convolutional]
23 | batch_normalize=1
24 | filters=64
25 | size=7
26 | stride=2
27 | pad=1
28 | activation=leaky
29 |
30 | [maxpool]
31 | size=2
32 | stride=2
33 |
34 | [convolutional]
35 | batch_normalize=1
36 | filters=192
37 | size=3
38 | stride=1
39 | pad=1
40 | activation=leaky
41 |
42 | [maxpool]
43 | size=2
44 | stride=2
45 |
46 | [convolutional]
47 | batch_normalize=1
48 | filters=128
49 | size=1
50 | stride=1
51 | pad=1
52 | activation=leaky
53 |
54 | [convolutional]
55 | batch_normalize=1
56 | filters=256
57 | size=3
58 | stride=1
59 | pad=1
60 | activation=leaky
61 |
62 | [convolutional]
63 | batch_normalize=1
64 | filters=256
65 | size=1
66 | stride=1
67 | pad=1
68 | activation=leaky
69 |
70 | [convolutional]
71 | batch_normalize=1
72 | filters=512
73 | size=3
74 | stride=1
75 | pad=1
76 | activation=leaky
77 |
78 | [maxpool]
79 | size=2
80 | stride=2
81 |
82 | [convolutional]
83 | batch_normalize=1
84 | filters=256
85 | size=1
86 | stride=1
87 | pad=1
88 | activation=leaky
89 |
90 | [convolutional]
91 | batch_normalize=1
92 | filters=512
93 | size=3
94 | stride=1
95 | pad=1
96 | activation=leaky
97 |
98 | [convolutional]
99 | batch_normalize=1
100 | filters=256
101 | size=1
102 | stride=1
103 | pad=1
104 | activation=leaky
105 |
106 | [convolutional]
107 | batch_normalize=1
108 | filters=512
109 | size=3
110 | stride=1
111 | pad=1
112 | activation=leaky
113 |
114 | [convolutional]
115 | batch_normalize=1
116 | filters=256
117 | size=1
118 | stride=1
119 | pad=1
120 | activation=leaky
121 |
122 | [convolutional]
123 | batch_normalize=1
124 | filters=512
125 | size=3
126 | stride=1
127 | pad=1
128 | activation=leaky
129 |
130 | [convolutional]
131 | batch_normalize=1
132 | filters=256
133 | size=1
134 | stride=1
135 | pad=1
136 | activation=leaky
137 |
138 | [convolutional]
139 | batch_normalize=1
140 | filters=512
141 | size=3
142 | stride=1
143 | pad=1
144 | activation=leaky
145 |
146 | [convolutional]
147 | batch_normalize=1
148 | filters=512
149 | size=1
150 | stride=1
151 | pad=1
152 | activation=leaky
153 |
154 | [convolutional]
155 | batch_normalize=1
156 | filters=1024
157 | size=3
158 | stride=1
159 | pad=1
160 | activation=leaky
161 |
162 | [maxpool]
163 | size=2
164 | stride=2
165 |
166 | [convolutional]
167 | batch_normalize=1
168 | filters=1024
169 | size=1
170 | stride=1
171 | pad=1
172 | activation=leaky
173 |
174 | [convolutional]
175 | batch_normalize=1
176 | filters=2048
177 | size=3
178 | stride=1
179 | pad=1
180 | activation=leaky
181 |
182 | [convolutional]
183 | batch_normalize=1
184 | filters=1024
185 | size=1
186 | stride=1
187 | pad=1
188 | activation=leaky
189 |
190 | [convolutional]
191 | batch_normalize=1
192 | filters=2048
193 | size=3
194 | stride=1
195 | pad=1
196 | activation=leaky
197 |
198 | [avgpool]
199 |
200 | [connected]
201 | output=21842
202 | activation=leaky
203 |
204 | [softmax]
205 | groups=1
206 |
207 | [cost]
208 | type=sse
209 |
210 |
--------------------------------------------------------------------------------
/darknet_ros_old/darknet/cfg/go.cfg:
--------------------------------------------------------------------------------
1 | [net]
2 | batch=512
3 | subdivisions=1
4 | height=19
5 | width=19
6 | channels=1
7 | momentum=0.9
8 | decay=0.0005
9 |
10 | burn_in=1000
11 | learning_rate=0.1
12 | policy=poly
13 | power=4
14 | max_batches=10000000
15 |
16 | [convolutional]
17 | filters=256
18 | size=3
19 | stride=1
20 | pad=1
21 | activation=relu
22 | batch_normalize=1
23 |
24 | [convolutional]
25 | filters=256
26 | size=3
27 | stride=1
28 | pad=1
29 | activation=relu
30 | batch_normalize=1
31 |
32 | [convolutional]
33 | filters=256
34 | size=3
35 | stride=1
36 | pad=1
37 | activation=relu
38 | batch_normalize=1
39 |
40 | [convolutional]
41 | filters=256
42 | size=3
43 | stride=1
44 | pad=1
45 | activation=relu
46 | batch_normalize=1
47 |
48 | [convolutional]
49 | filters=256
50 | size=3
51 | stride=1
52 | pad=1
53 | activation=relu
54 | batch_normalize=1
55 |
56 | [convolutional]
57 | filters=256
58 | size=3
59 | stride=1
60 | pad=1
61 | activation=relu
62 | batch_normalize=1
63 |
64 | [convolutional]
65 | filters=256
66 | size=3
67 | stride=1
68 | pad=1
69 | activation=relu
70 | batch_normalize=1
71 |
72 | [convolutional]
73 | filters=256
74 | size=3
75 | stride=1
76 | pad=1
77 | activation=relu
78 | batch_normalize=1
79 |
80 | [convolutional]
81 | filters=256
82 | size=3
83 | stride=1
84 | pad=1
85 | activation=relu
86 | batch_normalize=1
87 |
88 | [convolutional]
89 | filters=256
90 | size=3
91 | stride=1
92 | pad=1
93 | activation=relu
94 | batch_normalize=1
95 |
96 | [convolutional]
97 | filters=256
98 | size=3
99 | stride=1
100 | pad=1
101 | activation=relu
102 | batch_normalize=1
103 |
104 | [convolutional]
105 | filters=256
106 | size=3
107 | stride=1
108 | pad=1
109 | activation=relu
110 | batch_normalize=1
111 |
112 | [convolutional]
113 | filters=256
114 | size=3
115 | stride=1
116 | pad=1
117 | activation=relu
118 | batch_normalize=1
119 |
120 | [convolutional]
121 | filters=1
122 | size=1
123 | stride=1
124 | pad=1
125 | activation=linear
126 |
127 | [reorg]
128 | extra=1
129 | stride=1
130 |
131 | [softmax]
132 |
133 | [cost]
134 | type=sse
135 |
136 |
--------------------------------------------------------------------------------
/darknet_ros_old/darknet/cfg/go.test.cfg:
--------------------------------------------------------------------------------
1 | [net]
2 | batch=1
3 | subdivisions=1
4 | height=19
5 | width=19
6 | channels=1
7 | momentum=0.9
8 | decay=0.0005
9 |
10 | learning_rate=0.01
11 | policy=poly
12 | power=4
13 | max_batches=100000
14 |
15 | [convolutional]
16 | filters=256
17 | size=3
18 | stride=1
19 | pad=1
20 | activation=relu
21 | batch_normalize=1
22 |
23 | [convolutional]
24 | filters=256
25 | size=3
26 | stride=1
27 | pad=1
28 | activation=relu
29 | batch_normalize=1
30 |
31 | [convolutional]
32 | filters=256
33 | size=3
34 | stride=1
35 | pad=1
36 | activation=relu
37 | batch_normalize=1
38 |
39 | [convolutional]
40 | filters=256
41 | size=3
42 | stride=1
43 | pad=1
44 | activation=relu
45 | batch_normalize=1
46 |
47 | [convolutional]
48 | filters=256
49 | size=3
50 | stride=1
51 | pad=1
52 | activation=relu
53 | batch_normalize=1
54 |
55 | [convolutional]
56 | filters=256
57 | size=3
58 | stride=1
59 | pad=1
60 | activation=relu
61 | batch_normalize=1
62 |
63 | [convolutional]
64 | filters=256
65 | size=3
66 | stride=1
67 | pad=1
68 | activation=relu
69 | batch_normalize=1
70 |
71 | [convolutional]
72 | filters=256
73 | size=3
74 | stride=1
75 | pad=1
76 | activation=relu
77 | batch_normalize=1
78 |
79 | [convolutional]
80 | filters=256
81 | size=3
82 | stride=1
83 | pad=1
84 | activation=relu
85 | batch_normalize=1
86 |
87 | [convolutional]
88 | filters=256
89 | size=3
90 | stride=1
91 | pad=1
92 | activation=relu
93 | batch_normalize=1
94 |
95 | [convolutional]
96 | filters=256
97 | size=3
98 | stride=1
99 | pad=1
100 | activation=relu
101 | batch_normalize=1
102 |
103 | [convolutional]
104 | filters=256
105 | size=3
106 | stride=1
107 | pad=1
108 | activation=relu
109 | batch_normalize=1
110 |
111 | [convolutional]
112 | filters=256
113 | size=3
114 | stride=1
115 | pad=1
116 | activation=relu
117 | batch_normalize=1
118 |
119 | [convolutional]
120 | filters=1
121 | size=1
122 | stride=1
123 | pad=1
124 | activation=linear
125 |
126 | [reorg]
127 | extra=1
128 | stride=1
129 |
130 | [softmax]
131 |
132 | [cost]
133 | type=sse
134 |
135 |
--------------------------------------------------------------------------------
/darknet_ros_old/darknet/cfg/gru.cfg:
--------------------------------------------------------------------------------
1 | [net]
2 | subdivisions=1
3 | batch = 256
4 | inputs=256
5 | momentum=0.9
6 | decay=0.0
7 | time_steps=128
8 | learning_rate=.002
9 | adam=1
10 |
11 | policy=constant
12 | power=4
13 | max_batches=1000000
14 |
15 | [gru]
16 | output = 1024
17 |
18 | [gru]
19 | output = 1024
20 |
21 | [gru]
22 | output = 1024
23 |
24 | [connected]
25 | output=256
26 | activation=linear
27 |
28 | [softmax]
29 |
30 | [cost]
31 | type=sse
32 |
33 |
--------------------------------------------------------------------------------
/darknet_ros_old/darknet/cfg/imagenet1k.data:
--------------------------------------------------------------------------------
1 | classes=1000
2 | train = /data/imagenet/imagenet1k.train.list
3 | valid = /data/imagenet/imagenet1k.valid.list
4 | backup = /home/pjreddie/backup/
5 | labels = data/imagenet.labels.list
6 | names = data/imagenet.shortnames.list
7 | top=5
8 |
9 |
--------------------------------------------------------------------------------
/darknet_ros_old/darknet/cfg/imagenet22k.dataset:
--------------------------------------------------------------------------------
1 | classes=21842
2 | train = /data/imagenet/imagenet22k.train.list
3 | valid = /data/imagenet/imagenet22k.valid.list
4 | #valid = /data/imagenet/imagenet1k.valid.list
5 | backup = /home/pjreddie/backup/
6 | labels = data/imagenet.labels.list
7 | names = data/imagenet.shortnames.list
8 | top = 5
9 |
10 |
--------------------------------------------------------------------------------
/darknet_ros_old/darknet/cfg/imagenet9k.hierarchy.dataset:
--------------------------------------------------------------------------------
1 | classes=9418
2 | train = data/9k.train.list
3 | valid = /data/imagenet/imagenet1k.valid.list
4 | leaves = data/imagenet1k.labels
5 | backup = /home/pjreddie/backup/
6 | labels = data/9k.labels
7 | names = data/9k.names
8 | top=5
9 |
10 |
--------------------------------------------------------------------------------
/darknet_ros_old/darknet/cfg/jnet-conv.cfg:
--------------------------------------------------------------------------------
1 | [net]
2 | batch=1
3 | subdivisions=1
4 | height=10
5 | width=10
6 | channels=3
7 | learning_rate=0.01
8 | momentum=0.9
9 | decay=0.0005
10 |
11 | [convolutional]
12 | filters=32
13 | size=3
14 | stride=1
15 | pad=1
16 | activation=leaky
17 |
18 | [convolutional]
19 | filters=32
20 | size=3
21 | stride=1
22 | pad=1
23 | activation=leaky
24 |
25 | [maxpool]
26 | stride=2
27 | size=2
28 |
29 | [convolutional]
30 | filters=64
31 | size=3
32 | stride=1
33 | pad=1
34 | activation=leaky
35 |
36 | [convolutional]
37 | filters=64
38 | size=3
39 | stride=1
40 | pad=1
41 | activation=leaky
42 |
43 | [maxpool]
44 | stride=2
45 | size=2
46 |
47 | [convolutional]
48 | filters=128
49 | size=3
50 | stride=1
51 | pad=1
52 | activation=leaky
53 |
54 | [convolutional]
55 | filters=128
56 | size=3
57 | stride=1
58 | pad=1
59 | activation=leaky
60 |
61 | [maxpool]
62 | stride=2
63 | size=2
64 |
65 | [convolutional]
66 | filters=256
67 | size=3
68 | stride=1
69 | pad=1
70 | activation=leaky
71 |
72 | [convolutional]
73 | filters=256
74 | size=3
75 | stride=1
76 | pad=1
77 | activation=leaky
78 |
79 | [maxpool]
80 | stride=2
81 | size=2
82 |
83 | [convolutional]
84 | filters=512
85 | size=3
86 | stride=1
87 | pad=1
88 | activation=leaky
89 |
90 | [convolutional]
91 | filters=512
92 | size=3
93 | stride=1
94 | pad=1
95 | activation=leaky
96 |
97 | [maxpool]
98 | stride=2
99 | size=2
100 |
101 | [convolutional]
102 | filters=1024
103 | size=3
104 | stride=1
105 | pad=1
106 | activation=leaky
107 |
108 | [convolutional]
109 | filters=1024
110 | size=3
111 | stride=1
112 | pad=1
113 | activation=leaky
114 |
115 | [maxpool]
116 | size=2
117 | stride=2
118 |
119 |
--------------------------------------------------------------------------------
/darknet_ros_old/darknet/cfg/rnn.cfg:
--------------------------------------------------------------------------------
1 | [net]
2 | subdivisions=1
3 | inputs=256
4 | batch = 1
5 | momentum=0.9
6 | decay=0.001
7 | max_batches = 2000
8 | time_steps=1
9 | learning_rate=0.1
10 | policy=steps
11 | steps=1000,1500
12 | scales=.1,.1
13 |
14 | [rnn]
15 | batch_normalize=1
16 | output = 1024
17 | hidden=1024
18 | activation=leaky
19 |
20 | [rnn]
21 | batch_normalize=1
22 | output = 1024
23 | hidden=1024
24 | activation=leaky
25 |
26 | [rnn]
27 | batch_normalize=1
28 | output = 1024
29 | hidden=1024
30 | activation=leaky
31 |
32 | [connected]
33 | output=256
34 | activation=leaky
35 |
36 | [softmax]
37 |
38 | [cost]
39 | type=sse
40 |
41 |
--------------------------------------------------------------------------------
/darknet_ros_old/darknet/cfg/rnn.train.cfg:
--------------------------------------------------------------------------------
1 | [net]
2 | subdivisions=1
3 | inputs=256
4 | batch = 128
5 | momentum=0.9
6 | decay=0.001
7 | max_batches = 2000
8 | time_steps=576
9 | learning_rate=0.1
10 | policy=steps
11 | steps=1000,1500
12 | scales=.1,.1
13 |
14 | [rnn]
15 | batch_normalize=1
16 | output = 1024
17 | hidden=1024
18 | activation=leaky
19 |
20 | [rnn]
21 | batch_normalize=1
22 | output = 1024
23 | hidden=1024
24 | activation=leaky
25 |
26 | [rnn]
27 | batch_normalize=1
28 | output = 1024
29 | hidden=1024
30 | activation=leaky
31 |
32 | [connected]
33 | output=256
34 | activation=leaky
35 |
36 | [softmax]
37 |
38 | [cost]
39 | type=sse
40 |
41 |
--------------------------------------------------------------------------------
/darknet_ros_old/darknet/cfg/strided.cfg:
--------------------------------------------------------------------------------
1 | [net]
2 | batch=128
3 | subdivisions=4
4 | height=256
5 | width=256
6 | channels=3
7 | momentum=0.9
8 | decay=0.0005
9 |
10 | learning_rate=0.01
11 | policy=steps
12 | scales=.1,.1,.1
13 | steps=200000,300000,400000
14 | max_batches=800000
15 |
16 |
17 | [crop]
18 | crop_height=224
19 | crop_width=224
20 | flip=1
21 | angle=0
22 | saturation=1
23 | exposure=1
24 | shift=.2
25 |
26 | [convolutional]
27 | filters=64
28 | size=7
29 | stride=2
30 | pad=1
31 | activation=ramp
32 |
33 | [convolutional]
34 | filters=192
35 | size=3
36 | stride=2
37 | pad=1
38 | activation=ramp
39 |
40 | [convolutional]
41 | filters=128
42 | size=1
43 | stride=1
44 | pad=1
45 | activation=ramp
46 |
47 | [convolutional]
48 | filters=256
49 | size=3
50 | stride=2
51 | pad=1
52 | activation=ramp
53 |
54 | [convolutional]
55 | filters=128
56 | size=1
57 | stride=1
58 | pad=1
59 | activation=ramp
60 |
61 | [convolutional]
62 | filters=256
63 | size=3
64 | stride=1
65 | pad=1
66 | activation=ramp
67 |
68 | [convolutional]
69 | filters=128
70 | size=1
71 | stride=1
72 | pad=1
73 | activation=ramp
74 |
75 | [convolutional]
76 | filters=512
77 | size=3
78 | stride=2
79 | pad=1
80 | activation=ramp
81 |
82 | [convolutional]
83 | filters=256
84 | size=1
85 | stride=1
86 | pad=1
87 | activation=ramp
88 |
89 | [convolutional]
90 | filters=512
91 | size=3
92 | stride=1
93 | pad=1
94 | activation=ramp
95 |
96 | [convolutional]
97 | filters=256
98 | size=1
99 | stride=1
100 | pad=1
101 | activation=ramp
102 |
103 | [convolutional]
104 | filters=512
105 | size=3
106 | stride=1
107 | pad=1
108 | activation=ramp
109 |
110 | [convolutional]
111 | filters=256
112 | size=1
113 | stride=1
114 | pad=1
115 | activation=ramp
116 |
117 | [convolutional]
118 | filters=512
119 | size=3
120 | stride=1
121 | pad=1
122 | activation=ramp
123 |
124 | [convolutional]
125 | filters=256
126 | size=1
127 | stride=1
128 | pad=1
129 | activation=ramp
130 |
131 | [convolutional]
132 | filters=512
133 | size=3
134 | stride=1
135 | pad=1
136 | activation=ramp
137 |
138 | [convolutional]
139 | filters=256
140 | size=1
141 | stride=1
142 | pad=1
143 | activation=ramp
144 |
145 | [convolutional]
146 | filters=1024
147 | size=3
148 | stride=2
149 | pad=1
150 | activation=ramp
151 |
152 | [convolutional]
153 | filters=512
154 | size=1
155 | stride=1
156 | pad=1
157 | activation=ramp
158 |
159 | [convolutional]
160 | filters=1024
161 | size=3
162 | stride=1
163 | pad=1
164 | activation=ramp
165 |
166 | [maxpool]
167 | size=3
168 | stride=2
169 |
170 | [connected]
171 | output=4096
172 | activation=ramp
173 |
174 | [dropout]
175 | probability=0.5
176 |
177 | [connected]
178 | output=1000
179 | activation=ramp
180 |
181 | [softmax]
182 |
183 | [cost]
184 | type=sse
185 |
186 |
--------------------------------------------------------------------------------
/darknet_ros_old/darknet/cfg/t1.test.cfg:
--------------------------------------------------------------------------------
1 | [net]
2 | batch=1
3 | subdivisions=1
4 | height=224
5 | width=224
6 | channels=3
7 | momentum=0.9
8 | decay=0.0005
9 |
10 | learning_rate=0.0005
11 | policy=steps
12 | steps=200,400,600,20000,30000
13 | scales=2.5,2,2,.1,.1
14 | max_batches = 40000
15 |
16 | [convolutional]
17 | filters=16
18 | size=3
19 | stride=1
20 | pad=1
21 | activation=leaky
22 |
23 | [maxpool]
24 | size=2
25 | stride=2
26 |
27 | [convolutional]
28 | filters=32
29 | size=3
30 | stride=1
31 | pad=1
32 | activation=leaky
33 |
34 | [maxpool]
35 | size=2
36 | stride=2
37 |
38 | [convolutional]
39 | filters=64
40 | size=3
41 | stride=1
42 | pad=1
43 | activation=leaky
44 |
45 | [maxpool]
46 | size=2
47 | stride=2
48 |
49 | [convolutional]
50 | filters=128
51 | size=3
52 | stride=1
53 | pad=1
54 | activation=leaky
55 |
56 | [maxpool]
57 | size=2
58 | stride=2
59 |
60 | [convolutional]
61 | filters=256
62 | size=3
63 | stride=1
64 | pad=1
65 | activation=leaky
66 |
67 | [maxpool]
68 | size=2
69 | stride=2
70 |
71 | [convolutional]
72 | filters=512
73 | size=3
74 | stride=1
75 | pad=1
76 | activation=leaky
77 |
78 | [convolutional]
79 | filters=1024
80 | size=3
81 | stride=1
82 | pad=1
83 | activation=leaky
84 |
85 | [convolutional]
86 | filters=1024
87 | size=3
88 | stride=1
89 | pad=1
90 | activation=leaky
91 |
92 | [convolutional]
93 | filters=256
94 | size=3
95 | stride=1
96 | pad=1
97 | activation=leaky
98 |
99 | [connected]
100 | output= 1470
101 | activation=linear
102 |
103 | [detection]
104 | classes=20
105 | coords=4
106 | rescore=1
107 | side=7
108 | num=2
109 | softmax=0
110 | sqrt=1
111 | jitter=.2
112 |
113 | object_scale=1
114 | noobject_scale=.5
115 | class_scale=1
116 | coord_scale=5
117 |
118 |
--------------------------------------------------------------------------------
/darknet_ros_old/darknet/cfg/tiny.cfg:
--------------------------------------------------------------------------------
1 | [net]
2 | # Train
3 | batch=128
4 | subdivisions=1
5 | # Test
6 | # batch=1
7 | # subdivisions=1
8 | height=224
9 | width=224
10 | channels=3
11 | momentum=0.9
12 | decay=0.0005
13 | max_crop=320
14 |
15 | learning_rate=0.1
16 | policy=poly
17 | power=4
18 | max_batches=1600000
19 |
20 | angle=7
21 | hue=.1
22 | saturation=.75
23 | exposure=.75
24 | aspect=.75
25 |
26 | [convolutional]
27 | batch_normalize=1
28 | filters=16
29 | size=3
30 | stride=1
31 | pad=1
32 | activation=leaky
33 |
34 | [maxpool]
35 | size=2
36 | stride=2
37 |
38 | [convolutional]
39 | batch_normalize=1
40 | filters=32
41 | size=3
42 | stride=1
43 | pad=1
44 | activation=leaky
45 |
46 | [maxpool]
47 | size=2
48 | stride=2
49 |
50 | [convolutional]
51 | batch_normalize=1
52 | filters=16
53 | size=1
54 | stride=1
55 | pad=1
56 | activation=leaky
57 |
58 | [convolutional]
59 | batch_normalize=1
60 | filters=128
61 | size=3
62 | stride=1
63 | pad=1
64 | activation=leaky
65 |
66 | [convolutional]
67 | batch_normalize=1
68 | filters=16
69 | size=1
70 | stride=1
71 | pad=1
72 | activation=leaky
73 |
74 | [convolutional]
75 | batch_normalize=1
76 | filters=128
77 | size=3
78 | stride=1
79 | pad=1
80 | activation=leaky
81 |
82 | [maxpool]
83 | size=2
84 | stride=2
85 |
86 | [convolutional]
87 | batch_normalize=1
88 | filters=32
89 | size=1
90 | stride=1
91 | pad=1
92 | activation=leaky
93 |
94 | [convolutional]
95 | batch_normalize=1
96 | filters=256
97 | size=3
98 | stride=1
99 | pad=1
100 | activation=leaky
101 |
102 | [convolutional]
103 | batch_normalize=1
104 | filters=32
105 | size=1
106 | stride=1
107 | pad=1
108 | activation=leaky
109 |
110 | [convolutional]
111 | batch_normalize=1
112 | filters=256
113 | size=3
114 | stride=1
115 | pad=1
116 | activation=leaky
117 |
118 | [maxpool]
119 | size=2
120 | stride=2
121 |
122 | [convolutional]
123 | batch_normalize=1
124 | filters=64
125 | size=1
126 | stride=1
127 | pad=1
128 | activation=leaky
129 |
130 | [convolutional]
131 | batch_normalize=1
132 | filters=512
133 | size=3
134 | stride=1
135 | pad=1
136 | activation=leaky
137 |
138 | [convolutional]
139 | batch_normalize=1
140 | filters=64
141 | size=1
142 | stride=1
143 | pad=1
144 | activation=leaky
145 |
146 | [convolutional]
147 | batch_normalize=1
148 | filters=512
149 | size=3
150 | stride=1
151 | pad=1
152 | activation=leaky
153 |
154 | [convolutional]
155 | batch_normalize=1
156 | filters=128
157 | size=1
158 | stride=1
159 | pad=1
160 | activation=leaky
161 |
162 | [convolutional]
163 | filters=1000
164 | size=1
165 | stride=1
166 | pad=1
167 | activation=linear
168 |
169 | [avgpool]
170 |
171 | [softmax]
172 | groups=1
173 |
174 | [cost]
175 | type=sse
176 |
177 |
--------------------------------------------------------------------------------
/darknet_ros_old/darknet/cfg/vgg-16.cfg:
--------------------------------------------------------------------------------
1 | [net]
2 | batch=128
3 | subdivisions=4
4 | height=256
5 | width=256
6 | channels=3
7 | learning_rate=0.00001
8 | momentum=0.9
9 | decay=0.0005
10 |
11 | [crop]
12 | crop_height=224
13 | crop_width=224
14 | flip=1
15 | exposure=1
16 | saturation=1
17 | angle=0
18 |
19 | [convolutional]
20 | filters=64
21 | size=3
22 | stride=1
23 | pad=1
24 | activation=relu
25 |
26 | [convolutional]
27 | filters=64
28 | size=3
29 | stride=1
30 | pad=1
31 | activation=relu
32 |
33 | [maxpool]
34 | size=2
35 | stride=2
36 |
37 | [convolutional]
38 | filters=128
39 | size=3
40 | stride=1
41 | pad=1
42 | activation=relu
43 |
44 | [convolutional]
45 | filters=128
46 | size=3
47 | stride=1
48 | pad=1
49 | activation=relu
50 |
51 | [maxpool]
52 | size=2
53 | stride=2
54 |
55 | [convolutional]
56 | filters=256
57 | size=3
58 | stride=1
59 | pad=1
60 | activation=relu
61 |
62 | [convolutional]
63 | filters=256
64 | size=3
65 | stride=1
66 | pad=1
67 | activation=relu
68 |
69 | [convolutional]
70 | filters=256
71 | size=3
72 | stride=1
73 | pad=1
74 | activation=relu
75 |
76 | [maxpool]
77 | size=2
78 | stride=2
79 |
80 | [convolutional]
81 | filters=512
82 | size=3
83 | stride=1
84 | pad=1
85 | activation=relu
86 |
87 | [convolutional]
88 | filters=512
89 | size=3
90 | stride=1
91 | pad=1
92 | activation=relu
93 |
94 | [convolutional]
95 | filters=512
96 | size=3
97 | stride=1
98 | pad=1
99 | activation=relu
100 |
101 | [maxpool]
102 | size=2
103 | stride=2
104 |
105 | [convolutional]
106 | filters=512
107 | size=3
108 | stride=1
109 | pad=1
110 | activation=relu
111 |
112 | [convolutional]
113 | filters=512
114 | size=3
115 | stride=1
116 | pad=1
117 | activation=relu
118 |
119 | [convolutional]
120 | filters=512
121 | size=3
122 | stride=1
123 | pad=1
124 | activation=relu
125 |
126 | [maxpool]
127 | size=2
128 | stride=2
129 |
130 | [connected]
131 | output=4096
132 | activation=relu
133 |
134 | [dropout]
135 | probability=.5
136 |
137 | [connected]
138 | output=4096
139 | activation=relu
140 |
141 | [dropout]
142 | probability=.5
143 |
144 | [connected]
145 | output=1000
146 | activation=linear
147 |
148 | [softmax]
149 | groups=1
150 |
151 | [cost]
152 | type=sse
153 |
154 |
--------------------------------------------------------------------------------
/darknet_ros_old/darknet/cfg/vgg-conv.cfg:
--------------------------------------------------------------------------------
1 | [net]
2 | batch=1
3 | subdivisions=1
4 | width=224
5 | height=224
6 | channels=3
7 | learning_rate=0.00001
8 | momentum=0.9
9 | decay=0.0005
10 |
11 | [convolutional]
12 | filters=64
13 | size=3
14 | stride=1
15 | pad=1
16 | activation=relu
17 |
18 | [convolutional]
19 | filters=64
20 | size=3
21 | stride=1
22 | pad=1
23 | activation=relu
24 |
25 | [maxpool]
26 | size=2
27 | stride=2
28 |
29 | [convolutional]
30 | filters=128
31 | size=3
32 | stride=1
33 | pad=1
34 | activation=relu
35 |
36 | [convolutional]
37 | filters=128
38 | size=3
39 | stride=1
40 | pad=1
41 | activation=relu
42 |
43 | [maxpool]
44 | size=2
45 | stride=2
46 |
47 | [convolutional]
48 | filters=256
49 | size=3
50 | stride=1
51 | pad=1
52 | activation=relu
53 |
54 | [convolutional]
55 | filters=256
56 | size=3
57 | stride=1
58 | pad=1
59 | activation=relu
60 |
61 | [convolutional]
62 | filters=256
63 | size=3
64 | stride=1
65 | pad=1
66 | activation=relu
67 |
68 | [maxpool]
69 | size=2
70 | stride=2
71 |
72 | [convolutional]
73 | filters=512
74 | size=3
75 | stride=1
76 | pad=1
77 | activation=relu
78 |
79 | [convolutional]
80 | filters=512
81 | size=3
82 | stride=1
83 | pad=1
84 | activation=relu
85 |
86 | [convolutional]
87 | filters=512
88 | size=3
89 | stride=1
90 | pad=1
91 | activation=relu
92 |
93 | [maxpool]
94 | size=2
95 | stride=2
96 |
97 | [convolutional]
98 | filters=512
99 | size=3
100 | stride=1
101 | pad=1
102 | activation=relu
103 |
104 | [convolutional]
105 | filters=512
106 | size=3
107 | stride=1
108 | pad=1
109 | activation=relu
110 |
111 | [convolutional]
112 | filters=512
113 | size=3
114 | stride=1
115 | pad=1
116 | activation=relu
117 |
118 | [maxpool]
119 | size=2
120 | stride=2
121 |
122 |
--------------------------------------------------------------------------------
/darknet_ros_old/darknet/cfg/voc.data:
--------------------------------------------------------------------------------
1 | classes= 20
2 | train = /home/pjreddie/data/voc/train.txt
3 | valid = /home/pjreddie/data/voc/2007_test.txt
4 | names = data/voc.names
5 | backup = backup
6 |
7 |
--------------------------------------------------------------------------------
/darknet_ros_old/darknet/cfg/writing.cfg:
--------------------------------------------------------------------------------
1 | [net]
2 | batch=128
3 | subdivisions=2
4 | height=256
5 | width=256
6 | channels=3
7 | learning_rate=0.00000001
8 | momentum=0.9
9 | decay=0.0005
10 | seen=0
11 |
12 | [convolutional]
13 | filters=32
14 | size=3
15 | stride=1
16 | pad=1
17 | activation=leaky
18 |
19 | [convolutional]
20 | filters=32
21 | size=3
22 | stride=1
23 | pad=1
24 | activation=leaky
25 |
26 | [convolutional]
27 | filters=32
28 | size=3
29 | stride=1
30 | pad=1
31 | activation=leaky
32 |
33 | [convolutional]
34 | filters=1
35 | size=3
36 | stride=1
37 | pad=1
38 | activation=logistic
39 |
40 | [cost]
41 |
42 |
--------------------------------------------------------------------------------
/darknet_ros_old/darknet/cfg/yolo9000.cfg:
--------------------------------------------------------------------------------
1 | [net]
2 | # Testing
3 | batch=1
4 | subdivisions=1
5 | # Training
6 | # batch=64
7 | # subdivisions=8
8 | batch=1
9 | subdivisions=1
10 | height=544
11 | width=544
12 | channels=3
13 | momentum=0.9
14 | decay=0.0005
15 |
16 | learning_rate=0.001
17 | burn_in=1000
18 | max_batches = 500200
19 | policy=steps
20 | steps=400000,450000
21 | scales=.1,.1
22 |
23 | hue=.1
24 | saturation=.75
25 | exposure=.75
26 |
27 | [convolutional]
28 | batch_normalize=1
29 | filters=32
30 | size=3
31 | stride=1
32 | pad=1
33 | activation=leaky
34 |
35 | [maxpool]
36 | size=2
37 | stride=2
38 |
39 | [convolutional]
40 | batch_normalize=1
41 | filters=64
42 | size=3
43 | stride=1
44 | pad=1
45 | activation=leaky
46 |
47 | [maxpool]
48 | size=2
49 | stride=2
50 |
51 | [convolutional]
52 | batch_normalize=1
53 | filters=128
54 | size=3
55 | stride=1
56 | pad=1
57 | activation=leaky
58 |
59 | [convolutional]
60 | batch_normalize=1
61 | filters=64
62 | size=1
63 | stride=1
64 | pad=1
65 | activation=leaky
66 |
67 | [convolutional]
68 | batch_normalize=1
69 | filters=128
70 | size=3
71 | stride=1
72 | pad=1
73 | activation=leaky
74 |
75 | [maxpool]
76 | size=2
77 | stride=2
78 |
79 | [convolutional]
80 | batch_normalize=1
81 | filters=256
82 | size=3
83 | stride=1
84 | pad=1
85 | activation=leaky
86 |
87 | [convolutional]
88 | batch_normalize=1
89 | filters=128
90 | size=1
91 | stride=1
92 | pad=1
93 | activation=leaky
94 |
95 | [convolutional]
96 | batch_normalize=1
97 | filters=256
98 | size=3
99 | stride=1
100 | pad=1
101 | activation=leaky
102 |
103 | [maxpool]
104 | size=2
105 | stride=2
106 |
107 | [convolutional]
108 | batch_normalize=1
109 | filters=512
110 | size=3
111 | stride=1
112 | pad=1
113 | activation=leaky
114 |
115 | [convolutional]
116 | batch_normalize=1
117 | filters=256
118 | size=1
119 | stride=1
120 | pad=1
121 | activation=leaky
122 |
123 | [convolutional]
124 | batch_normalize=1
125 | filters=512
126 | size=3
127 | stride=1
128 | pad=1
129 | activation=leaky
130 |
131 | [convolutional]
132 | batch_normalize=1
133 | filters=256
134 | size=1
135 | stride=1
136 | pad=1
137 | activation=leaky
138 |
139 | [convolutional]
140 | batch_normalize=1
141 | filters=512
142 | size=3
143 | stride=1
144 | pad=1
145 | activation=leaky
146 |
147 | [maxpool]
148 | size=2
149 | stride=2
150 |
151 | [convolutional]
152 | batch_normalize=1
153 | filters=1024
154 | size=3
155 | stride=1
156 | pad=1
157 | activation=leaky
158 |
159 | [convolutional]
160 | batch_normalize=1
161 | filters=512
162 | size=1
163 | stride=1
164 | pad=1
165 | activation=leaky
166 |
167 | [convolutional]
168 | batch_normalize=1
169 | filters=1024
170 | size=3
171 | stride=1
172 | pad=1
173 | activation=leaky
174 |
175 | [convolutional]
176 | batch_normalize=1
177 | filters=512
178 | size=1
179 | stride=1
180 | pad=1
181 | activation=leaky
182 |
183 | [convolutional]
184 | batch_normalize=1
185 | filters=1024
186 | size=3
187 | stride=1
188 | pad=1
189 | activation=leaky
190 |
191 | [convolutional]
192 | filters=28269
193 | size=1
194 | stride=1
195 | pad=1
196 | activation=linear
197 |
198 | [region]
199 | anchors = 0.77871, 1.14074, 3.00525, 4.31277, 9.22725, 9.61974
200 | bias_match=1
201 | classes=9418
202 | coords=4
203 | num=3
204 | softmax=1
205 | jitter=.2
206 | rescore=1
207 |
208 | object_scale=5
209 | noobject_scale=1
210 | class_scale=1
211 | coord_scale=1
212 |
213 | thresh = .6
214 | absolute=1
215 | random=1
216 |
217 | tree=data/9k.tree
218 | map = data/coco9k.map
219 |
--------------------------------------------------------------------------------
/darknet_ros_old/darknet/cfg/yolov1-tiny.cfg:
--------------------------------------------------------------------------------
1 | [net]
2 | # Testing
3 | batch=1
4 | subdivisions=1
5 | # Training
6 | # batch=64
7 | # subdivisions=8
8 | height=448
9 | width=448
10 | channels=3
11 | momentum=0.9
12 | decay=0.0005
13 |
14 | saturation=.75
15 | exposure=.75
16 | hue = .1
17 |
18 | learning_rate=0.0005
19 | policy=steps
20 | steps=200,400,600,800,20000,30000
21 | scales=2.5,2,2,2,.1,.1
22 | max_batches = 40000
23 |
24 | [convolutional]
25 | batch_normalize=1
26 | filters=16
27 | size=3
28 | stride=1
29 | pad=1
30 | activation=leaky
31 |
32 | [maxpool]
33 | size=2
34 | stride=2
35 |
36 | [convolutional]
37 | batch_normalize=1
38 | filters=32
39 | size=3
40 | stride=1
41 | pad=1
42 | activation=leaky
43 |
44 | [maxpool]
45 | size=2
46 | stride=2
47 |
48 | [convolutional]
49 | batch_normalize=1
50 | filters=64
51 | size=3
52 | stride=1
53 | pad=1
54 | activation=leaky
55 |
56 | [maxpool]
57 | size=2
58 | stride=2
59 |
60 | [convolutional]
61 | batch_normalize=1
62 | filters=128
63 | size=3
64 | stride=1
65 | pad=1
66 | activation=leaky
67 |
68 | [maxpool]
69 | size=2
70 | stride=2
71 |
72 | [convolutional]
73 | batch_normalize=1
74 | filters=256
75 | size=3
76 | stride=1
77 | pad=1
78 | activation=leaky
79 |
80 | [maxpool]
81 | size=2
82 | stride=2
83 |
84 | [convolutional]
85 | batch_normalize=1
86 | filters=512
87 | size=3
88 | stride=1
89 | pad=1
90 | activation=leaky
91 |
92 | [maxpool]
93 | size=2
94 | stride=2
95 |
96 | [convolutional]
97 | batch_normalize=1
98 | size=3
99 | stride=1
100 | pad=1
101 | filters=1024
102 | activation=leaky
103 |
104 | [convolutional]
105 | batch_normalize=1
106 | size=3
107 | stride=1
108 | pad=1
109 | filters=256
110 | activation=leaky
111 |
112 | [connected]
113 | output= 1470
114 | activation=linear
115 |
116 | [detection]
117 | classes=20
118 | coords=4
119 | rescore=1
120 | side=7
121 | num=2
122 | softmax=0
123 | sqrt=1
124 | jitter=.2
125 |
126 | object_scale=1
127 | noobject_scale=.5
128 | class_scale=1
129 | coord_scale=5
130 |
131 |
--------------------------------------------------------------------------------
/darknet_ros_old/darknet/cfg/yolov2-tiny-voc.cfg:
--------------------------------------------------------------------------------
1 | [net]
2 | # Testing
3 | batch=1
4 | subdivisions=1
5 | # Training
6 | # batch=64
7 | # subdivisions=2
8 | width=416
9 | height=416
10 | channels=3
11 | momentum=0.9
12 | decay=0.0005
13 | angle=0
14 | saturation = 1.5
15 | exposure = 1.5
16 | hue=.1
17 |
18 | learning_rate=0.001
19 | max_batches = 40200
20 | policy=steps
21 | steps=-1,100,20000,30000
22 | scales=.1,10,.1,.1
23 |
24 | [convolutional]
25 | batch_normalize=1
26 | filters=16
27 | size=3
28 | stride=1
29 | pad=1
30 | activation=leaky
31 |
32 | [maxpool]
33 | size=2
34 | stride=2
35 |
36 | [convolutional]
37 | batch_normalize=1
38 | filters=32
39 | size=3
40 | stride=1
41 | pad=1
42 | activation=leaky
43 |
44 | [maxpool]
45 | size=2
46 | stride=2
47 |
48 | [convolutional]
49 | batch_normalize=1
50 | filters=64
51 | size=3
52 | stride=1
53 | pad=1
54 | activation=leaky
55 |
56 | [maxpool]
57 | size=2
58 | stride=2
59 |
60 | [convolutional]
61 | batch_normalize=1
62 | filters=128
63 | size=3
64 | stride=1
65 | pad=1
66 | activation=leaky
67 |
68 | [maxpool]
69 | size=2
70 | stride=2
71 |
72 | [convolutional]
73 | batch_normalize=1
74 | filters=256
75 | size=3
76 | stride=1
77 | pad=1
78 | activation=leaky
79 |
80 | [maxpool]
81 | size=2
82 | stride=2
83 |
84 | [convolutional]
85 | batch_normalize=1
86 | filters=512
87 | size=3
88 | stride=1
89 | pad=1
90 | activation=leaky
91 |
92 | [maxpool]
93 | size=2
94 | stride=1
95 |
96 | [convolutional]
97 | batch_normalize=1
98 | filters=1024
99 | size=3
100 | stride=1
101 | pad=1
102 | activation=leaky
103 |
104 | ###########
105 |
106 | [convolutional]
107 | batch_normalize=1
108 | size=3
109 | stride=1
110 | pad=1
111 | filters=1024
112 | activation=leaky
113 |
114 | [convolutional]
115 | size=1
116 | stride=1
117 | pad=1
118 | filters=125
119 | activation=linear
120 |
121 | [region]
122 | anchors = 1.08,1.19, 3.42,4.41, 6.63,11.38, 9.42,5.11, 16.62,10.52
123 | bias_match=1
124 | classes=20
125 | coords=4
126 | num=5
127 | softmax=1
128 | jitter=.2
129 | rescore=1
130 |
131 | object_scale=5
132 | noobject_scale=1
133 | class_scale=1
134 | coord_scale=1
135 |
136 | absolute=1
137 | thresh = .6
138 | random=1
139 |
--------------------------------------------------------------------------------
/darknet_ros_old/darknet/cfg/yolov2-tiny.cfg:
--------------------------------------------------------------------------------
1 | [net]
2 | # Testing
3 | batch=1
4 | subdivisions=1
5 | # Training
6 | # batch=64
7 | # subdivisions=2
8 | width=416
9 | height=416
10 | channels=3
11 | momentum=0.9
12 | decay=0.0005
13 | angle=0
14 | saturation = 1.5
15 | exposure = 1.5
16 | hue=.1
17 |
18 | learning_rate=0.001
19 | burn_in=1000
20 | max_batches = 500200
21 | policy=steps
22 | steps=400000,450000
23 | scales=.1,.1
24 |
25 | [convolutional]
26 | batch_normalize=1
27 | filters=16
28 | size=3
29 | stride=1
30 | pad=1
31 | activation=leaky
32 |
33 | [maxpool]
34 | size=2
35 | stride=2
36 |
37 | [convolutional]
38 | batch_normalize=1
39 | filters=32
40 | size=3
41 | stride=1
42 | pad=1
43 | activation=leaky
44 |
45 | [maxpool]
46 | size=2
47 | stride=2
48 |
49 | [convolutional]
50 | batch_normalize=1
51 | filters=64
52 | size=3
53 | stride=1
54 | pad=1
55 | activation=leaky
56 |
57 | [maxpool]
58 | size=2
59 | stride=2
60 |
61 | [convolutional]
62 | batch_normalize=1
63 | filters=128
64 | size=3
65 | stride=1
66 | pad=1
67 | activation=leaky
68 |
69 | [maxpool]
70 | size=2
71 | stride=2
72 |
73 | [convolutional]
74 | batch_normalize=1
75 | filters=256
76 | size=3
77 | stride=1
78 | pad=1
79 | activation=leaky
80 |
81 | [maxpool]
82 | size=2
83 | stride=2
84 |
85 | [convolutional]
86 | batch_normalize=1
87 | filters=512
88 | size=3
89 | stride=1
90 | pad=1
91 | activation=leaky
92 |
93 | [maxpool]
94 | size=2
95 | stride=1
96 |
97 | [convolutional]
98 | batch_normalize=1
99 | filters=1024
100 | size=3
101 | stride=1
102 | pad=1
103 | activation=leaky
104 |
105 | ###########
106 |
107 | [convolutional]
108 | batch_normalize=1
109 | size=3
110 | stride=1
111 | pad=1
112 | filters=512
113 | activation=leaky
114 |
115 | [convolutional]
116 | size=1
117 | stride=1
118 | pad=1
119 | filters=425
120 | activation=linear
121 |
122 | [region]
123 | anchors = 0.57273, 0.677385, 1.87446, 2.06253, 3.33843, 5.47434, 7.88282, 3.52778, 9.77052, 9.16828
124 | bias_match=1
125 | classes=80
126 | coords=4
127 | num=5
128 | softmax=1
129 | jitter=.2
130 | rescore=0
131 |
132 | object_scale=5
133 | noobject_scale=1
134 | class_scale=1
135 | coord_scale=1
136 |
137 | absolute=1
138 | thresh = .6
139 | random=1
140 |
--------------------------------------------------------------------------------
/darknet_ros_old/darknet/examples/art.c:
--------------------------------------------------------------------------------
1 | #include "darknet.h"
2 |
3 | #include
4 |
5 | void demo_art(char *cfgfile, char *weightfile, int cam_index)
6 | {
7 | #ifdef OPENCV
8 | network *net = load_network(cfgfile, weightfile, 0);
9 | set_batch_network(net, 1);
10 |
11 | srand(2222222);
12 | CvCapture * cap;
13 |
14 | cap = cvCaptureFromCAM(cam_index);
15 |
16 | char *window = "ArtJudgementBot9000!!!";
17 | if(!cap) error("Couldn't connect to webcam.\n");
18 | cvNamedWindow(window, CV_WINDOW_NORMAL);
19 | cvResizeWindow(window, 512, 512);
20 | int i;
21 | int idx[] = {37, 401, 434};
22 | int n = sizeof(idx)/sizeof(idx[0]);
23 |
24 | while(1){
25 | image in = get_image_from_stream(cap);
26 | image in_s = resize_image(in, net->w, net->h);
27 | show_image(in, window);
28 |
29 | float *p = network_predict(net, in_s.data);
30 |
31 | printf("\033[2J");
32 | printf("\033[1;1H");
33 |
34 | float score = 0;
35 | for(i = 0; i < n; ++i){
36 | float s = p[idx[i]];
37 | if (s > score) score = s;
38 | }
39 | score = score;
40 | printf("I APPRECIATE THIS ARTWORK: %10.7f%%\n", score*100);
41 | printf("[");
42 | int upper = 30;
43 | for(i = 0; i < upper; ++i){
44 | printf("%c", ((i+.5) < score*upper) ? 219 : ' ');
45 | }
46 | printf("]\n");
47 |
48 | free_image(in_s);
49 | free_image(in);
50 |
51 | cvWaitKey(1);
52 | }
53 | #endif
54 | }
55 |
56 |
57 | void run_art(int argc, char **argv)
58 | {
59 | int cam_index = find_int_arg(argc, argv, "-c", 0);
60 | char *cfg = argv[2];
61 | char *weights = argv[3];
62 | demo_art(cfg, weights, cam_index);
63 | }
64 |
65 |
--------------------------------------------------------------------------------
/darknet_ros_old/darknet/examples/detector-scipy-opencv.py:
--------------------------------------------------------------------------------
1 | # Stupid python path shit.
2 | # Instead just add darknet.py to somewhere in your python path
3 | # OK actually that might not be a great idea, idk, work in progress
4 | # Use at your own risk. or don't, i don't care
5 |
6 | from scipy.misc import imread
7 | import cv2
8 |
9 | def array_to_image(arr):
10 | arr = arr.transpose(2,0,1)
11 | c = arr.shape[0]
12 | h = arr.shape[1]
13 | w = arr.shape[2]
14 | arr = (arr/255.0).flatten()
15 | data = dn.c_array(dn.c_float, arr)
16 | im = dn.IMAGE(w,h,c,data)
17 | return im
18 |
19 | def detect2(net, meta, image, thresh=.5, hier_thresh=.5, nms=.45):
20 | boxes = dn.make_boxes(net)
21 | probs = dn.make_probs(net)
22 | num = dn.num_boxes(net)
23 | dn.network_detect(net, image, thresh, hier_thresh, nms, boxes, probs)
24 | res = []
25 | for j in range(num):
26 | for i in range(meta.classes):
27 | if probs[j][i] > 0:
28 | res.append((meta.names[i], probs[j][i], (boxes[j].x, boxes[j].y, boxes[j].w, boxes[j].h)))
29 | res = sorted(res, key=lambda x: -x[1])
30 | dn.free_ptrs(dn.cast(probs, dn.POINTER(dn.c_void_p)), num)
31 | return res
32 |
33 | import sys, os
34 | sys.path.append(os.path.join(os.getcwd(),'python/'))
35 |
36 | import darknet as dn
37 |
38 | # Darknet
39 | net = dn.load_net("cfg/tiny-yolo.cfg", "tiny-yolo.weights", 0)
40 | meta = dn.load_meta("cfg/coco.data")
41 | r = dn.detect(net, meta, "data/dog.jpg")
42 | print r
43 |
44 | # scipy
45 | arr= imread('data/dog.jpg')
46 | im = array_to_image(arr)
47 | r = detect2(net, meta, im)
48 | print r
49 |
50 | # OpenCV
51 | arr = cv2.imread('data/dog.jpg')
52 | im = array_to_image(arr)
53 | dn.rgbgr_image(im)
54 | r = detect2(net, meta, im)
55 | print r
56 |
57 |
--------------------------------------------------------------------------------
/darknet_ros_old/darknet/examples/detector.py:
--------------------------------------------------------------------------------
1 | # Stupid python path shit.
2 | # Instead just add darknet.py to somewhere in your python path
3 | # OK actually that might not be a great idea, idk, work in progress
4 | # Use at your own risk. or don't, i don't care
5 |
6 | import sys, os
7 | sys.path.append(os.path.join(os.getcwd(),'python/'))
8 |
9 | import darknet as dn
10 | import pdb
11 |
12 | dn.set_gpu(0)
13 | net = dn.load_net("cfg/yolo-thor.cfg", "/home/pjreddie/backup/yolo-thor_final.weights", 0)
14 | meta = dn.load_meta("cfg/thor.data")
15 | r = dn.detect(net, meta, "data/bedroom.jpg")
16 | print r
17 |
18 | # And then down here you could detect a lot more images like:
19 | r = dn.detect(net, meta, "data/eagle.jpg")
20 | print r
21 | r = dn.detect(net, meta, "data/giraffe.jpg")
22 | print r
23 | r = dn.detect(net, meta, "data/horses.jpg")
24 | print r
25 | r = dn.detect(net, meta, "data/person.jpg")
26 | print r
27 |
28 |
--------------------------------------------------------------------------------
/darknet_ros_old/darknet/examples/swag.c:
--------------------------------------------------------------------------------
1 | #include "darknet.h"
2 | #include
3 |
4 | void train_swag(char *cfgfile, char *weightfile)
5 | {
6 | char *train_images = "data/voc.0712.trainval";
7 | char *backup_directory = "/home/pjreddie/backup/";
8 | srand(time(0));
9 | char *base = basecfg(cfgfile);
10 | printf("%s\n", base);
11 | float avg_loss = -1;
12 | network net = parse_network_cfg(cfgfile);
13 | if(weightfile){
14 | load_weights(&net, weightfile);
15 | }
16 | printf("Learning Rate: %g, Momentum: %g, Decay: %g\n", net.learning_rate, net.momentum, net.decay);
17 | int imgs = net.batch*net.subdivisions;
18 | int i = *net.seen/imgs;
19 | data train, buffer;
20 |
21 | layer l = net.layers[net.n - 1];
22 |
23 | int side = l.side;
24 | int classes = l.classes;
25 | float jitter = l.jitter;
26 |
27 | list *plist = get_paths(train_images);
28 | //int N = plist->size;
29 | char **paths = (char **)list_to_array(plist);
30 |
31 | load_args args = {0};
32 | args.w = net.w;
33 | args.h = net.h;
34 | args.paths = paths;
35 | args.n = imgs;
36 | args.m = plist->size;
37 | args.classes = classes;
38 | args.jitter = jitter;
39 | args.num_boxes = side;
40 | args.d = &buffer;
41 | args.type = REGION_DATA;
42 |
43 | pthread_t load_thread = load_data_in_thread(args);
44 | clock_t time;
45 | //while(i*imgs < N*120){
46 | while(get_current_batch(net) < net.max_batches){
47 | i += 1;
48 | time=clock();
49 | pthread_join(load_thread, 0);
50 | train = buffer;
51 | load_thread = load_data_in_thread(args);
52 |
53 | printf("Loaded: %lf seconds\n", sec(clock()-time));
54 |
55 | time=clock();
56 | float loss = train_network(net, train);
57 | if (avg_loss < 0) avg_loss = loss;
58 | avg_loss = avg_loss*.9 + loss*.1;
59 |
60 | printf("%d: %f, %f avg, %f rate, %lf seconds, %d images\n", i, loss, avg_loss, get_current_rate(net), sec(clock()-time), i*imgs);
61 | if(i%1000==0 || i == 600){
62 | char buff[256];
63 | sprintf(buff, "%s/%s_%d.weights", backup_directory, base, i);
64 | save_weights(net, buff);
65 | }
66 | free_data(train);
67 | }
68 | char buff[256];
69 | sprintf(buff, "%s/%s_final.weights", backup_directory, base);
70 | save_weights(net, buff);
71 | }
72 |
73 | void run_swag(int argc, char **argv)
74 | {
75 | if(argc < 4){
76 | fprintf(stderr, "usage: %s %s [train/test/valid] [cfg] [weights (optional)]\n", argv[0], argv[1]);
77 | return;
78 | }
79 |
80 | char *cfg = argv[3];
81 | char *weights = (argc > 4) ? argv[4] : 0;
82 | if(0==strcmp(argv[2], "train")) train_swag(cfg, weights);
83 | }
84 |
--------------------------------------------------------------------------------
/darknet_ros_old/darknet/python/proverbot.py:
--------------------------------------------------------------------------------
1 | from darknet import *
2 |
3 | def predict_tactic(net, s):
4 | prob = 0
5 | d = c_array(c_float, [0.0]*256)
6 | tac = ''
7 | if not len(s):
8 | s = '\n'
9 | for c in s[:-1]:
10 | d[ord(c)] = 1
11 | pred = predict(net, d)
12 | d[ord(c)] = 0
13 | c = s[-1]
14 | while 1:
15 | d[ord(c)] = 1
16 | pred = predict(net, d)
17 | d[ord(c)] = 0
18 | pred = [pred[i] for i in range(256)]
19 | ind = sample(pred)
20 | c = chr(ind)
21 | prob += math.log(pred[ind])
22 | if len(tac) and tac[-1] == '.':
23 | break
24 | tac = tac + c
25 | return (tac, prob)
26 |
27 | def predict_tactics(net, s, n):
28 | tacs = []
29 | for i in range(n):
30 | reset_rnn(net)
31 | tacs.append(predict_tactic(net, s))
32 | tacs = sorted(tacs, key=lambda x: -x[1])
33 | return tacs
34 |
35 | net = load_net("cfg/coq.test.cfg", "/home/pjreddie/backup/coq.backup", 0)
36 | t = predict_tactics(net, "+++++\n", 10)
37 | print t
38 |
--------------------------------------------------------------------------------
/darknet_ros_old/darknet/scripts/dice_label.sh:
--------------------------------------------------------------------------------
1 | mkdir -p images
2 | mkdir -p images/orig
3 | mkdir -p images/train
4 | mkdir -p images/val
5 |
6 | ffmpeg -i Face1.mp4 images/orig/face1_%6d.jpg
7 | ffmpeg -i Face2.mp4 images/orig/face2_%6d.jpg
8 | ffmpeg -i Face3.mp4 images/orig/face3_%6d.jpg
9 | ffmpeg -i Face4.mp4 images/orig/face4_%6d.jpg
10 | ffmpeg -i Face5.mp4 images/orig/face5_%6d.jpg
11 | ffmpeg -i Face6.mp4 images/orig/face6_%6d.jpg
12 |
13 | mogrify -resize 100x100^ -gravity center -crop 100x100+0+0 +repage images/orig/*
14 |
15 | ls images/orig/* | shuf | head -n 1000 | xargs mv -t images/val
16 | mv images/orig/* images/train
17 |
18 | find `pwd`/images/train > dice.train.list -name \*.jpg
19 | find `pwd`/images/val > dice.val.list -name \*.jpg
20 |
21 |
--------------------------------------------------------------------------------
/darknet_ros_old/darknet/scripts/gen_tactic.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | # Usage:
3 | # wget http://pjreddie.com/media/files/peek.weights
4 | # scripts/gen_tactic.sh < data/goal.txt
5 | ./darknet rnn generatetactic cfg/gru.cfg peek.weights 2>/dev/null
6 |
--------------------------------------------------------------------------------
/darknet_ros_old/darknet/scripts/get_coco_dataset.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | # Clone COCO API
4 | git clone https://github.com/pdollar/coco
5 | cd coco
6 |
7 | mkdir images
8 | cd images
9 |
10 | # Download Images
11 | wget -c https://pjreddie.com/media/files/train2014.zip
12 | wget -c https://pjreddie.com/media/files/val2014.zip
13 |
14 | # Unzip
15 | unzip -q train2014.zip
16 | unzip -q val2014.zip
17 |
18 | cd ..
19 |
20 | # Download COCO Metadata
21 | wget -c https://pjreddie.com/media/files/instances_train-val2014.zip
22 | wget -c https://pjreddie.com/media/files/coco/5k.part
23 | wget -c https://pjreddie.com/media/files/coco/trainvalno5k.part
24 | wget -c https://pjreddie.com/media/files/coco/labels.tgz
25 | tar xzf labels.tgz
26 | unzip -q instances_train-val2014.zip
27 |
28 | # Set Up Image Lists
29 | paste <(awk "{print \"$PWD\"}" <5k.part) 5k.part | tr -d '\t' > 5k.txt
30 | paste <(awk "{print \"$PWD\"}" trainvalno5k.txt
31 |
32 |
--------------------------------------------------------------------------------
/darknet_ros_old/darknet/scripts/imagenet_label.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | mkdir -p labelled
4 | wd=`pwd`
5 |
6 | for f in val/*.xml;
7 | do
8 | label=`grep -m1 "" $f | grep -oP '\K[^<]*'`
9 | im=`echo $f | sed 's/val/imgs/; s/xml/JPEG/'`
10 | out=`echo $im | sed 's/JPEG/'${label}'.JPEG/; s/imgs/labelled/'`
11 | ln -s ${wd}/$im ${wd}/$out
12 | done
13 |
14 | find ${wd}/labelled -name \*.JPEG > inet.val.list
15 |
16 |
--------------------------------------------------------------------------------
/darknet_ros_old/darknet/scripts/voc_label.py:
--------------------------------------------------------------------------------
1 | import xml.etree.ElementTree as ET
2 | import pickle
3 | import os
4 | from os import listdir, getcwd
5 | from os.path import join
6 |
7 | sets=[('2012', 'train'), ('2012', 'val'), ('2007', 'train'), ('2007', 'val'), ('2007', 'test')]
8 |
9 | classes = ["aeroplane", "bicycle", "bird", "boat", "bottle", "bus", "car", "cat", "chair", "cow", "diningtable", "dog", "horse", "motorbike", "person", "pottedplant", "sheep", "sofa", "train", "tvmonitor"]
10 |
11 |
12 | def convert(size, box):
13 | dw = 1./(size[0])
14 | dh = 1./(size[1])
15 | x = (box[0] + box[1])/2.0 - 1
16 | y = (box[2] + box[3])/2.0 - 1
17 | w = box[1] - box[0]
18 | h = box[3] - box[2]
19 | x = x*dw
20 | w = w*dw
21 | y = y*dh
22 | h = h*dh
23 | return (x,y,w,h)
24 |
25 | def convert_annotation(year, image_id):
26 | in_file = open('VOCdevkit/VOC%s/Annotations/%s.xml'%(year, image_id))
27 | out_file = open('VOCdevkit/VOC%s/labels/%s.txt'%(year, image_id), 'w')
28 | tree=ET.parse(in_file)
29 | root = tree.getroot()
30 | size = root.find('size')
31 | w = int(size.find('width').text)
32 | h = int(size.find('height').text)
33 |
34 | for obj in root.iter('object'):
35 | difficult = obj.find('difficult').text
36 | cls = obj.find('name').text
37 | if cls not in classes or int(difficult)==1:
38 | continue
39 | cls_id = classes.index(cls)
40 | xmlbox = obj.find('bndbox')
41 | b = (float(xmlbox.find('xmin').text), float(xmlbox.find('xmax').text), float(xmlbox.find('ymin').text), float(xmlbox.find('ymax').text))
42 | bb = convert((w,h), b)
43 | out_file.write(str(cls_id) + " " + " ".join([str(a) for a in bb]) + '\n')
44 |
45 | wd = getcwd()
46 |
47 | for year, image_set in sets:
48 | if not os.path.exists('VOCdevkit/VOC%s/labels/'%(year)):
49 | os.makedirs('VOCdevkit/VOC%s/labels/'%(year))
50 | image_ids = open('VOCdevkit/VOC%s/ImageSets/Main/%s.txt'%(year, image_set)).read().strip().split()
51 | list_file = open('%s_%s.txt'%(year, image_set), 'w')
52 | for image_id in image_ids:
53 | list_file.write('%s/VOCdevkit/VOC%s/JPEGImages/%s.jpg\n'%(wd, year, image_id))
54 | convert_annotation(year, image_id)
55 | list_file.close()
56 |
57 | os.system("cat 2007_train.txt 2007_val.txt 2012_train.txt 2012_val.txt > train.txt")
58 | os.system("cat 2007_train.txt 2007_val.txt 2007_test.txt 2012_train.txt 2012_val.txt > train.all.txt")
59 |
60 |
--------------------------------------------------------------------------------
/darknet_ros_old/darknet/src/activation_layer.c:
--------------------------------------------------------------------------------
1 | #include "activation_layer.h"
2 | #include "utils.h"
3 | #include "cuda.h"
4 | #include "blas.h"
5 | #include "gemm.h"
6 |
7 | #include
8 | #include
9 | #include
10 | #include
11 |
12 | layer make_activation_layer(int batch, int inputs, ACTIVATION activation)
13 | {
14 | layer l = {0};
15 | l.type = ACTIVE;
16 |
17 | l.inputs = inputs;
18 | l.outputs = inputs;
19 | l.batch=batch;
20 |
21 | l.output = calloc(batch*inputs, sizeof(float*));
22 | l.delta = calloc(batch*inputs, sizeof(float*));
23 |
24 | l.forward = forward_activation_layer;
25 | l.backward = backward_activation_layer;
26 | #ifdef GPU
27 | l.forward_gpu = forward_activation_layer_gpu;
28 | l.backward_gpu = backward_activation_layer_gpu;
29 |
30 | l.output_gpu = cuda_make_array(l.output, inputs*batch);
31 | l.delta_gpu = cuda_make_array(l.delta, inputs*batch);
32 | #endif
33 | l.activation = activation;
34 | fprintf(stderr, "Activation Layer: %d inputs\n", inputs);
35 | return l;
36 | }
37 |
38 | void forward_activation_layer(layer l, network net)
39 | {
40 | copy_cpu(l.outputs*l.batch, net.input, 1, l.output, 1);
41 | activate_array(l.output, l.outputs*l.batch, l.activation);
42 | }
43 |
44 | void backward_activation_layer(layer l, network net)
45 | {
46 | gradient_array(l.output, l.outputs*l.batch, l.activation, l.delta);
47 | copy_cpu(l.outputs*l.batch, l.delta, 1, net.delta, 1);
48 | }
49 |
50 | #ifdef GPU
51 |
52 | void forward_activation_layer_gpu(layer l, network net)
53 | {
54 | copy_gpu(l.outputs*l.batch, net.input_gpu, 1, l.output_gpu, 1);
55 | activate_array_gpu(l.output_gpu, l.outputs*l.batch, l.activation);
56 | }
57 |
58 | void backward_activation_layer_gpu(layer l, network net)
59 | {
60 | gradient_array_gpu(l.output_gpu, l.outputs*l.batch, l.activation, l.delta_gpu);
61 | copy_gpu(l.outputs*l.batch, l.delta_gpu, 1, net.delta_gpu, 1);
62 | }
63 | #endif
64 |
--------------------------------------------------------------------------------
/darknet_ros_old/darknet/src/activation_layer.h:
--------------------------------------------------------------------------------
1 | #ifndef ACTIVATION_LAYER_H
2 | #define ACTIVATION_LAYER_H
3 |
4 | #include "activations.h"
5 | #include "layer.h"
6 | #include "network.h"
7 |
8 | layer make_activation_layer(int batch, int inputs, ACTIVATION activation);
9 |
10 | void forward_activation_layer(layer l, network net);
11 | void backward_activation_layer(layer l, network net);
12 |
13 | #ifdef GPU
14 | void forward_activation_layer_gpu(layer l, network net);
15 | void backward_activation_layer_gpu(layer l, network net);
16 | #endif
17 |
18 | #endif
19 |
20 |
--------------------------------------------------------------------------------
/darknet_ros_old/darknet/src/activations.h:
--------------------------------------------------------------------------------
1 | #ifndef ACTIVATIONS_H
2 | #define ACTIVATIONS_H
3 | #include "darknet.h"
4 | #include "cuda.h"
5 | #include "math.h"
6 |
7 | ACTIVATION get_activation(char *s);
8 |
9 | char *get_activation_string(ACTIVATION a);
10 | float activate(float x, ACTIVATION a);
11 | float gradient(float x, ACTIVATION a);
12 | void gradient_array(const float *x, const int n, const ACTIVATION a, float *delta);
13 | void activate_array(float *x, const int n, const ACTIVATION a);
14 | #ifdef GPU
15 | void activate_array_gpu(float *x, int n, ACTIVATION a);
16 | void gradient_array_gpu(float *x, int n, ACTIVATION a, float *delta);
17 | #endif
18 |
19 | static inline float stair_activate(float x)
20 | {
21 | int n = floor(x);
22 | if (n%2 == 0) return floor(x/2.);
23 | else return (x - n) + floor(x/2.);
24 | }
25 | static inline float hardtan_activate(float x)
26 | {
27 | if (x < -1) return -1;
28 | if (x > 1) return 1;
29 | return x;
30 | }
31 | static inline float linear_activate(float x){return x;}
32 | static inline float logistic_activate(float x){return 1./(1. + exp(-x));}
33 | static inline float loggy_activate(float x){return 2./(1. + exp(-x)) - 1;}
34 | static inline float relu_activate(float x){return x*(x>0);}
35 | static inline float elu_activate(float x){return (x >= 0)*x + (x < 0)*(exp(x)-1);}
36 | static inline float relie_activate(float x){return (x>0) ? x : .01*x;}
37 | static inline float ramp_activate(float x){return x*(x>0)+.1*x;}
38 | static inline float leaky_activate(float x){return (x>0) ? x : .1*x;}
39 | static inline float tanh_activate(float x){return (exp(2*x)-1)/(exp(2*x)+1);}
40 | static inline float plse_activate(float x)
41 | {
42 | if(x < -4) return .01 * (x + 4);
43 | if(x > 4) return .01 * (x - 4) + 1;
44 | return .125*x + .5;
45 | }
46 |
47 | static inline float lhtan_activate(float x)
48 | {
49 | if(x < 0) return .001*x;
50 | if(x > 1) return .001*(x-1) + 1;
51 | return x;
52 | }
53 | static inline float lhtan_gradient(float x)
54 | {
55 | if(x > 0 && x < 1) return 1;
56 | return .001;
57 | }
58 |
59 | static inline float hardtan_gradient(float x)
60 | {
61 | if (x > -1 && x < 1) return 1;
62 | return 0;
63 | }
64 | static inline float linear_gradient(float x){return 1;}
65 | static inline float logistic_gradient(float x){return (1-x)*x;}
66 | static inline float loggy_gradient(float x)
67 | {
68 | float y = (x+1.)/2.;
69 | return 2*(1-y)*y;
70 | }
71 | static inline float stair_gradient(float x)
72 | {
73 | if (floor(x) == x) return 0;
74 | return 1;
75 | }
76 | static inline float relu_gradient(float x){return (x>0);}
77 | static inline float elu_gradient(float x){return (x >= 0) + (x < 0)*(x + 1);}
78 | static inline float relie_gradient(float x){return (x>0) ? 1 : .01;}
79 | static inline float ramp_gradient(float x){return (x>0)+.1;}
80 | static inline float leaky_gradient(float x){return (x>0) ? 1 : .1;}
81 | static inline float tanh_gradient(float x){return 1-x*x;}
82 | static inline float plse_gradient(float x){return (x < 0 || x > 1) ? .01 : .125;}
83 |
84 | #endif
85 |
86 |
--------------------------------------------------------------------------------
/darknet_ros_old/darknet/src/avgpool_layer.c:
--------------------------------------------------------------------------------
1 | #include "avgpool_layer.h"
2 | #include "cuda.h"
3 | #include
4 |
5 | avgpool_layer make_avgpool_layer(int batch, int w, int h, int c)
6 | {
7 | fprintf(stderr, "avg %4d x%4d x%4d -> %4d\n", w, h, c, c);
8 | avgpool_layer l = {0};
9 | l.type = AVGPOOL;
10 | l.batch = batch;
11 | l.h = h;
12 | l.w = w;
13 | l.c = c;
14 | l.out_w = 1;
15 | l.out_h = 1;
16 | l.out_c = c;
17 | l.outputs = l.out_c;
18 | l.inputs = h*w*c;
19 | int output_size = l.outputs * batch;
20 | l.output = calloc(output_size, sizeof(float));
21 | l.delta = calloc(output_size, sizeof(float));
22 | l.forward = forward_avgpool_layer;
23 | l.backward = backward_avgpool_layer;
24 | #ifdef GPU
25 | l.forward_gpu = forward_avgpool_layer_gpu;
26 | l.backward_gpu = backward_avgpool_layer_gpu;
27 | l.output_gpu = cuda_make_array(l.output, output_size);
28 | l.delta_gpu = cuda_make_array(l.delta, output_size);
29 | #endif
30 | return l;
31 | }
32 |
33 | void resize_avgpool_layer(avgpool_layer *l, int w, int h)
34 | {
35 | l->w = w;
36 | l->h = h;
37 | l->inputs = h*w*l->c;
38 | }
39 |
40 | void forward_avgpool_layer(const avgpool_layer l, network net)
41 | {
42 | int b,i,k;
43 |
44 | for(b = 0; b < l.batch; ++b){
45 | for(k = 0; k < l.c; ++k){
46 | int out_index = k + b*l.c;
47 | l.output[out_index] = 0;
48 | for(i = 0; i < l.h*l.w; ++i){
49 | int in_index = i + l.h*l.w*(k + b*l.c);
50 | l.output[out_index] += net.input[in_index];
51 | }
52 | l.output[out_index] /= l.h*l.w;
53 | }
54 | }
55 | }
56 |
57 | void backward_avgpool_layer(const avgpool_layer l, network net)
58 | {
59 | int b,i,k;
60 |
61 | for(b = 0; b < l.batch; ++b){
62 | for(k = 0; k < l.c; ++k){
63 | int out_index = k + b*l.c;
64 | for(i = 0; i < l.h*l.w; ++i){
65 | int in_index = i + l.h*l.w*(k + b*l.c);
66 | net.delta[in_index] += l.delta[out_index] / (l.h*l.w);
67 | }
68 | }
69 | }
70 | }
71 |
72 |
--------------------------------------------------------------------------------
/darknet_ros_old/darknet/src/avgpool_layer.h:
--------------------------------------------------------------------------------
1 | #ifndef AVGPOOL_LAYER_H
2 | #define AVGPOOL_LAYER_H
3 |
4 | #include "image.h"
5 | #include "cuda.h"
6 | #include "layer.h"
7 | #include "network.h"
8 |
9 | typedef layer avgpool_layer;
10 |
11 | image get_avgpool_image(avgpool_layer l);
12 | avgpool_layer make_avgpool_layer(int batch, int w, int h, int c);
13 | void resize_avgpool_layer(avgpool_layer *l, int w, int h);
14 | void forward_avgpool_layer(const avgpool_layer l, network net);
15 | void backward_avgpool_layer(const avgpool_layer l, network net);
16 |
17 | #ifdef GPU
18 | void forward_avgpool_layer_gpu(avgpool_layer l, network net);
19 | void backward_avgpool_layer_gpu(avgpool_layer l, network net);
20 | #endif
21 |
22 | #endif
23 |
24 |
--------------------------------------------------------------------------------
/darknet_ros_old/darknet/src/avgpool_layer_kernels.cu:
--------------------------------------------------------------------------------
1 | #include "cuda_runtime.h"
2 | #include "curand.h"
3 | #include "cublas_v2.h"
4 |
5 | extern "C" {
6 | #include "avgpool_layer.h"
7 | #include "cuda.h"
8 | }
9 |
10 | __global__ void forward_avgpool_layer_kernel(int n, int w, int h, int c, float *input, float *output)
11 | {
12 | int id = (blockIdx.x + blockIdx.y*gridDim.x) * blockDim.x + threadIdx.x;
13 | if(id >= n) return;
14 |
15 | int k = id % c;
16 | id /= c;
17 | int b = id;
18 |
19 | int i;
20 | int out_index = (k + c*b);
21 | output[out_index] = 0;
22 | for(i = 0; i < w*h; ++i){
23 | int in_index = i + h*w*(k + b*c);
24 | output[out_index] += input[in_index];
25 | }
26 | output[out_index] /= w*h;
27 | }
28 |
29 | __global__ void backward_avgpool_layer_kernel(int n, int w, int h, int c, float *in_delta, float *out_delta)
30 | {
31 | int id = (blockIdx.x + blockIdx.y*gridDim.x) * blockDim.x + threadIdx.x;
32 | if(id >= n) return;
33 |
34 | int k = id % c;
35 | id /= c;
36 | int b = id;
37 |
38 | int i;
39 | int out_index = (k + c*b);
40 | for(i = 0; i < w*h; ++i){
41 | int in_index = i + h*w*(k + b*c);
42 | in_delta[in_index] += out_delta[out_index] / (w*h);
43 | }
44 | }
45 |
46 | extern "C" void forward_avgpool_layer_gpu(avgpool_layer layer, network net)
47 | {
48 | size_t n = layer.c*layer.batch;
49 |
50 | forward_avgpool_layer_kernel<<>>(n, layer.w, layer.h, layer.c, net.input_gpu, layer.output_gpu);
51 | check_error(cudaPeekAtLastError());
52 | }
53 |
54 | extern "C" void backward_avgpool_layer_gpu(avgpool_layer layer, network net)
55 | {
56 | size_t n = layer.c*layer.batch;
57 |
58 | backward_avgpool_layer_kernel<<>>(n, layer.w, layer.h, layer.c, net.delta_gpu, layer.delta_gpu);
59 | check_error(cudaPeekAtLastError());
60 | }
61 |
62 |
--------------------------------------------------------------------------------
/darknet_ros_old/darknet/src/batchnorm_layer.h:
--------------------------------------------------------------------------------
1 | #ifndef BATCHNORM_LAYER_H
2 | #define BATCHNORM_LAYER_H
3 |
4 | #include "image.h"
5 | #include "layer.h"
6 | #include "network.h"
7 |
8 | layer make_batchnorm_layer(int batch, int w, int h, int c);
9 | void forward_batchnorm_layer(layer l, network net);
10 | void backward_batchnorm_layer(layer l, network net);
11 |
12 | #ifdef GPU
13 | void forward_batchnorm_layer_gpu(layer l, network net);
14 | void backward_batchnorm_layer_gpu(layer l, network net);
15 | void pull_batchnorm_layer(layer l);
16 | void push_batchnorm_layer(layer l);
17 | #endif
18 |
19 | #endif
20 |
--------------------------------------------------------------------------------
/darknet_ros_old/darknet/src/box.h:
--------------------------------------------------------------------------------
1 | #ifndef BOX_H
2 | #define BOX_H
3 | #include "darknet.h"
4 |
5 | typedef struct{
6 | float dx, dy, dw, dh;
7 | } dbox;
8 |
9 | float box_rmse(box a, box b);
10 | dbox diou(box a, box b);
11 | box decode_box(box b, box anchor);
12 | box encode_box(box b, box anchor);
13 |
14 | #endif
15 |
--------------------------------------------------------------------------------
/darknet_ros_old/darknet/src/classifier.h:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/darknet_ros_old/darknet/src/col2im.c:
--------------------------------------------------------------------------------
1 | #include
2 | #include
3 | void col2im_add_pixel(float *im, int height, int width, int channels,
4 | int row, int col, int channel, int pad, float val)
5 | {
6 | row -= pad;
7 | col -= pad;
8 |
9 | if (row < 0 || col < 0 ||
10 | row >= height || col >= width) return;
11 | im[col + width*(row + height*channel)] += val;
12 | }
13 | //This one might be too, can't remember.
14 | void col2im_cpu(float* data_col,
15 | int channels, int height, int width,
16 | int ksize, int stride, int pad, float* data_im)
17 | {
18 | int c,h,w;
19 | int height_col = (height + 2*pad - ksize) / stride + 1;
20 | int width_col = (width + 2*pad - ksize) / stride + 1;
21 |
22 | int channels_col = channels * ksize * ksize;
23 | for (c = 0; c < channels_col; ++c) {
24 | int w_offset = c % ksize;
25 | int h_offset = (c / ksize) % ksize;
26 | int c_im = c / ksize / ksize;
27 | for (h = 0; h < height_col; ++h) {
28 | for (w = 0; w < width_col; ++w) {
29 | int im_row = h_offset + h * stride;
30 | int im_col = w_offset + w * stride;
31 | int col_index = (c * height_col + h) * width_col + w;
32 | double val = data_col[col_index];
33 | col2im_add_pixel(data_im, height, width, channels,
34 | im_row, im_col, c_im, pad, val);
35 | }
36 | }
37 | }
38 | }
39 |
40 |
--------------------------------------------------------------------------------
/darknet_ros_old/darknet/src/col2im.h:
--------------------------------------------------------------------------------
1 | #ifndef COL2IM_H
2 | #define COL2IM_H
3 |
4 | void col2im_cpu(float* data_col,
5 | int channels, int height, int width,
6 | int ksize, int stride, int pad, float* data_im);
7 |
8 | #ifdef GPU
9 | void col2im_gpu(float *data_col,
10 | int channels, int height, int width,
11 | int ksize, int stride, int pad, float *data_im);
12 | #endif
13 | #endif
14 |
--------------------------------------------------------------------------------
/darknet_ros_old/darknet/src/col2im_kernels.cu:
--------------------------------------------------------------------------------
1 | #include "cuda_runtime.h"
2 | #include "curand.h"
3 | #include "cublas_v2.h"
4 |
5 | extern "C" {
6 | #include "col2im.h"
7 | #include "cuda.h"
8 | }
9 |
10 | // src: https://github.com/BVLC/caffe/blob/master/src/caffe/util/im2col.cu
11 | // You may also want to read: https://github.com/BVLC/caffe/blob/master/LICENSE
12 |
13 | __global__ void col2im_gpu_kernel(const int n, const float* data_col,
14 | const int height, const int width, const int ksize,
15 | const int pad,
16 | const int stride,
17 | const int height_col, const int width_col,
18 | float *data_im) {
19 | int index = blockIdx.x*blockDim.x+threadIdx.x;
20 | for(; index < n; index += blockDim.x*gridDim.x){
21 | float val = 0;
22 | int w = index % width + pad;
23 | int h = (index / width) % height + pad;
24 | int c = index / (width * height);
25 | // compute the start and end of the output
26 | int w_col_start = (w < ksize) ? 0 : (w - ksize) / stride + 1;
27 | int w_col_end = min(w / stride + 1, width_col);
28 | int h_col_start = (h < ksize) ? 0 : (h - ksize) / stride + 1;
29 | int h_col_end = min(h / stride + 1, height_col);
30 | // equivalent implementation
31 | int offset =
32 | (c * ksize * ksize + h * ksize + w) * height_col * width_col;
33 | int coeff_h_col = (1 - stride * ksize * height_col) * width_col;
34 | int coeff_w_col = (1 - stride * height_col * width_col);
35 | for (int h_col = h_col_start; h_col < h_col_end; ++h_col) {
36 | for (int w_col = w_col_start; w_col < w_col_end; ++w_col) {
37 | val += data_col[offset + h_col * coeff_h_col + w_col * coeff_w_col];
38 | }
39 | }
40 | data_im[index] += val;
41 | }
42 | }
43 |
44 | void col2im_gpu(float *data_col,
45 | int channels, int height, int width,
46 | int ksize, int stride, int pad, float *data_im){
47 | // We are going to launch channels * height_col * width_col kernels, each
48 | // kernel responsible for copying a single-channel grid.
49 | int height_col = (height + 2 * pad - ksize) / stride + 1;
50 | int width_col = (width + 2 * pad - ksize) / stride + 1;
51 | int num_kernels = channels * height * width;
52 | col2im_gpu_kernel<<<(num_kernels+BLOCK-1)/BLOCK,
53 | BLOCK>>>(
54 | num_kernels, data_col, height, width, ksize, pad,
55 | stride, height_col,
56 | width_col, data_im);
57 | }
58 |
59 |
--------------------------------------------------------------------------------
/darknet_ros_old/darknet/src/connected_layer.h:
--------------------------------------------------------------------------------
1 | #ifndef CONNECTED_LAYER_H
2 | #define CONNECTED_LAYER_H
3 |
4 | #include "activations.h"
5 | #include "layer.h"
6 | #include "network.h"
7 |
8 | layer make_connected_layer(int batch, int inputs, int outputs, ACTIVATION activation, int batch_normalize, int adam);
9 |
10 | void forward_connected_layer(layer l, network net);
11 | void backward_connected_layer(layer l, network net);
12 | void update_connected_layer(layer l, update_args a);
13 |
14 | #ifdef GPU
15 | void forward_connected_layer_gpu(layer l, network net);
16 | void backward_connected_layer_gpu(layer l, network net);
17 | void update_connected_layer_gpu(layer l, update_args a);
18 | void push_connected_layer(layer l);
19 | void pull_connected_layer(layer l);
20 | #endif
21 |
22 | #endif
23 |
24 |
--------------------------------------------------------------------------------
/darknet_ros_old/darknet/src/convolutional_layer.h:
--------------------------------------------------------------------------------
1 | #ifndef CONVOLUTIONAL_LAYER_H
2 | #define CONVOLUTIONAL_LAYER_H
3 |
4 | #include "cuda.h"
5 | #include "image.h"
6 | #include "activations.h"
7 | #include "layer.h"
8 | #include "network.h"
9 |
10 | typedef layer convolutional_layer;
11 |
12 | #ifdef GPU
13 | void forward_convolutional_layer_gpu(convolutional_layer layer, network net);
14 | void backward_convolutional_layer_gpu(convolutional_layer layer, network net);
15 | void update_convolutional_layer_gpu(convolutional_layer layer, update_args a);
16 |
17 | void push_convolutional_layer(convolutional_layer layer);
18 | void pull_convolutional_layer(convolutional_layer layer);
19 |
20 | void add_bias_gpu(float *output, float *biases, int batch, int n, int size);
21 | void backward_bias_gpu(float *bias_updates, float *delta, int batch, int n, int size);
22 | void adam_update_gpu(float *w, float *d, float *m, float *v, float B1, float B2, float eps, float decay, float rate, int n, int batch, int t);
23 | #ifdef CUDNN
24 | void cudnn_convolutional_setup(layer *l);
25 | #endif
26 | #endif
27 |
28 | convolutional_layer make_convolutional_layer(int batch, int h, int w, int c, int n, int groups, int size, int stride, int padding, ACTIVATION activation, int batch_normalize, int binary, int xnor, int adam);
29 | void resize_convolutional_layer(convolutional_layer *layer, int w, int h);
30 | void forward_convolutional_layer(const convolutional_layer layer, network net);
31 | void update_convolutional_layer(convolutional_layer layer, update_args a);
32 | image *visualize_convolutional_layer(convolutional_layer layer, char *window, image *prev_weights);
33 | void binarize_weights(float *weights, int n, int size, float *binary);
34 | void swap_binary(convolutional_layer *l);
35 | void binarize_weights2(float *weights, int n, int size, char *binary, float *scales);
36 |
37 | void backward_convolutional_layer(convolutional_layer layer, network net);
38 |
39 | void add_bias(float *output, float *biases, int batch, int n, int size);
40 | void backward_bias(float *bias_updates, float *delta, int batch, int n, int size);
41 |
42 | image get_convolutional_image(convolutional_layer layer);
43 | image get_convolutional_delta(convolutional_layer layer);
44 | image get_convolutional_weight(convolutional_layer layer, int i);
45 |
46 | int convolutional_out_height(convolutional_layer layer);
47 | int convolutional_out_width(convolutional_layer layer);
48 |
49 | #endif
50 |
51 |
--------------------------------------------------------------------------------
/darknet_ros_old/darknet/src/cost_layer.h:
--------------------------------------------------------------------------------
1 | #ifndef COST_LAYER_H
2 | #define COST_LAYER_H
3 | #include "layer.h"
4 | #include "network.h"
5 |
6 | typedef layer cost_layer;
7 |
8 | COST_TYPE get_cost_type(char *s);
9 | char *get_cost_string(COST_TYPE a);
10 | cost_layer make_cost_layer(int batch, int inputs, COST_TYPE type, float scale);
11 | void forward_cost_layer(const cost_layer l, network net);
12 | void backward_cost_layer(const cost_layer l, network net);
13 | void resize_cost_layer(cost_layer *l, int inputs);
14 |
15 | #ifdef GPU
16 | void forward_cost_layer_gpu(cost_layer l, network net);
17 | void backward_cost_layer_gpu(const cost_layer l, network net);
18 | #endif
19 |
20 | #endif
21 |
--------------------------------------------------------------------------------
/darknet_ros_old/darknet/src/crnn_layer.h:
--------------------------------------------------------------------------------
1 |
2 | #ifndef CRNN_LAYER_H
3 | #define CRNN_LAYER_H
4 |
5 | #include "activations.h"
6 | #include "layer.h"
7 | #include "network.h"
8 |
9 | layer make_crnn_layer(int batch, int h, int w, int c, int hidden_filters, int output_filters, int steps, ACTIVATION activation, int batch_normalize);
10 |
11 | void forward_crnn_layer(layer l, network net);
12 | void backward_crnn_layer(layer l, network net);
13 | void update_crnn_layer(layer l, update_args a);
14 |
15 | #ifdef GPU
16 | void forward_crnn_layer_gpu(layer l, network net);
17 | void backward_crnn_layer_gpu(layer l, network net);
18 | void update_crnn_layer_gpu(layer l, update_args a);
19 | void push_crnn_layer(layer l);
20 | void pull_crnn_layer(layer l);
21 | #endif
22 |
23 | #endif
24 |
25 |
--------------------------------------------------------------------------------
/darknet_ros_old/darknet/src/crop_layer.c:
--------------------------------------------------------------------------------
1 | #include "crop_layer.h"
2 | #include "cuda.h"
3 | #include
4 |
5 | image get_crop_image(crop_layer l)
6 | {
7 | int h = l.out_h;
8 | int w = l.out_w;
9 | int c = l.out_c;
10 | return float_to_image(w,h,c,l.output);
11 | }
12 |
13 | void backward_crop_layer(const crop_layer l, network net){}
14 | void backward_crop_layer_gpu(const crop_layer l, network net){}
15 |
16 | crop_layer make_crop_layer(int batch, int h, int w, int c, int crop_height, int crop_width, int flip, float angle, float saturation, float exposure)
17 | {
18 | fprintf(stderr, "Crop Layer: %d x %d -> %d x %d x %d image\n", h,w,crop_height,crop_width,c);
19 | crop_layer l = {0};
20 | l.type = CROP;
21 | l.batch = batch;
22 | l.h = h;
23 | l.w = w;
24 | l.c = c;
25 | l.scale = (float)crop_height / h;
26 | l.flip = flip;
27 | l.angle = angle;
28 | l.saturation = saturation;
29 | l.exposure = exposure;
30 | l.out_w = crop_width;
31 | l.out_h = crop_height;
32 | l.out_c = c;
33 | l.inputs = l.w * l.h * l.c;
34 | l.outputs = l.out_w * l.out_h * l.out_c;
35 | l.output = calloc(l.outputs*batch, sizeof(float));
36 | l.forward = forward_crop_layer;
37 | l.backward = backward_crop_layer;
38 |
39 | #ifdef GPU
40 | l.forward_gpu = forward_crop_layer_gpu;
41 | l.backward_gpu = backward_crop_layer_gpu;
42 | l.output_gpu = cuda_make_array(l.output, l.outputs*batch);
43 | l.rand_gpu = cuda_make_array(0, l.batch*8);
44 | #endif
45 | return l;
46 | }
47 |
48 | void resize_crop_layer(layer *l, int w, int h)
49 | {
50 | l->w = w;
51 | l->h = h;
52 |
53 | l->out_w = l->scale*w;
54 | l->out_h = l->scale*h;
55 |
56 | l->inputs = l->w * l->h * l->c;
57 | l->outputs = l->out_h * l->out_w * l->out_c;
58 |
59 | l->output = realloc(l->output, l->batch*l->outputs*sizeof(float));
60 | #ifdef GPU
61 | cuda_free(l->output_gpu);
62 | l->output_gpu = cuda_make_array(l->output, l->outputs*l->batch);
63 | #endif
64 | }
65 |
66 |
67 | void forward_crop_layer(const crop_layer l, network net)
68 | {
69 | int i,j,c,b,row,col;
70 | int index;
71 | int count = 0;
72 | int flip = (l.flip && rand()%2);
73 | int dh = rand()%(l.h - l.out_h + 1);
74 | int dw = rand()%(l.w - l.out_w + 1);
75 | float scale = 2;
76 | float trans = -1;
77 | if(l.noadjust){
78 | scale = 1;
79 | trans = 0;
80 | }
81 | if(!net.train){
82 | flip = 0;
83 | dh = (l.h - l.out_h)/2;
84 | dw = (l.w - l.out_w)/2;
85 | }
86 | for(b = 0; b < l.batch; ++b){
87 | for(c = 0; c < l.c; ++c){
88 | for(i = 0; i < l.out_h; ++i){
89 | for(j = 0; j < l.out_w; ++j){
90 | if(flip){
91 | col = l.w - dw - j - 1;
92 | }else{
93 | col = j + dw;
94 | }
95 | row = i + dh;
96 | index = col+l.w*(row+l.h*(c + l.c*b));
97 | l.output[count++] = net.input[index]*scale + trans;
98 | }
99 | }
100 | }
101 | }
102 | }
103 |
104 |
--------------------------------------------------------------------------------
/darknet_ros_old/darknet/src/crop_layer.h:
--------------------------------------------------------------------------------
1 | #ifndef CROP_LAYER_H
2 | #define CROP_LAYER_H
3 |
4 | #include "image.h"
5 | #include "layer.h"
6 | #include "network.h"
7 |
8 | typedef layer crop_layer;
9 |
10 | image get_crop_image(crop_layer l);
11 | crop_layer make_crop_layer(int batch, int h, int w, int c, int crop_height, int crop_width, int flip, float angle, float saturation, float exposure);
12 | void forward_crop_layer(const crop_layer l, network net);
13 | void resize_crop_layer(layer *l, int w, int h);
14 |
15 | #ifdef GPU
16 | void forward_crop_layer_gpu(crop_layer l, network net);
17 | #endif
18 |
19 | #endif
20 |
21 |
--------------------------------------------------------------------------------
/darknet_ros_old/darknet/src/cuda.h:
--------------------------------------------------------------------------------
1 | #ifndef CUDA_H
2 | #define CUDA_H
3 |
4 | #include "darknet.h"
5 |
6 | #ifdef GPU
7 |
8 | void check_error(cudaError_t status);
9 | cublasHandle_t blas_handle();
10 | int *cuda_make_int_array(int *x, size_t n);
11 | void cuda_random(float *x_gpu, size_t n);
12 | float cuda_compare(float *x_gpu, float *x, size_t n, char *s);
13 | dim3 cuda_gridsize(size_t n);
14 |
15 | #ifdef CUDNN
16 | cudnnHandle_t cudnn_handle();
17 | #endif
18 |
19 | #endif
20 | #endif
21 |
--------------------------------------------------------------------------------
/darknet_ros_old/darknet/src/data.h:
--------------------------------------------------------------------------------
1 | #ifndef DATA_H
2 | #define DATA_H
3 | #include
4 |
5 | #include "darknet.h"
6 | #include "matrix.h"
7 | #include "list.h"
8 | #include "image.h"
9 | #include "tree.h"
10 |
11 | static inline float distance_from_edge(int x, int max)
12 | {
13 | int dx = (max/2) - x;
14 | if (dx < 0) dx = -dx;
15 | dx = (max/2) + 1 - dx;
16 | dx *= 2;
17 | float dist = (float)dx/max;
18 | if (dist > 1) dist = 1;
19 | return dist;
20 | }
21 | void load_data_blocking(load_args args);
22 |
23 |
24 | void print_letters(float *pred, int n);
25 | data load_data_captcha(char **paths, int n, int m, int k, int w, int h);
26 | data load_data_captcha_encode(char **paths, int n, int m, int w, int h);
27 | data load_data_detection(int n, char **paths, int m, int w, int h, int boxes, int classes, float jitter, float hue, float saturation, float exposure);
28 | data load_data_tag(char **paths, int n, int m, int k, int min, int max, int size, float angle, float aspect, float hue, float saturation, float exposure);
29 | matrix load_image_augment_paths(char **paths, int n, int min, int max, int size, float angle, float aspect, float hue, float saturation, float exposure, int center);
30 | data load_data_super(char **paths, int n, int m, int w, int h, int scale);
31 | data load_data_augment(char **paths, int n, int m, char **labels, int k, tree *hierarchy, int min, int max, int size, float angle, float aspect, float hue, float saturation, float exposure, int center);
32 | data load_data_regression(char **paths, int n, int m, int classes, int min, int max, int size, float angle, float aspect, float hue, float saturation, float exposure);
33 | data load_go(char *filename);
34 |
35 |
36 | data load_data_writing(char **paths, int n, int m, int w, int h, int out_w, int out_h);
37 |
38 | void get_random_batch(data d, int n, float *X, float *y);
39 | data get_data_part(data d, int part, int total);
40 | data get_random_data(data d, int num);
41 | data load_categorical_data_csv(char *filename, int target, int k);
42 | void normalize_data_rows(data d);
43 | void scale_data_rows(data d, float s);
44 | void translate_data_rows(data d, float s);
45 | void randomize_data(data d);
46 | data *split_data(data d, int part, int total);
47 | data concat_datas(data *d, int n);
48 | void fill_truth(char *path, char **labels, int k, float *truth);
49 |
50 | #endif
51 |
--------------------------------------------------------------------------------
/darknet_ros_old/darknet/src/deconvolutional_layer.h:
--------------------------------------------------------------------------------
1 | #ifndef DECONVOLUTIONAL_LAYER_H
2 | #define DECONVOLUTIONAL_LAYER_H
3 |
4 | #include "cuda.h"
5 | #include "image.h"
6 | #include "activations.h"
7 | #include "layer.h"
8 | #include "network.h"
9 |
10 | #ifdef GPU
11 | void forward_deconvolutional_layer_gpu(layer l, network net);
12 | void backward_deconvolutional_layer_gpu(layer l, network net);
13 | void update_deconvolutional_layer_gpu(layer l, update_args a);
14 | void push_deconvolutional_layer(layer l);
15 | void pull_deconvolutional_layer(layer l);
16 | #endif
17 |
18 | layer make_deconvolutional_layer(int batch, int h, int w, int c, int n, int size, int stride, int padding, ACTIVATION activation, int batch_normalize, int adam);
19 | void resize_deconvolutional_layer(layer *l, int h, int w);
20 | void forward_deconvolutional_layer(const layer l, network net);
21 | void update_deconvolutional_layer(layer l, update_args a);
22 | void backward_deconvolutional_layer(layer l, network net);
23 |
24 | #endif
25 |
26 |
--------------------------------------------------------------------------------
/darknet_ros_old/darknet/src/demo.h:
--------------------------------------------------------------------------------
1 | #ifndef DEMO_H
2 | #define DEMO_H
3 |
4 | #include "image.h"
5 |
6 | #endif
7 |
--------------------------------------------------------------------------------
/darknet_ros_old/darknet/src/detection_layer.h:
--------------------------------------------------------------------------------
1 | #ifndef DETECTION_LAYER_H
2 | #define DETECTION_LAYER_H
3 |
4 | #include "layer.h"
5 | #include "network.h"
6 |
7 | typedef layer detection_layer;
8 |
9 | detection_layer make_detection_layer(int batch, int inputs, int n, int size, int classes, int coords, int rescore);
10 | void forward_detection_layer(const detection_layer l, network net);
11 | void backward_detection_layer(const detection_layer l, network net);
12 |
13 | #ifdef GPU
14 | void forward_detection_layer_gpu(const detection_layer l, network net);
15 | void backward_detection_layer_gpu(detection_layer l, network net);
16 | #endif
17 |
18 | #endif
19 |
--------------------------------------------------------------------------------
/darknet_ros_old/darknet/src/dropout_layer.c:
--------------------------------------------------------------------------------
1 | #include "dropout_layer.h"
2 | #include "utils.h"
3 | #include "cuda.h"
4 | #include
5 | #include
6 |
7 | dropout_layer make_dropout_layer(int batch, int inputs, float probability)
8 | {
9 | dropout_layer l = {0};
10 | l.type = DROPOUT;
11 | l.probability = probability;
12 | l.inputs = inputs;
13 | l.outputs = inputs;
14 | l.batch = batch;
15 | l.rand = calloc(inputs*batch, sizeof(float));
16 | l.scale = 1./(1.-probability);
17 | l.forward = forward_dropout_layer;
18 | l.backward = backward_dropout_layer;
19 | #ifdef GPU
20 | l.forward_gpu = forward_dropout_layer_gpu;
21 | l.backward_gpu = backward_dropout_layer_gpu;
22 | l.rand_gpu = cuda_make_array(l.rand, inputs*batch);
23 | #endif
24 | fprintf(stderr, "dropout p = %.2f %4d -> %4d\n", probability, inputs, inputs);
25 | return l;
26 | }
27 |
28 | void resize_dropout_layer(dropout_layer *l, int inputs)
29 | {
30 | l->rand = realloc(l->rand, l->inputs*l->batch*sizeof(float));
31 | #ifdef GPU
32 | cuda_free(l->rand_gpu);
33 |
34 | l->rand_gpu = cuda_make_array(l->rand, inputs*l->batch);
35 | #endif
36 | }
37 |
38 | void forward_dropout_layer(dropout_layer l, network net)
39 | {
40 | int i;
41 | if (!net.train) return;
42 | for(i = 0; i < l.batch * l.inputs; ++i){
43 | float r = rand_uniform(0, 1);
44 | l.rand[i] = r;
45 | if(r < l.probability) net.input[i] = 0;
46 | else net.input[i] *= l.scale;
47 | }
48 | }
49 |
50 | void backward_dropout_layer(dropout_layer l, network net)
51 | {
52 | int i;
53 | if(!net.delta) return;
54 | for(i = 0; i < l.batch * l.inputs; ++i){
55 | float r = l.rand[i];
56 | if(r < l.probability) net.delta[i] = 0;
57 | else net.delta[i] *= l.scale;
58 | }
59 | }
60 |
61 |
--------------------------------------------------------------------------------
/darknet_ros_old/darknet/src/dropout_layer.h:
--------------------------------------------------------------------------------
1 | #ifndef DROPOUT_LAYER_H
2 | #define DROPOUT_LAYER_H
3 |
4 | #include "layer.h"
5 | #include "network.h"
6 |
7 | typedef layer dropout_layer;
8 |
9 | dropout_layer make_dropout_layer(int batch, int inputs, float probability);
10 |
11 | void forward_dropout_layer(dropout_layer l, network net);
12 | void backward_dropout_layer(dropout_layer l, network net);
13 | void resize_dropout_layer(dropout_layer *l, int inputs);
14 |
15 | #ifdef GPU
16 | void forward_dropout_layer_gpu(dropout_layer l, network net);
17 | void backward_dropout_layer_gpu(dropout_layer l, network net);
18 |
19 | #endif
20 | #endif
21 |
--------------------------------------------------------------------------------
/darknet_ros_old/darknet/src/dropout_layer_kernels.cu:
--------------------------------------------------------------------------------
1 | #include "cuda_runtime.h"
2 | #include "curand.h"
3 | #include "cublas_v2.h"
4 |
5 | extern "C" {
6 | #include "dropout_layer.h"
7 | #include "cuda.h"
8 | #include "utils.h"
9 | }
10 |
11 | __global__ void yoloswag420blazeit360noscope(float *input, int size, float *rand, float prob, float scale)
12 | {
13 | int id = (blockIdx.x + blockIdx.y*gridDim.x) * blockDim.x + threadIdx.x;
14 | if(id < size) input[id] = (rand[id] < prob) ? 0 : input[id]*scale;
15 | }
16 |
17 | void forward_dropout_layer_gpu(dropout_layer layer, network net)
18 | {
19 | if (!net.train) return;
20 | int size = layer.inputs*layer.batch;
21 | cuda_random(layer.rand_gpu, size);
22 | /*
23 | int i;
24 | for(i = 0; i < size; ++i){
25 | layer.rand[i] = rand_uniform();
26 | }
27 | cuda_push_array(layer.rand_gpu, layer.rand, size);
28 | */
29 |
30 | yoloswag420blazeit360noscope<<>>(net.input_gpu, size, layer.rand_gpu, layer.probability, layer.scale);
31 | check_error(cudaPeekAtLastError());
32 | }
33 |
34 | void backward_dropout_layer_gpu(dropout_layer layer, network net)
35 | {
36 | if(!net.delta_gpu) return;
37 | int size = layer.inputs*layer.batch;
38 |
39 | yoloswag420blazeit360noscope<<>>(net.delta_gpu, size, layer.rand_gpu, layer.probability, layer.scale);
40 | check_error(cudaPeekAtLastError());
41 | }
42 |
--------------------------------------------------------------------------------
/darknet_ros_old/darknet/src/gemm.h:
--------------------------------------------------------------------------------
1 | #ifndef GEMM_H
2 | #define GEMM_H
3 |
4 | void gemm_bin(int M, int N, int K, float ALPHA,
5 | char *A, int lda,
6 | float *B, int ldb,
7 | float *C, int ldc);
8 |
9 | void gemm(int TA, int TB, int M, int N, int K, float ALPHA,
10 | float *A, int lda,
11 | float *B, int ldb,
12 | float BETA,
13 | float *C, int ldc);
14 |
15 | void gemm_cpu(int TA, int TB, int M, int N, int K, float ALPHA,
16 | float *A, int lda,
17 | float *B, int ldb,
18 | float BETA,
19 | float *C, int ldc);
20 |
21 | #ifdef GPU
22 | void gemm_gpu(int TA, int TB, int M, int N, int K, float ALPHA,
23 | float *A_gpu, int lda,
24 | float *B_gpu, int ldb,
25 | float BETA,
26 | float *C_gpu, int ldc);
27 |
28 | void gemm_gpu(int TA, int TB, int M, int N, int K, float ALPHA,
29 | float *A, int lda,
30 | float *B, int ldb,
31 | float BETA,
32 | float *C, int ldc);
33 | #endif
34 | #endif
35 |
--------------------------------------------------------------------------------
/darknet_ros_old/darknet/src/gru_layer.h:
--------------------------------------------------------------------------------
1 |
2 | #ifndef GRU_LAYER_H
3 | #define GRU_LAYER_H
4 |
5 | #include "activations.h"
6 | #include "layer.h"
7 | #include "network.h"
8 |
9 | layer make_gru_layer(int batch, int inputs, int outputs, int steps, int batch_normalize, int adam);
10 |
11 | void forward_gru_layer(layer l, network state);
12 | void backward_gru_layer(layer l, network state);
13 | void update_gru_layer(layer l, update_args a);
14 |
15 | #ifdef GPU
16 | void forward_gru_layer_gpu(layer l, network state);
17 | void backward_gru_layer_gpu(layer l, network state);
18 | void update_gru_layer_gpu(layer l, update_args a);
19 | void push_gru_layer(layer l);
20 | void pull_gru_layer(layer l);
21 | #endif
22 |
23 | #endif
24 |
25 |
--------------------------------------------------------------------------------
/darknet_ros_old/darknet/src/im2col.c:
--------------------------------------------------------------------------------
1 | #include "im2col.h"
2 | #include
3 | float im2col_get_pixel(float *im, int height, int width, int channels,
4 | int row, int col, int channel, int pad)
5 | {
6 | row -= pad;
7 | col -= pad;
8 |
9 | if (row < 0 || col < 0 ||
10 | row >= height || col >= width) return 0;
11 | return im[col + width*(row + height*channel)];
12 | }
13 |
14 | //From Berkeley Vision's Caffe!
15 | //https://github.com/BVLC/caffe/blob/master/LICENSE
16 | void im2col_cpu(float* data_im,
17 | int channels, int height, int width,
18 | int ksize, int stride, int pad, float* data_col)
19 | {
20 | int c,h,w;
21 | int height_col = (height + 2*pad - ksize) / stride + 1;
22 | int width_col = (width + 2*pad - ksize) / stride + 1;
23 |
24 | int channels_col = channels * ksize * ksize;
25 | for (c = 0; c < channels_col; ++c) {
26 | int w_offset = c % ksize;
27 | int h_offset = (c / ksize) % ksize;
28 | int c_im = c / ksize / ksize;
29 | for (h = 0; h < height_col; ++h) {
30 | for (w = 0; w < width_col; ++w) {
31 | int im_row = h_offset + h * stride;
32 | int im_col = w_offset + w * stride;
33 | int col_index = (c * height_col + h) * width_col + w;
34 | data_col[col_index] = im2col_get_pixel(data_im, height, width, channels,
35 | im_row, im_col, c_im, pad);
36 | }
37 | }
38 | }
39 | }
40 |
41 |
--------------------------------------------------------------------------------
/darknet_ros_old/darknet/src/im2col.h:
--------------------------------------------------------------------------------
1 | #ifndef IM2COL_H
2 | #define IM2COL_H
3 |
4 | void im2col_cpu(float* data_im,
5 | int channels, int height, int width,
6 | int ksize, int stride, int pad, float* data_col);
7 |
8 | #ifdef GPU
9 |
10 | void im2col_gpu(float *im,
11 | int channels, int height, int width,
12 | int ksize, int stride, int pad,float *data_col);
13 |
14 | #endif
15 | #endif
16 |
--------------------------------------------------------------------------------
/darknet_ros_old/darknet/src/im2col_kernels.cu:
--------------------------------------------------------------------------------
1 | #include "cuda_runtime.h"
2 | #include "curand.h"
3 | #include "cublas_v2.h"
4 |
5 | extern "C" {
6 | #include "im2col.h"
7 | #include "cuda.h"
8 | }
9 |
10 | // src: https://github.com/BVLC/caffe/blob/master/src/caffe/util/im2col.cu
11 | // You may also want to read: https://github.com/BVLC/caffe/blob/master/LICENSE
12 |
13 | __global__ void im2col_gpu_kernel(const int n, const float* data_im,
14 | const int height, const int width, const int ksize,
15 | const int pad,
16 | const int stride,
17 | const int height_col, const int width_col,
18 | float *data_col) {
19 | int index = blockIdx.x*blockDim.x+threadIdx.x;
20 | for(; index < n; index += blockDim.x*gridDim.x){
21 | int w_out = index % width_col;
22 | int h_index = index / width_col;
23 | int h_out = h_index % height_col;
24 | int channel_in = h_index / height_col;
25 | int channel_out = channel_in * ksize * ksize;
26 | int h_in = h_out * stride - pad;
27 | int w_in = w_out * stride - pad;
28 | float* data_col_ptr = data_col;
29 | data_col_ptr += (channel_out * height_col + h_out) * width_col + w_out;
30 | const float* data_im_ptr = data_im;
31 | data_im_ptr += (channel_in * height + h_in) * width + w_in;
32 | for (int i = 0; i < ksize; ++i) {
33 | for (int j = 0; j < ksize; ++j) {
34 | int h = h_in + i;
35 | int w = w_in + j;
36 |
37 | *data_col_ptr = (h >= 0 && w >= 0 && h < height && w < width) ?
38 | data_im_ptr[i * width + j] : 0;
39 |
40 | //*data_col_ptr = data_im_ptr[ii * width + jj];
41 |
42 | data_col_ptr += height_col * width_col;
43 | }
44 | }
45 | }
46 | }
47 |
48 | void im2col_gpu(float *im,
49 | int channels, int height, int width,
50 | int ksize, int stride, int pad, float *data_col){
51 | // We are going to launch channels * height_col * width_col kernels, each
52 | // kernel responsible for copying a single-channel grid.
53 | int height_col = (height + 2 * pad - ksize) / stride + 1;
54 | int width_col = (width + 2 * pad - ksize) / stride + 1;
55 | int num_kernels = channels * height_col * width_col;
56 | im2col_gpu_kernel<<<(num_kernels+BLOCK-1)/BLOCK,
57 | BLOCK>>>(
58 | num_kernels, im, height, width, ksize, pad,
59 | stride, height_col,
60 | width_col, data_col);
61 | }
62 |
--------------------------------------------------------------------------------
/darknet_ros_old/darknet/src/image.h:
--------------------------------------------------------------------------------
1 | #ifndef IMAGE_H
2 | #define IMAGE_H
3 |
4 | #include
5 | #include
6 | #include
7 | #include
8 | #include
9 | #include "box.h"
10 | #include "darknet.h"
11 |
12 | #ifndef __cplusplus
13 | #ifdef OPENCV
14 | int fill_image_from_stream(CvCapture *cap, image im);
15 | image ipl_to_image(IplImage* src);
16 | void ipl_into_image(IplImage* src, image im);
17 | void flush_stream_buffer(CvCapture *cap, int n);
18 | void show_image_cv(image p, const char *name, IplImage *disp);
19 | #endif
20 | #endif
21 |
22 | float get_color(int c, int x, int max);
23 | void draw_box(image a, int x1, int y1, int x2, int y2, float r, float g, float b);
24 | void draw_bbox(image a, box bbox, int w, float r, float g, float b);
25 | void write_label(image a, int r, int c, image *characters, char *string, float *rgb);
26 | image image_distance(image a, image b);
27 | void scale_image(image m, float s);
28 | image rotate_crop_image(image im, float rad, float s, int w, int h, float dx, float dy, float aspect);
29 | image random_crop_image(image im, int w, int h);
30 | image random_augment_image(image im, float angle, float aspect, int low, int high, int w, int h);
31 | augment_args random_augment_args(image im, float angle, float aspect, int low, int high, int w, int h);
32 | void letterbox_image_into(image im, int w, int h, image boxed);
33 | image resize_max(image im, int max);
34 | void translate_image(image m, float s);
35 | void embed_image(image source, image dest, int dx, int dy);
36 | void place_image(image im, int w, int h, int dx, int dy, image canvas);
37 | void saturate_image(image im, float sat);
38 | void exposure_image(image im, float sat);
39 | void distort_image(image im, float hue, float sat, float val);
40 | void saturate_exposure_image(image im, float sat, float exposure);
41 | void rgb_to_hsv(image im);
42 | void hsv_to_rgb(image im);
43 | void yuv_to_rgb(image im);
44 | void rgb_to_yuv(image im);
45 |
46 |
47 | image collapse_image_layers(image source, int border);
48 | image collapse_images_horz(image *ims, int n);
49 | image collapse_images_vert(image *ims, int n);
50 |
51 | void show_image_normalized(image im, const char *name);
52 | void show_images(image *ims, int n, char *window);
53 | void show_image_layers(image p, char *name);
54 | void show_image_collapsed(image p, char *name);
55 |
56 | void print_image(image m);
57 |
58 | image make_empty_image(int w, int h, int c);
59 | void copy_image_into(image src, image dest);
60 |
61 | image get_image_layer(image m, int l);
62 |
63 | #endif
64 |
65 |
--------------------------------------------------------------------------------
/darknet_ros_old/darknet/src/l2norm_layer.c:
--------------------------------------------------------------------------------
1 | #include "l2norm_layer.h"
2 | #include "activations.h"
3 | #include "blas.h"
4 | #include "cuda.h"
5 |
6 | #include
7 | #include
8 | #include
9 | #include
10 | #include
11 |
12 | layer make_l2norm_layer(int batch, int inputs)
13 | {
14 | fprintf(stderr, "l2norm %4d\n", inputs);
15 | layer l = {0};
16 | l.type = L2NORM;
17 | l.batch = batch;
18 | l.inputs = inputs;
19 | l.outputs = inputs;
20 | l.output = calloc(inputs*batch, sizeof(float));
21 | l.scales = calloc(inputs*batch, sizeof(float));
22 | l.delta = calloc(inputs*batch, sizeof(float));
23 |
24 | l.forward = forward_l2norm_layer;
25 | l.backward = backward_l2norm_layer;
26 | #ifdef GPU
27 | l.forward_gpu = forward_l2norm_layer_gpu;
28 | l.backward_gpu = backward_l2norm_layer_gpu;
29 |
30 | l.output_gpu = cuda_make_array(l.output, inputs*batch);
31 | l.scales_gpu = cuda_make_array(l.output, inputs*batch);
32 | l.delta_gpu = cuda_make_array(l.delta, inputs*batch);
33 | #endif
34 | return l;
35 | }
36 |
37 | void forward_l2norm_layer(const layer l, network net)
38 | {
39 | copy_cpu(l.outputs*l.batch, net.input, 1, l.output, 1);
40 | l2normalize_cpu(l.output, l.scales, l.batch, l.out_c, l.out_w*l.out_h);
41 | }
42 |
43 | void backward_l2norm_layer(const layer l, network net)
44 | {
45 | //axpy_cpu(l.inputs*l.batch, 1, l.scales, 1, l.delta, 1);
46 | axpy_cpu(l.inputs*l.batch, 1, l.delta, 1, net.delta, 1);
47 | }
48 |
49 | #ifdef GPU
50 |
51 | void forward_l2norm_layer_gpu(const layer l, network net)
52 | {
53 | copy_gpu(l.outputs*l.batch, net.input_gpu, 1, l.output_gpu, 1);
54 | l2normalize_gpu(l.output_gpu, l.scales_gpu, l.batch, l.out_c, l.out_w*l.out_h);
55 | }
56 |
57 | void backward_l2norm_layer_gpu(const layer l, network net)
58 | {
59 | axpy_gpu(l.batch*l.inputs, 1, l.scales_gpu, 1, l.delta_gpu, 1);
60 | axpy_gpu(l.batch*l.inputs, 1, l.delta_gpu, 1, net.delta_gpu, 1);
61 | }
62 |
63 | #endif
64 |
--------------------------------------------------------------------------------
/darknet_ros_old/darknet/src/l2norm_layer.h:
--------------------------------------------------------------------------------
1 | #ifndef L2NORM_LAYER_H
2 | #define L2NORM_LAYER_H
3 | #include "layer.h"
4 | #include "network.h"
5 |
6 | layer make_l2norm_layer(int batch, int inputs);
7 | void forward_l2norm_layer(const layer l, network net);
8 | void backward_l2norm_layer(const layer l, network net);
9 |
10 | #ifdef GPU
11 | void forward_l2norm_layer_gpu(const layer l, network net);
12 | void backward_l2norm_layer_gpu(const layer l, network net);
13 | #endif
14 |
15 | #endif
16 |
--------------------------------------------------------------------------------
/darknet_ros_old/darknet/src/layer.h:
--------------------------------------------------------------------------------
1 | #include "darknet.h"
2 |
--------------------------------------------------------------------------------
/darknet_ros_old/darknet/src/list.c:
--------------------------------------------------------------------------------
1 | #include
2 | #include
3 | #include "list.h"
4 |
5 | list *make_list()
6 | {
7 | list *l = malloc(sizeof(list));
8 | l->size = 0;
9 | l->front = 0;
10 | l->back = 0;
11 | return l;
12 | }
13 |
14 | /*
15 | void transfer_node(list *s, list *d, node *n)
16 | {
17 | node *prev, *next;
18 | prev = n->prev;
19 | next = n->next;
20 | if(prev) prev->next = next;
21 | if(next) next->prev = prev;
22 | --s->size;
23 | if(s->front == n) s->front = next;
24 | if(s->back == n) s->back = prev;
25 | }
26 | */
27 |
28 | void *list_pop(list *l){
29 | if(!l->back) return 0;
30 | node *b = l->back;
31 | void *val = b->val;
32 | l->back = b->prev;
33 | if(l->back) l->back->next = 0;
34 | free(b);
35 | --l->size;
36 |
37 | return val;
38 | }
39 |
40 | void list_insert(list *l, void *val)
41 | {
42 | node *new = malloc(sizeof(node));
43 | new->val = val;
44 | new->next = 0;
45 |
46 | if(!l->back){
47 | l->front = new;
48 | new->prev = 0;
49 | }else{
50 | l->back->next = new;
51 | new->prev = l->back;
52 | }
53 | l->back = new;
54 | ++l->size;
55 | }
56 |
57 | void free_node(node *n)
58 | {
59 | node *next;
60 | while(n) {
61 | next = n->next;
62 | free(n);
63 | n = next;
64 | }
65 | }
66 |
67 | void free_list(list *l)
68 | {
69 | free_node(l->front);
70 | free(l);
71 | }
72 |
73 | void free_list_contents(list *l)
74 | {
75 | node *n = l->front;
76 | while(n){
77 | free(n->val);
78 | n = n->next;
79 | }
80 | }
81 |
82 | void **list_to_array(list *l)
83 | {
84 | void **a = calloc(l->size, sizeof(void*));
85 | int count = 0;
86 | node *n = l->front;
87 | while(n){
88 | a[count++] = n->val;
89 | n = n->next;
90 | }
91 | return a;
92 | }
93 |
--------------------------------------------------------------------------------
/darknet_ros_old/darknet/src/list.h:
--------------------------------------------------------------------------------
1 | #ifndef LIST_H
2 | #define LIST_H
3 | #include "darknet.h"
4 |
5 | list *make_list();
6 | int list_find(list *l, void *val);
7 |
8 | void list_insert(list *, void *);
9 |
10 |
11 | void free_list_contents(list *l);
12 |
13 | #endif
14 |
--------------------------------------------------------------------------------
/darknet_ros_old/darknet/src/local_layer.h:
--------------------------------------------------------------------------------
1 | #ifndef LOCAL_LAYER_H
2 | #define LOCAL_LAYER_H
3 |
4 | #include "cuda.h"
5 | #include "image.h"
6 | #include "activations.h"
7 | #include "layer.h"
8 | #include "network.h"
9 |
10 | typedef layer local_layer;
11 |
12 | #ifdef GPU
13 | void forward_local_layer_gpu(local_layer layer, network net);
14 | void backward_local_layer_gpu(local_layer layer, network net);
15 | void update_local_layer_gpu(local_layer layer, update_args a);
16 |
17 | void push_local_layer(local_layer layer);
18 | void pull_local_layer(local_layer layer);
19 | #endif
20 |
21 | local_layer make_local_layer(int batch, int h, int w, int c, int n, int size, int stride, int pad, ACTIVATION activation);
22 |
23 | void forward_local_layer(const local_layer layer, network net);
24 | void backward_local_layer(local_layer layer, network net);
25 | void update_local_layer(local_layer layer, update_args a);
26 |
27 | void bias_output(float *output, float *biases, int batch, int n, int size);
28 | void backward_bias(float *bias_updates, float *delta, int batch, int n, int size);
29 |
30 | #endif
31 |
32 |
--------------------------------------------------------------------------------
/darknet_ros_old/darknet/src/logistic_layer.c:
--------------------------------------------------------------------------------
1 | #include "logistic_layer.h"
2 | #include "activations.h"
3 | #include "blas.h"
4 | #include "cuda.h"
5 |
6 | #include
7 | #include
8 | #include
9 | #include
10 | #include
11 |
12 | layer make_logistic_layer(int batch, int inputs)
13 | {
14 | fprintf(stderr, "logistic x entropy %4d\n", inputs);
15 | layer l = {0};
16 | l.type = LOGXENT;
17 | l.batch = batch;
18 | l.inputs = inputs;
19 | l.outputs = inputs;
20 | l.loss = calloc(inputs*batch, sizeof(float));
21 | l.output = calloc(inputs*batch, sizeof(float));
22 | l.delta = calloc(inputs*batch, sizeof(float));
23 | l.cost = calloc(1, sizeof(float));
24 |
25 | l.forward = forward_logistic_layer;
26 | l.backward = backward_logistic_layer;
27 | #ifdef GPU
28 | l.forward_gpu = forward_logistic_layer_gpu;
29 | l.backward_gpu = backward_logistic_layer_gpu;
30 |
31 | l.output_gpu = cuda_make_array(l.output, inputs*batch);
32 | l.loss_gpu = cuda_make_array(l.loss, inputs*batch);
33 | l.delta_gpu = cuda_make_array(l.delta, inputs*batch);
34 | #endif
35 | return l;
36 | }
37 |
38 | void forward_logistic_layer(const layer l, network net)
39 | {
40 | copy_cpu(l.outputs*l.batch, net.input, 1, l.output, 1);
41 | activate_array(l.output, l.outputs*l.batch, LOGISTIC);
42 | if(net.truth){
43 | logistic_x_ent_cpu(l.batch*l.inputs, l.output, net.truth, l.delta, l.loss);
44 | l.cost[0] = sum_array(l.loss, l.batch*l.inputs);
45 | }
46 | }
47 |
48 | void backward_logistic_layer(const layer l, network net)
49 | {
50 | axpy_cpu(l.inputs*l.batch, 1, l.delta, 1, net.delta, 1);
51 | }
52 |
53 | #ifdef GPU
54 |
55 | void forward_logistic_layer_gpu(const layer l, network net)
56 | {
57 | copy_gpu(l.outputs*l.batch, net.input_gpu, 1, l.output_gpu, 1);
58 | activate_array_gpu(l.output_gpu, l.outputs*l.batch, LOGISTIC);
59 | if(net.truth){
60 | logistic_x_ent_gpu(l.batch*l.inputs, l.output_gpu, net.truth_gpu, l.delta_gpu, l.loss_gpu);
61 | cuda_pull_array(l.loss_gpu, l.loss, l.batch*l.inputs);
62 | l.cost[0] = sum_array(l.loss, l.batch*l.inputs);
63 | }
64 | }
65 |
66 | void backward_logistic_layer_gpu(const layer l, network net)
67 | {
68 | axpy_gpu(l.batch*l.inputs, 1, l.delta_gpu, 1, net.delta_gpu, 1);
69 | }
70 |
71 | #endif
72 |
--------------------------------------------------------------------------------
/darknet_ros_old/darknet/src/logistic_layer.h:
--------------------------------------------------------------------------------
1 | #ifndef LOGISTIC_LAYER_H
2 | #define LOGISTIC_LAYER_H
3 | #include "layer.h"
4 | #include "network.h"
5 |
6 | layer make_logistic_layer(int batch, int inputs);
7 | void forward_logistic_layer(const layer l, network net);
8 | void backward_logistic_layer(const layer l, network net);
9 |
10 | #ifdef GPU
11 | void forward_logistic_layer_gpu(const layer l, network net);
12 | void backward_logistic_layer_gpu(const layer l, network net);
13 | #endif
14 |
15 | #endif
16 |
--------------------------------------------------------------------------------
/darknet_ros_old/darknet/src/lstm_layer.h:
--------------------------------------------------------------------------------
1 | #ifndef LSTM_LAYER_H
2 | #define LSTM_LAYER_H
3 |
4 | #include "activations.h"
5 | #include "layer.h"
6 | #include "network.h"
7 | #define USET
8 |
9 | layer make_lstm_layer(int batch, int inputs, int outputs, int steps, int batch_normalize, int adam);
10 |
11 | void forward_lstm_layer(layer l, network net);
12 | void update_lstm_layer(layer l, update_args a);
13 |
14 | #ifdef GPU
15 | void forward_lstm_layer_gpu(layer l, network net);
16 | void backward_lstm_layer_gpu(layer l, network net);
17 | void update_lstm_layer_gpu(layer l, update_args a);
18 |
19 | #endif
20 | #endif
21 |
--------------------------------------------------------------------------------
/darknet_ros_old/darknet/src/matrix.h:
--------------------------------------------------------------------------------
1 | #ifndef MATRIX_H
2 | #define MATRIX_H
3 | #include "darknet.h"
4 |
5 | matrix copy_matrix(matrix m);
6 | void print_matrix(matrix m);
7 |
8 | matrix hold_out_matrix(matrix *m, int n);
9 | matrix resize_matrix(matrix m, int size);
10 |
11 | float *pop_column(matrix *m, int c);
12 |
13 | #endif
14 |
--------------------------------------------------------------------------------
/darknet_ros_old/darknet/src/maxpool_layer.h:
--------------------------------------------------------------------------------
1 | #ifndef MAXPOOL_LAYER_H
2 | #define MAXPOOL_LAYER_H
3 |
4 | #include "image.h"
5 | #include "cuda.h"
6 | #include "layer.h"
7 | #include "network.h"
8 |
9 | typedef layer maxpool_layer;
10 |
11 | image get_maxpool_image(maxpool_layer l);
12 | maxpool_layer make_maxpool_layer(int batch, int h, int w, int c, int size, int stride, int padding);
13 | void resize_maxpool_layer(maxpool_layer *l, int w, int h);
14 | void forward_maxpool_layer(const maxpool_layer l, network net);
15 | void backward_maxpool_layer(const maxpool_layer l, network net);
16 |
17 | #ifdef GPU
18 | void forward_maxpool_layer_gpu(maxpool_layer l, network net);
19 | void backward_maxpool_layer_gpu(maxpool_layer l, network net);
20 | #endif
21 |
22 | #endif
23 |
24 |
--------------------------------------------------------------------------------
/darknet_ros_old/darknet/src/maxpool_layer_kernels.cu:
--------------------------------------------------------------------------------
1 | #include "cuda_runtime.h"
2 | #include "curand.h"
3 | #include "cublas_v2.h"
4 |
5 | extern "C" {
6 | #include "maxpool_layer.h"
7 | #include "cuda.h"
8 | }
9 |
10 | __global__ void forward_maxpool_layer_kernel(int n, int in_h, int in_w, int in_c, int stride, int size, int pad, float *input, float *output, int *indexes)
11 | {
12 | int h = (in_h + 2*pad)/stride;
13 | int w = (in_w + 2*pad)/stride;
14 | int c = in_c;
15 |
16 | int id = (blockIdx.x + blockIdx.y*gridDim.x) * blockDim.x + threadIdx.x;
17 | if(id >= n) return;
18 |
19 | int j = id % w;
20 | id /= w;
21 | int i = id % h;
22 | id /= h;
23 | int k = id % c;
24 | id /= c;
25 | int b = id;
26 |
27 | int w_offset = -pad;
28 | int h_offset = -pad;
29 |
30 | int out_index = j + w*(i + h*(k + c*b));
31 | float max = -INFINITY;
32 | int max_i = -1;
33 | int l, m;
34 | for(l = 0; l < size; ++l){
35 | for(m = 0; m < size; ++m){
36 | int cur_h = h_offset + i*stride + l;
37 | int cur_w = w_offset + j*stride + m;
38 | int index = cur_w + in_w*(cur_h + in_h*(k + b*in_c));
39 | int valid = (cur_h >= 0 && cur_h < in_h &&
40 | cur_w >= 0 && cur_w < in_w);
41 | float val = (valid != 0) ? input[index] : -INFINITY;
42 | max_i = (val > max) ? index : max_i;
43 | max = (val > max) ? val : max;
44 | }
45 | }
46 | output[out_index] = max;
47 | indexes[out_index] = max_i;
48 | }
49 |
50 | __global__ void backward_maxpool_layer_kernel(int n, int in_h, int in_w, int in_c, int stride, int size, int pad, float *delta, float *prev_delta, int *indexes)
51 | {
52 | int h = (in_h + 2*pad)/stride;
53 | int w = (in_w + 2*pad)/stride;
54 | int c = in_c;
55 | int area = (size-1)/stride;
56 |
57 | int id = (blockIdx.x + blockIdx.y*gridDim.x) * blockDim.x + threadIdx.x;
58 | if(id >= n) return;
59 |
60 | int index = id;
61 | int j = id % in_w;
62 | id /= in_w;
63 | int i = id % in_h;
64 | id /= in_h;
65 | int k = id % in_c;
66 | id /= in_c;
67 | int b = id;
68 |
69 | int w_offset = -pad;
70 | int h_offset = -pad;
71 |
72 | float d = 0;
73 | int l, m;
74 | for(l = -area; l < area+1; ++l){
75 | for(m = -area; m < area+1; ++m){
76 | int out_w = (j-w_offset)/stride + m;
77 | int out_h = (i-h_offset)/stride + l;
78 | int out_index = out_w + w*(out_h + h*(k + c*b));
79 | int valid = (out_w >= 0 && out_w < w &&
80 | out_h >= 0 && out_h < h);
81 | d += (valid && indexes[out_index] == index) ? delta[out_index] : 0;
82 | }
83 | }
84 | prev_delta[index] += d;
85 | }
86 |
87 | extern "C" void forward_maxpool_layer_gpu(maxpool_layer layer, network net)
88 | {
89 | int h = layer.out_h;
90 | int w = layer.out_w;
91 | int c = layer.c;
92 |
93 | size_t n = h*w*c*layer.batch;
94 |
95 | forward_maxpool_layer_kernel<<>>(n, layer.h, layer.w, layer.c, layer.stride, layer.size, layer.pad, net.input_gpu, layer.output_gpu, layer.indexes_gpu);
96 | check_error(cudaPeekAtLastError());
97 | }
98 |
99 | extern "C" void backward_maxpool_layer_gpu(maxpool_layer layer, network net)
100 | {
101 | size_t n = layer.h*layer.w*layer.c*layer.batch;
102 |
103 | backward_maxpool_layer_kernel<<>>(n, layer.h, layer.w, layer.c, layer.stride, layer.size, layer.pad, layer.delta_gpu, net.delta_gpu, layer.indexes_gpu);
104 | check_error(cudaPeekAtLastError());
105 | }
106 |
107 |
--------------------------------------------------------------------------------
/darknet_ros_old/darknet/src/network.h:
--------------------------------------------------------------------------------
1 | // Oh boy, why am I about to do this....
2 | #ifndef NETWORK_H
3 | #define NETWORK_H
4 | #include "darknet.h"
5 |
6 | #include "image.h"
7 | #include "layer.h"
8 | #include "data.h"
9 | #include "tree.h"
10 |
11 |
12 | #ifdef GPU
13 | void pull_network_output(network *net);
14 | #endif
15 |
16 | void compare_networks(network *n1, network *n2, data d);
17 | char *get_layer_string(LAYER_TYPE a);
18 |
19 | network *make_network(int n);
20 |
21 |
22 | float network_accuracy_multi(network *net, data d, int n);
23 | int get_predicted_class_network(network *net);
24 | void print_network(network *net);
25 | int resize_network(network *net, int w, int h);
26 | void calc_network_cost(network *net);
27 |
28 | #endif
29 |
30 |
--------------------------------------------------------------------------------
/darknet_ros_old/darknet/src/normalization_layer.h:
--------------------------------------------------------------------------------
1 | #ifndef NORMALIZATION_LAYER_H
2 | #define NORMALIZATION_LAYER_H
3 |
4 | #include "image.h"
5 | #include "layer.h"
6 | #include "network.h"
7 |
8 | layer make_normalization_layer(int batch, int w, int h, int c, int size, float alpha, float beta, float kappa);
9 | void resize_normalization_layer(layer *layer, int h, int w);
10 | void forward_normalization_layer(const layer layer, network net);
11 | void backward_normalization_layer(const layer layer, network net);
12 | void visualize_normalization_layer(layer layer, char *window);
13 |
14 | #ifdef GPU
15 | void forward_normalization_layer_gpu(const layer layer, network net);
16 | void backward_normalization_layer_gpu(const layer layer, network net);
17 | #endif
18 |
19 | #endif
20 |
--------------------------------------------------------------------------------
/darknet_ros_old/darknet/src/option_list.c:
--------------------------------------------------------------------------------
1 | #include
2 | #include
3 | #include
4 | #include "option_list.h"
5 | #include "utils.h"
6 |
7 | list *read_data_cfg(char *filename)
8 | {
9 | FILE *file = fopen(filename, "r");
10 | if(file == 0) file_error(filename);
11 | char *line;
12 | int nu = 0;
13 | list *options = make_list();
14 | while((line=fgetl(file)) != 0){
15 | ++ nu;
16 | strip(line);
17 | switch(line[0]){
18 | case '\0':
19 | case '#':
20 | case ';':
21 | free(line);
22 | break;
23 | default:
24 | if(!read_option(line, options)){
25 | fprintf(stderr, "Config file error line %d, could parse: %s\n", nu, line);
26 | free(line);
27 | }
28 | break;
29 | }
30 | }
31 | fclose(file);
32 | return options;
33 | }
34 |
35 | metadata get_metadata(char *file)
36 | {
37 | metadata m = {0};
38 | list *options = read_data_cfg(file);
39 |
40 | char *name_list = option_find_str(options, "names", 0);
41 | if(!name_list) name_list = option_find_str(options, "labels", 0);
42 | if(!name_list) {
43 | fprintf(stderr, "No names or labels found\n");
44 | } else {
45 | m.names = get_labels(name_list);
46 | }
47 | m.classes = option_find_int(options, "classes", 2);
48 | free_list(options);
49 | return m;
50 | }
51 |
52 | int read_option(char *s, list *options)
53 | {
54 | size_t i;
55 | size_t len = strlen(s);
56 | char *val = 0;
57 | for(i = 0; i < len; ++i){
58 | if(s[i] == '='){
59 | s[i] = '\0';
60 | val = s+i+1;
61 | break;
62 | }
63 | }
64 | if(i == len-1) return 0;
65 | char *key = s;
66 | option_insert(options, key, val);
67 | return 1;
68 | }
69 |
70 | void option_insert(list *l, char *key, char *val)
71 | {
72 | kvp *p = malloc(sizeof(kvp));
73 | p->key = key;
74 | p->val = val;
75 | p->used = 0;
76 | list_insert(l, p);
77 | }
78 |
79 | void option_unused(list *l)
80 | {
81 | node *n = l->front;
82 | while(n){
83 | kvp *p = (kvp *)n->val;
84 | if(!p->used){
85 | fprintf(stderr, "Unused field: '%s = %s'\n", p->key, p->val);
86 | }
87 | n = n->next;
88 | }
89 | }
90 |
91 | char *option_find(list *l, char *key)
92 | {
93 | node *n = l->front;
94 | while(n){
95 | kvp *p = (kvp *)n->val;
96 | if(strcmp(p->key, key) == 0){
97 | p->used = 1;
98 | return p->val;
99 | }
100 | n = n->next;
101 | }
102 | return 0;
103 | }
104 | char *option_find_str(list *l, char *key, char *def)
105 | {
106 | char *v = option_find(l, key);
107 | if(v) return v;
108 | if(def) fprintf(stderr, "%s: Using default '%s'\n", key, def);
109 | return def;
110 | }
111 |
112 | int option_find_int(list *l, char *key, int def)
113 | {
114 | char *v = option_find(l, key);
115 | if(v) return atoi(v);
116 | fprintf(stderr, "%s: Using default '%d'\n", key, def);
117 | return def;
118 | }
119 |
120 | int option_find_int_quiet(list *l, char *key, int def)
121 | {
122 | char *v = option_find(l, key);
123 | if(v) return atoi(v);
124 | return def;
125 | }
126 |
127 | float option_find_float_quiet(list *l, char *key, float def)
128 | {
129 | char *v = option_find(l, key);
130 | if(v) return atof(v);
131 | return def;
132 | }
133 |
134 | float option_find_float(list *l, char *key, float def)
135 | {
136 | char *v = option_find(l, key);
137 | if(v) return atof(v);
138 | fprintf(stderr, "%s: Using default '%lf'\n", key, def);
139 | return def;
140 | }
141 |
--------------------------------------------------------------------------------
/darknet_ros_old/darknet/src/option_list.h:
--------------------------------------------------------------------------------
1 | #ifndef OPTION_LIST_H
2 | #define OPTION_LIST_H
3 | #include "list.h"
4 |
5 | typedef struct{
6 | char *key;
7 | char *val;
8 | int used;
9 | } kvp;
10 |
11 |
12 | int read_option(char *s, list *options);
13 | void option_insert(list *l, char *key, char *val);
14 | char *option_find(list *l, char *key);
15 | float option_find_float(list *l, char *key, float def);
16 | float option_find_float_quiet(list *l, char *key, float def);
17 | void option_unused(list *l);
18 |
19 | #endif
20 |
--------------------------------------------------------------------------------
/darknet_ros_old/darknet/src/parser.h:
--------------------------------------------------------------------------------
1 | #ifndef PARSER_H
2 | #define PARSER_H
3 | #include "darknet.h"
4 | #include "network.h"
5 |
6 | void save_network(network net, char *filename);
7 | void save_weights_double(network net, char *filename);
8 |
9 | #endif
10 |
--------------------------------------------------------------------------------
/darknet_ros_old/darknet/src/region_layer.h:
--------------------------------------------------------------------------------
1 | #ifndef REGION_LAYER_H
2 | #define REGION_LAYER_H
3 |
4 | #include "darknet.h"
5 | #include "layer.h"
6 | #include "network.h"
7 |
8 | layer make_region_layer(int batch, int w, int h, int n, int classes, int coords);
9 | void forward_region_layer(const layer l, network net);
10 | void backward_region_layer(const layer l, network net);
11 | void resize_region_layer(layer *l, int w, int h);
12 |
13 | #ifdef GPU
14 | void forward_region_layer_gpu(const layer l, network net);
15 | void backward_region_layer_gpu(layer l, network net);
16 | #endif
17 |
18 | #endif
19 |
--------------------------------------------------------------------------------
/darknet_ros_old/darknet/src/reorg_layer.h:
--------------------------------------------------------------------------------
1 | #ifndef REORG_LAYER_H
2 | #define REORG_LAYER_H
3 |
4 | #include "image.h"
5 | #include "cuda.h"
6 | #include "layer.h"
7 | #include "network.h"
8 |
9 | layer make_reorg_layer(int batch, int w, int h, int c, int stride, int reverse, int flatten, int extra);
10 | void resize_reorg_layer(layer *l, int w, int h);
11 | void forward_reorg_layer(const layer l, network net);
12 | void backward_reorg_layer(const layer l, network net);
13 |
14 | #ifdef GPU
15 | void forward_reorg_layer_gpu(layer l, network net);
16 | void backward_reorg_layer_gpu(layer l, network net);
17 | #endif
18 |
19 | #endif
20 |
21 |
--------------------------------------------------------------------------------
/darknet_ros_old/darknet/src/rnn_layer.h:
--------------------------------------------------------------------------------
1 |
2 | #ifndef RNN_LAYER_H
3 | #define RNN_LAYER_H
4 |
5 | #include "activations.h"
6 | #include "layer.h"
7 | #include "network.h"
8 | #define USET
9 |
10 | layer make_rnn_layer(int batch, int inputs, int outputs, int steps, ACTIVATION activation, int batch_normalize, int adam);
11 |
12 | void forward_rnn_layer(layer l, network net);
13 | void backward_rnn_layer(layer l, network net);
14 | void update_rnn_layer(layer l, update_args a);
15 |
16 | #ifdef GPU
17 | void forward_rnn_layer_gpu(layer l, network net);
18 | void backward_rnn_layer_gpu(layer l, network net);
19 | void update_rnn_layer_gpu(layer l, update_args a);
20 | void push_rnn_layer(layer l);
21 | void pull_rnn_layer(layer l);
22 | #endif
23 |
24 | #endif
25 |
26 |
--------------------------------------------------------------------------------
/darknet_ros_old/darknet/src/route_layer.h:
--------------------------------------------------------------------------------
1 | #ifndef ROUTE_LAYER_H
2 | #define ROUTE_LAYER_H
3 | #include "network.h"
4 | #include "layer.h"
5 |
6 | typedef layer route_layer;
7 |
8 | route_layer make_route_layer(int batch, int n, int *input_layers, int *input_size);
9 | void forward_route_layer(const route_layer l, network net);
10 | void backward_route_layer(const route_layer l, network net);
11 | void resize_route_layer(route_layer *l, network *net);
12 |
13 | #ifdef GPU
14 | void forward_route_layer_gpu(const route_layer l, network net);
15 | void backward_route_layer_gpu(const route_layer l, network net);
16 | #endif
17 |
18 | #endif
19 |
--------------------------------------------------------------------------------
/darknet_ros_old/darknet/src/shortcut_layer.c:
--------------------------------------------------------------------------------
1 | #include "shortcut_layer.h"
2 | #include "cuda.h"
3 | #include "blas.h"
4 | #include "activations.h"
5 |
6 | #include
7 | #include
8 |
9 | layer make_shortcut_layer(int batch, int index, int w, int h, int c, int w2, int h2, int c2)
10 | {
11 | fprintf(stderr, "res %3d %4d x%4d x%4d -> %4d x%4d x%4d\n",index, w2,h2,c2, w,h,c);
12 | layer l = {0};
13 | l.type = SHORTCUT;
14 | l.batch = batch;
15 | l.w = w2;
16 | l.h = h2;
17 | l.c = c2;
18 | l.out_w = w;
19 | l.out_h = h;
20 | l.out_c = c;
21 | l.outputs = w*h*c;
22 | l.inputs = l.outputs;
23 |
24 | l.index = index;
25 |
26 | l.delta = calloc(l.outputs*batch, sizeof(float));
27 | l.output = calloc(l.outputs*batch, sizeof(float));;
28 |
29 | l.forward = forward_shortcut_layer;
30 | l.backward = backward_shortcut_layer;
31 | #ifdef GPU
32 | l.forward_gpu = forward_shortcut_layer_gpu;
33 | l.backward_gpu = backward_shortcut_layer_gpu;
34 |
35 | l.delta_gpu = cuda_make_array(l.delta, l.outputs*batch);
36 | l.output_gpu = cuda_make_array(l.output, l.outputs*batch);
37 | #endif
38 | return l;
39 | }
40 |
41 | void resize_shortcut_layer(layer *l, int w, int h)
42 | {
43 | assert(l->w == l->out_w);
44 | assert(l->h == l->out_h);
45 | l->w = l->out_w = w;
46 | l->h = l->out_h = h;
47 | l->outputs = w*h*l->out_c;
48 | l->inputs = l->outputs;
49 | l->delta = realloc(l->delta, l->outputs*l->batch*sizeof(float));
50 | l->output = realloc(l->output, l->outputs*l->batch*sizeof(float));
51 |
52 | #ifdef GPU
53 | cuda_free(l->output_gpu);
54 | cuda_free(l->delta_gpu);
55 | l->output_gpu = cuda_make_array(l->output, l->outputs*l->batch);
56 | l->delta_gpu = cuda_make_array(l->delta, l->outputs*l->batch);
57 | #endif
58 |
59 | }
60 |
61 |
62 | void forward_shortcut_layer(const layer l, network net)
63 | {
64 | copy_cpu(l.outputs*l.batch, net.input, 1, l.output, 1);
65 | shortcut_cpu(l.batch, l.w, l.h, l.c, net.layers[l.index].output, l.out_w, l.out_h, l.out_c, l.alpha, l.beta, l.output);
66 | activate_array(l.output, l.outputs*l.batch, l.activation);
67 | }
68 |
69 | void backward_shortcut_layer(const layer l, network net)
70 | {
71 | gradient_array(l.output, l.outputs*l.batch, l.activation, l.delta);
72 | axpy_cpu(l.outputs*l.batch, l.alpha, l.delta, 1, net.delta, 1);
73 | shortcut_cpu(l.batch, l.out_w, l.out_h, l.out_c, l.delta, l.w, l.h, l.c, 1, l.beta, net.layers[l.index].delta);
74 | }
75 |
76 | #ifdef GPU
77 | void forward_shortcut_layer_gpu(const layer l, network net)
78 | {
79 | copy_gpu(l.outputs*l.batch, net.input_gpu, 1, l.output_gpu, 1);
80 | shortcut_gpu(l.batch, l.w, l.h, l.c, net.layers[l.index].output_gpu, l.out_w, l.out_h, l.out_c, l.alpha, l.beta, l.output_gpu);
81 | activate_array_gpu(l.output_gpu, l.outputs*l.batch, l.activation);
82 | }
83 |
84 | void backward_shortcut_layer_gpu(const layer l, network net)
85 | {
86 | gradient_array_gpu(l.output_gpu, l.outputs*l.batch, l.activation, l.delta_gpu);
87 | axpy_gpu(l.outputs*l.batch, l.alpha, l.delta_gpu, 1, net.delta_gpu, 1);
88 | shortcut_gpu(l.batch, l.out_w, l.out_h, l.out_c, l.delta_gpu, l.w, l.h, l.c, 1, l.beta, net.layers[l.index].delta_gpu);
89 | }
90 | #endif
91 |
--------------------------------------------------------------------------------
/darknet_ros_old/darknet/src/shortcut_layer.h:
--------------------------------------------------------------------------------
1 | #ifndef SHORTCUT_LAYER_H
2 | #define SHORTCUT_LAYER_H
3 |
4 | #include "layer.h"
5 | #include "network.h"
6 |
7 | layer make_shortcut_layer(int batch, int index, int w, int h, int c, int w2, int h2, int c2);
8 | void forward_shortcut_layer(const layer l, network net);
9 | void backward_shortcut_layer(const layer l, network net);
10 | void resize_shortcut_layer(layer *l, int w, int h);
11 |
12 | #ifdef GPU
13 | void forward_shortcut_layer_gpu(const layer l, network net);
14 | void backward_shortcut_layer_gpu(const layer l, network net);
15 | #endif
16 |
17 | #endif
18 |
--------------------------------------------------------------------------------
/darknet_ros_old/darknet/src/softmax_layer.h:
--------------------------------------------------------------------------------
1 | #ifndef SOFTMAX_LAYER_H
2 | #define SOFTMAX_LAYER_H
3 | #include "layer.h"
4 | #include "network.h"
5 |
6 | typedef layer softmax_layer;
7 |
8 | void softmax_array(float *input, int n, float temp, float *output);
9 | softmax_layer make_softmax_layer(int batch, int inputs, int groups);
10 | void forward_softmax_layer(const softmax_layer l, network net);
11 | void backward_softmax_layer(const softmax_layer l, network net);
12 |
13 | #ifdef GPU
14 | void pull_softmax_layer_output(const softmax_layer l);
15 | void forward_softmax_layer_gpu(const softmax_layer l, network net);
16 | void backward_softmax_layer_gpu(const softmax_layer l, network net);
17 | #endif
18 |
19 | #endif
20 |
--------------------------------------------------------------------------------
/darknet_ros_old/darknet/src/tree.h:
--------------------------------------------------------------------------------
1 | #ifndef TREE_H
2 | #define TREE_H
3 | #include "darknet.h"
4 |
5 | int hierarchy_top_prediction(float *predictions, tree *hier, float thresh, int stride);
6 | float get_hierarchy_probability(float *x, tree *hier, int c, int stride);
7 |
8 | #endif
9 |
--------------------------------------------------------------------------------
/darknet_ros_old/darknet/src/upsample_layer.c:
--------------------------------------------------------------------------------
1 | #include "upsample_layer.h"
2 | #include "cuda.h"
3 | #include "blas.h"
4 |
5 | #include
6 |
7 | layer make_upsample_layer(int batch, int w, int h, int c, int stride)
8 | {
9 | layer l = {0};
10 | l.type = UPSAMPLE;
11 | l.batch = batch;
12 | l.w = w;
13 | l.h = h;
14 | l.c = c;
15 | l.out_w = w*stride;
16 | l.out_h = h*stride;
17 | l.out_c = c;
18 | if(stride < 0){
19 | stride = -stride;
20 | l.reverse=1;
21 | l.out_w = w/stride;
22 | l.out_h = h/stride;
23 | }
24 | l.stride = stride;
25 | l.outputs = l.out_w*l.out_h*l.out_c;
26 | l.inputs = l.w*l.h*l.c;
27 | l.delta = calloc(l.outputs*batch, sizeof(float));
28 | l.output = calloc(l.outputs*batch, sizeof(float));;
29 |
30 | l.forward = forward_upsample_layer;
31 | l.backward = backward_upsample_layer;
32 | #ifdef GPU
33 | l.forward_gpu = forward_upsample_layer_gpu;
34 | l.backward_gpu = backward_upsample_layer_gpu;
35 |
36 | l.delta_gpu = cuda_make_array(l.delta, l.outputs*batch);
37 | l.output_gpu = cuda_make_array(l.output, l.outputs*batch);
38 | #endif
39 | if(l.reverse) fprintf(stderr, "downsample %2dx %4d x%4d x%4d -> %4d x%4d x%4d\n", stride, w, h, c, l.out_w, l.out_h, l.out_c);
40 | else fprintf(stderr, "upsample %2dx %4d x%4d x%4d -> %4d x%4d x%4d\n", stride, w, h, c, l.out_w, l.out_h, l.out_c);
41 | return l;
42 | }
43 |
44 | void resize_upsample_layer(layer *l, int w, int h)
45 | {
46 | l->w = w;
47 | l->h = h;
48 | l->out_w = w*l->stride;
49 | l->out_h = h*l->stride;
50 | if(l->reverse){
51 | l->out_w = w/l->stride;
52 | l->out_h = h/l->stride;
53 | }
54 | l->outputs = l->out_w*l->out_h*l->out_c;
55 | l->inputs = l->h*l->w*l->c;
56 | l->delta = realloc(l->delta, l->outputs*l->batch*sizeof(float));
57 | l->output = realloc(l->output, l->outputs*l->batch*sizeof(float));
58 |
59 | #ifdef GPU
60 | cuda_free(l->output_gpu);
61 | cuda_free(l->delta_gpu);
62 | l->output_gpu = cuda_make_array(l->output, l->outputs*l->batch);
63 | l->delta_gpu = cuda_make_array(l->delta, l->outputs*l->batch);
64 | #endif
65 |
66 | }
67 |
68 | void forward_upsample_layer(const layer l, network net)
69 | {
70 | fill_cpu(l.outputs*l.batch, 0, l.output, 1);
71 | if(l.reverse){
72 | upsample_cpu(l.output, l.out_w, l.out_h, l.c, l.batch, l.stride, 0, l.scale, net.input);
73 | }else{
74 | upsample_cpu(net.input, l.w, l.h, l.c, l.batch, l.stride, 1, l.scale, l.output);
75 | }
76 | }
77 |
78 | void backward_upsample_layer(const layer l, network net)
79 | {
80 | if(l.reverse){
81 | upsample_cpu(l.delta, l.out_w, l.out_h, l.c, l.batch, l.stride, 1, l.scale, net.delta);
82 | }else{
83 | upsample_cpu(net.delta, l.w, l.h, l.c, l.batch, l.stride, 0, l.scale, l.delta);
84 | }
85 | }
86 |
87 | #ifdef GPU
88 | void forward_upsample_layer_gpu(const layer l, network net)
89 | {
90 | fill_gpu(l.outputs*l.batch, 0, l.output_gpu, 1);
91 | if(l.reverse){
92 | upsample_gpu(l.output_gpu, l.out_w, l.out_h, l.c, l.batch, l.stride, 0, l.scale, net.input_gpu);
93 | }else{
94 | upsample_gpu(net.input_gpu, l.w, l.h, l.c, l.batch, l.stride, 1, l.scale, l.output_gpu);
95 | }
96 | }
97 |
98 | void backward_upsample_layer_gpu(const layer l, network net)
99 | {
100 | if(l.reverse){
101 | upsample_gpu(l.delta_gpu, l.out_w, l.out_h, l.c, l.batch, l.stride, 1, l.scale, net.delta_gpu);
102 | }else{
103 | upsample_gpu(net.delta_gpu, l.w, l.h, l.c, l.batch, l.stride, 0, l.scale, l.delta_gpu);
104 | }
105 | }
106 | #endif
107 |
--------------------------------------------------------------------------------
/darknet_ros_old/darknet/src/upsample_layer.h:
--------------------------------------------------------------------------------
1 | #ifndef UPSAMPLE_LAYER_H
2 | #define UPSAMPLE_LAYER_H
3 | #include "darknet.h"
4 |
5 | layer make_upsample_layer(int batch, int w, int h, int c, int stride);
6 | void forward_upsample_layer(const layer l, network net);
7 | void backward_upsample_layer(const layer l, network net);
8 | void resize_upsample_layer(layer *l, int w, int h);
9 |
10 | #ifdef GPU
11 | void forward_upsample_layer_gpu(const layer l, network net);
12 | void backward_upsample_layer_gpu(const layer l, network net);
13 | #endif
14 |
15 | #endif
16 |
--------------------------------------------------------------------------------
/darknet_ros_old/darknet/src/utils.h:
--------------------------------------------------------------------------------
1 | #ifndef UTILS_H
2 | #define UTILS_H
3 | #include
4 | #include
5 | #include "darknet.h"
6 | #include "list.h"
7 |
8 | #define TIME(a) \
9 | do { \
10 | double start = what_time_is_it_now(); \
11 | a; \
12 | printf("%s took: %f seconds\n", #a, what_time_is_it_now() - start); \
13 | } while (0)
14 |
15 | #define TWO_PI 6.2831853071795864769252866f
16 |
17 | double what_time_is_it_now();
18 | void shuffle(void *arr, size_t n, size_t size);
19 | void sorta_shuffle(void *arr, size_t n, size_t size, size_t sections);
20 | void free_ptrs(void **ptrs, int n);
21 | int alphanum_to_int(char c);
22 | char int_to_alphanum(int i);
23 | int read_int(int fd);
24 | void write_int(int fd, int n);
25 | void read_all(int fd, char *buffer, size_t bytes);
26 | void write_all(int fd, char *buffer, size_t bytes);
27 | int read_all_fail(int fd, char *buffer, size_t bytes);
28 | int write_all_fail(int fd, char *buffer, size_t bytes);
29 | void find_replace(char *str, char *orig, char *rep, char *output);
30 | void malloc_error();
31 | void file_error(char *s);
32 | void strip(char *s);
33 | void strip_char(char *s, char bad);
34 | list *split_str(char *s, char delim);
35 | char *fgetl(FILE *fp);
36 | list *parse_csv_line(char *line);
37 | char *copy_string(char *s);
38 | int count_fields(char *line);
39 | float *parse_fields(char *line, int n);
40 | void translate_array(float *a, int n, float s);
41 | float constrain(float min, float max, float a);
42 | int constrain_int(int a, int min, int max);
43 | float rand_scale(float s);
44 | int rand_int(int min, int max);
45 | void mean_arrays(float **a, int n, int els, float *avg);
46 | float dist_array(float *a, float *b, int n, int sub);
47 | float **one_hot_encode(float *a, int n, int k);
48 | float sec(clock_t clocks);
49 | void print_statistics(float *a, int n);
50 | int int_index(int *a, int val, int n);
51 |
52 | #endif
53 |
54 |
--------------------------------------------------------------------------------
/darknet_ros_old/darknet/src/yolo_layer.h:
--------------------------------------------------------------------------------
1 | #ifndef YOLO_LAYER_H
2 | #define YOLO_LAYER_H
3 |
4 | #include "darknet.h"
5 | #include "layer.h"
6 | #include "network.h"
7 |
8 | layer make_yolo_layer(int batch, int w, int h, int n, int total, int *mask, int classes);
9 | void forward_yolo_layer(const layer l, network net);
10 | void backward_yolo_layer(const layer l, network net);
11 | void resize_yolo_layer(layer *l, int w, int h);
12 | int yolo_num_detections(layer l, float thresh);
13 |
14 | #ifdef GPU
15 | void forward_yolo_layer_gpu(const layer l, network net);
16 | void backward_yolo_layer_gpu(layer l, network net);
17 | #endif
18 |
19 | #endif
20 |
--------------------------------------------------------------------------------
/darknet_ros_old/darknet_ros/CHANGELOG.rst:
--------------------------------------------------------------------------------
1 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2 | Changelog for package darknet_ros
3 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
4 |
5 | 1.1.3 (2018-04-26)
6 | ------------------
7 | * Fixed iteration through detection boxes.
8 | * Merge pull request `#80 `_ from leggedrobotics/feature/yolo3
9 | Feature/yolo3
10 | * Fixed publishers.
11 | * Applied first changes for yolo v3.
12 | * Updated darknet and added launch files for yolov3.
13 | * Merge pull request `#73 `_ from leggedrobotics/fix/weights
14 | Fix/weights
15 | * Fixed weights.
16 | * Fix test.
17 | * Fixed formatting part 2.
18 | * Fixed naming.
19 | * Merge branch 'firephinx-master'
20 | * Merge branch 'master' of https://github.com/firephinx/darknet_ros into firephinx-master
21 | * Merge pull request `#62 `_ from warp1337/master
22 | Reduced window size to reasonable values
23 | * Reduced window size to reasonable values
24 | * Added rgb_image_header to BoundingBoxes msg.
25 | * Updated to the latest darknet version.
26 | * Merge pull request `#57 `_ from leggedrobotics/devel/threads
27 | Devel/threads
28 | * Rearranged.
29 | * Fixed action with new threads.
30 | * Adapted package description.
31 | * Added publisher.
32 | * Merge branch 'master' into devel/threads
33 | * Rearranged code.
34 | * Update package.xml
35 | * Fixed image_view if x11 is not running.
36 | * COmment runYolo().
37 | * Update object_detector_demo.cpp
38 | * Changed ros config.
39 | * Node is shutting down properly.
40 | * Rearranged code and added threads.
41 | * Contributors: Kevin Zhang, Marko Bjelonic, fl
42 |
43 | 1.1.2 (2018-01-06)
44 | ------------------
45 | * First release of darknet_ros.
46 |
--------------------------------------------------------------------------------
/darknet_ros_old/darknet_ros/config/ros.yaml:
--------------------------------------------------------------------------------
1 | subscribers:
2 | #/ROIpicture /kitti_player/color/left/image_rect
3 | camera_reading:
4 | topic: /kitti_player/color/left/image_rect
5 | queue_size: 1
6 |
7 | actions:
8 |
9 | camera_reading:
10 | name: /darknet_ros/check_for_objects
11 |
12 | publishers:
13 |
14 | object_detector:
15 | topic: /darknet_ros/found_object
16 | queue_size: 1
17 | latch: false
18 |
19 | bounding_boxes:
20 | topic: /darknet_ros/bounding_boxes
21 | queue_size: 1
22 | latch: false
23 |
24 | detection_image:
25 | topic: /darknet_ros/detection_image
26 | queue_size: 1
27 | latch: true
28 |
29 | image_view:
30 |
31 | enable_opencv: true
32 | wait_key_delay: 1
33 | enable_console_output: true
34 |
--------------------------------------------------------------------------------
/darknet_ros_old/darknet_ros/config/yolov2-tiny-voc.yaml:
--------------------------------------------------------------------------------
1 | yolo_model:
2 |
3 | config_file:
4 | name: yolov2-tiny-voc.cfg
5 | weight_file:
6 | name: yolov2-tiny-voc.weights
7 | threshold:
8 | value: 0.3
9 | detection_classes:
10 | names:
11 | - aeroplane
12 | - bicycle
13 | - bird
14 | - boat
15 | - bottle
16 | - bus
17 | - car
18 | - cat
19 | - chair
20 | - cow
21 | - diningtable
22 | - dog
23 | - horse
24 | - motorbike
25 | - person
26 | - pottedplant
27 | - sheep
28 | - sofa
29 | - train
30 | - tvmonitor
31 |
--------------------------------------------------------------------------------
/darknet_ros_old/darknet_ros/config/yolov2-tiny.yaml:
--------------------------------------------------------------------------------
1 | yolo_model:
2 |
3 | config_file:
4 | name: yolov2-tiny.cfg
5 | weight_file:
6 | name: yolov2-tiny.weights
7 | threshold:
8 | value: 0.3
9 | detection_classes:
10 | names:
11 | - person
12 | - bicycle
13 | - car
14 | - motorbike
15 | - aeroplane
16 | - bus
17 | - train
18 | - truck
19 | - boat
20 | - traffic light
21 | - fire hydrant
22 | - stop sign
23 | - parking meter
24 | - bench
25 | - bird
26 | - cat
27 | - dog
28 | - horse
29 | - sheep
30 | - cow
31 | - elephant
32 | - bear
33 | - zebra
34 | - giraffe
35 | - backpack
36 | - umbrella
37 | - handbag
38 | - tie
39 | - suitcase
40 | - frisbee
41 | - skis
42 | - snowboard
43 | - sports ball
44 | - kite
45 | - baseball bat
46 | - baseball glove
47 | - skateboard
48 | - surfboard
49 | - tennis racket
50 | - bottle
51 | - wine glass
52 | - cup
53 | - fork
54 | - knife
55 | - spoon
56 | - bowl
57 | - banana
58 | - apple
59 | - sandwich
60 | - orange
61 | - broccoli
62 | - carrot
63 | - hot dog
64 | - pizza
65 | - donut
66 | - cake
67 | - chair
68 | - sofa
69 | - pottedplant
70 | - bed
71 | - diningtable
72 | - toilet
73 | - tvmonitor
74 | - laptop
75 | - mouse
76 | - remote
77 | - keyboard
78 | - cell phone
79 | - microwave
80 | - oven
81 | - toaster
82 | - sink
83 | - refrigerator
84 | - book
85 | - clock
86 | - vase
87 | - scissors
88 | - teddy bear
89 | - hair drier
90 | - toothbrush
91 |
--------------------------------------------------------------------------------
/darknet_ros_old/darknet_ros/config/yolov2-voc.yaml:
--------------------------------------------------------------------------------
1 | yolo_model:
2 |
3 | config_file:
4 | name: yolov2-voc.cfg
5 | weight_file:
6 | name: yolov2-voc.weights
7 | threshold:
8 | value: 0.3
9 | detection_classes:
10 | names:
11 | - aeroplane
12 | - bicycle
13 | - bird
14 | - boat
15 | - bottle
16 | - bus
17 | - car
18 | - cat
19 | - chair
20 | - cow
21 | - diningtable
22 | - dog
23 | - horse
24 | - motorbike
25 | - person
26 | - pottedplant
27 | - sheep
28 | - sofa
29 | - train
30 | - tvmonitor
31 |
--------------------------------------------------------------------------------
/darknet_ros_old/darknet_ros/config/yolov2.yaml:
--------------------------------------------------------------------------------
1 | yolo_model:
2 |
3 | config_file:
4 | name: yolov2.cfg
5 | weight_file:
6 | name: yolov2.weights
7 | threshold:
8 | value: 0.3
9 | detection_classes:
10 | names:
11 | - person
12 | - bicycle
13 | - car
14 | - motorbike
15 | - aeroplane
16 | - bus
17 | - train
18 | - truck
19 | - boat
20 | - traffic light
21 | - fire hydrant
22 | - stop sign
23 | - parking meter
24 | - bench
25 | - bird
26 | - cat
27 | - dog
28 | - horse
29 | - sheep
30 | - cow
31 | - elephant
32 | - bear
33 | - zebra
34 | - giraffe
35 | - backpack
36 | - umbrella
37 | - handbag
38 | - tie
39 | - suitcase
40 | - frisbee
41 | - skis
42 | - snowboard
43 | - sports ball
44 | - kite
45 | - baseball bat
46 | - baseball glove
47 | - skateboard
48 | - surfboard
49 | - tennis racket
50 | - bottle
51 | - wine glass
52 | - cup
53 | - fork
54 | - knife
55 | - spoon
56 | - bowl
57 | - banana
58 | - apple
59 | - sandwich
60 | - orange
61 | - broccoli
62 | - carrot
63 | - hot dog
64 | - pizza
65 | - donut
66 | - cake
67 | - chair
68 | - sofa
69 | - pottedplant
70 | - bed
71 | - diningtable
72 | - toilet
73 | - tvmonitor
74 | - laptop
75 | - mouse
76 | - remote
77 | - keyboard
78 | - cell phone
79 | - microwave
80 | - oven
81 | - toaster
82 | - sink
83 | - refrigerator
84 | - book
85 | - clock
86 | - vase
87 | - scissors
88 | - teddy bear
89 | - hair drier
90 | - toothbrush
91 |
--------------------------------------------------------------------------------
/darknet_ros_old/darknet_ros/config/yolov3-voc.yaml:
--------------------------------------------------------------------------------
1 | yolo_model:
2 |
3 | config_file:
4 | name: yolov3-voc.cfg
5 | weight_file:
6 | name: yolov3-voc.weights
7 | threshold:
8 | value: 0.3
9 | detection_classes:
10 | names:
11 | - aeroplane
12 | - bicycle
13 | - bird
14 | - boat
15 | - bottle
16 | - bus
17 | - car
18 | - cat
19 | - chair
20 | - cow
21 | - diningtable
22 | - dog
23 | - horse
24 | - motorbike
25 | - person
26 | - pottedplant
27 | - sheep
28 | - sofa
29 | - train
30 | - tvmonitor
31 |
--------------------------------------------------------------------------------
/darknet_ros_old/darknet_ros/config/yolov3.yaml:
--------------------------------------------------------------------------------
1 | yolo_model:
2 |
3 | config_file:
4 | name: yolov3.cfg
5 | weight_file:
6 | name: yolov3.weights
7 | threshold:
8 | value: 0.4
9 | detection_classes:
10 | names:
11 | - person
12 | - bicycle
13 | - car
14 | - motorbike
15 | - aeroplane
16 | - bus
17 | - train
18 | - truck
19 |
--------------------------------------------------------------------------------
/darknet_ros_old/darknet_ros/doc/quadruped_anymal_and_person.JPG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LiuFG/Camera-Lidar-Fusion-ROS/27341783f19b1e5d7e513879f21e6928a926cbff/darknet_ros_old/darknet_ros/doc/quadruped_anymal_and_person.JPG
--------------------------------------------------------------------------------
/darknet_ros_old/darknet_ros/doc/test_detection.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LiuFG/Camera-Lidar-Fusion-ROS/27341783f19b1e5d7e513879f21e6928a926cbff/darknet_ros_old/darknet_ros/doc/test_detection.png
--------------------------------------------------------------------------------
/darknet_ros_old/darknet_ros/doc/test_detection_anymal.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LiuFG/Camera-Lidar-Fusion-ROS/27341783f19b1e5d7e513879f21e6928a926cbff/darknet_ros_old/darknet_ros/doc/test_detection_anymal.png
--------------------------------------------------------------------------------
/darknet_ros_old/darknet_ros/include/darknet_ros/image_interface.h:
--------------------------------------------------------------------------------
1 | /*
2 | * image_interface.h
3 | *
4 | * Created on: Dec 19, 2016
5 | * Author: Marko Bjelonic
6 | * Institute: ETH Zurich, Robotic Systems Lab
7 | */
8 |
9 | #ifndef IMAGE_INTERFACE_H
10 | #define IMAGE_INTERFACE_H
11 |
12 | #include "image.h"
13 |
14 | image **load_alphabet_with_file(char *datafile);
15 |
16 | #endif
17 |
--------------------------------------------------------------------------------
/darknet_ros_old/darknet_ros/launch/darknet_ros.launch:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
--------------------------------------------------------------------------------
/darknet_ros_old/darknet_ros/launch/darknet_ros_gdb.launch:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/darknet_ros_old/darknet_ros/launch/yolo_v3.launch:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
--------------------------------------------------------------------------------
/darknet_ros_old/darknet_ros/package.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | darknet_ros
4 | 1.1.3
5 | Darknet is an open source neural network framework that runs on CPU and GPU. You only look once (YOLO) is a state-of-the-art, real-time object detection system.
6 | Marko Bjelonic
7 | BSD
8 | https://github.com/leggedrobotics/darknet_ros
9 | Marko Bjelonic
10 |
11 | catkin
12 | boost
13 |
14 | roscpp
15 | rospy
16 | std_msgs
17 | image_transport
18 | cv_bridge
19 | sensor_msgs
20 | message_generation
21 | darknet_ros_msgs
22 | actionlib
23 |
24 |
25 | rostest
26 |
27 |
--------------------------------------------------------------------------------
/darknet_ros_old/darknet_ros/src/image_interface.c:
--------------------------------------------------------------------------------
1 | /*
2 | * image_interface.c
3 | *
4 | * Created on: Dec 19, 2016
5 | * Author: Marko Bjelonic
6 | * Institute: ETH Zurich, Robotic Systems Lab
7 | */
8 |
9 | #include "darknet_ros/image_interface.h"
10 |
11 | image **load_alphabet_with_file(char *datafile) {
12 | int i, j;
13 | const int nsize = 8;
14 | image **alphabets = calloc(nsize, sizeof(image));
15 | char* labels = "/labels/%d_%d.png";
16 | char * files = (char *) malloc(1 + strlen(datafile)+ strlen(labels) );
17 | strcpy(files, datafile);
18 | strcat(files, labels);
19 | for(j = 0; j < nsize; ++j){
20 | alphabets[j] = calloc(128, sizeof(image));
21 | for(i = 32; i < 127; ++i){
22 | char buff[256];
23 | sprintf(buff, files, i, j);
24 | alphabets[j][i] = load_image_color(buff, 0, 0);
25 | }
26 | }
27 | return alphabets;
28 | }
29 |
--------------------------------------------------------------------------------
/darknet_ros_old/darknet_ros/src/yolo_object_detector_node.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | * yolo_obstacle_detector_node.cpp
3 | *
4 | * Created on: Dec 19, 2016
5 | * Author: Marko Bjelonic
6 | * Institute: ETH Zurich, Robotic Systems Lab
7 | */
8 |
9 | #include
10 | #include
11 |
12 | int main(int argc, char** argv) {
13 | ros::init(argc, argv, "darknet_ros");
14 | ros::NodeHandle nodeHandle("~");
15 | darknet_ros::YoloObjectDetector yoloObjectDetector(nodeHandle);
16 |
17 | ros::spin();
18 | return 0;
19 | }
20 |
--------------------------------------------------------------------------------
/darknet_ros_old/darknet_ros/test/object_detection.test:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/darknet_ros_old/darknet_ros/test/test_main.cpp:
--------------------------------------------------------------------------------
1 | #include
2 |
3 | // ROS
4 | #include
5 |
6 | int main(int argc, char** argv) {
7 | ros::init(argc, argv, "darknet_ros_test");
8 | testing::InitGoogleTest(&argc, argv);
9 | return RUN_ALL_TESTS();
10 | }
11 |
--------------------------------------------------------------------------------
/darknet_ros_old/darknet_ros/test/yolov2.yaml:
--------------------------------------------------------------------------------
1 | image_view:
2 |
3 | enable_opencv: true
4 | wait_key_delay: 600
5 |
6 | yolo_model:
7 |
8 | config_file:
9 | name: yolov2.cfg
10 | weight_file:
11 | name: yolov2.weights
12 | threshold:
13 | value: 0.5
14 | detection_classes:
15 | names:
16 | - person
17 | - bicycle
18 | - car
19 | - motorbike
20 | - aeroplane
21 | - bus
22 | - train
23 | - truck
24 | - boat
25 | - traffic light
26 | - fire hydrant
27 | - stop sign
28 | - parking meter
29 | - bench
30 | - bird
31 | - cat
32 | - dog
33 | - horse
34 | - sheep
35 | - cow
36 | - elephant
37 | - bear
38 | - zebra
39 | - giraffe
40 | - backpack
41 | - umbrella
42 | - handbag
43 | - tie
44 | - suitcase
45 | - frisbee
46 | - skis
47 | - snowboard
48 | - sports ball
49 | - kite
50 | - baseball bat
51 | - baseball glove
52 | - skateboard
53 | - surfboard
54 | - tennis racket
55 | - bottle
56 | - wine glass
57 | - cup
58 | - fork
59 | - knife
60 | - spoon
61 | - bowl
62 | - banana
63 | - apple
64 | - sandwich
65 | - orange
66 | - broccoli
67 | - carrot
68 | - hot dog
69 | - pizza
70 | - donut
71 | - cake
72 | - chair
73 | - sofa
74 | - pottedplant
75 | - bed
76 | - diningtable
77 | - toilet
78 | - tvmonitor
79 | - laptop
80 | - mouse
81 | - remote
82 | - keyboard
83 | - cell phone
84 | - microwave
85 | - oven
86 | - toaster
87 | - sink
88 | - refrigerator
89 | - book
90 | - clock
91 | - vase
92 | - scissors
93 | - teddy bear
94 | - hair drier
95 | - toothbrush
96 |
--------------------------------------------------------------------------------
/darknet_ros_old/darknet_ros/yolo_network_config/cfg/yolov2-tiny-voc.cfg:
--------------------------------------------------------------------------------
1 | [net]
2 | # Testing
3 | batch=1
4 | subdivisions=1
5 | # Training
6 | # batch=64
7 | # subdivisions=2
8 | width=416
9 | height=416
10 | channels=3
11 | momentum=0.9
12 | decay=0.0005
13 | angle=0
14 | saturation = 1.5
15 | exposure = 1.5
16 | hue=.1
17 |
18 | learning_rate=0.001
19 | max_batches = 40200
20 | policy=steps
21 | steps=-1,100,20000,30000
22 | scales=.1,10,.1,.1
23 |
24 | [convolutional]
25 | batch_normalize=1
26 | filters=16
27 | size=3
28 | stride=1
29 | pad=1
30 | activation=leaky
31 |
32 | [maxpool]
33 | size=2
34 | stride=2
35 |
36 | [convolutional]
37 | batch_normalize=1
38 | filters=32
39 | size=3
40 | stride=1
41 | pad=1
42 | activation=leaky
43 |
44 | [maxpool]
45 | size=2
46 | stride=2
47 |
48 | [convolutional]
49 | batch_normalize=1
50 | filters=64
51 | size=3
52 | stride=1
53 | pad=1
54 | activation=leaky
55 |
56 | [maxpool]
57 | size=2
58 | stride=2
59 |
60 | [convolutional]
61 | batch_normalize=1
62 | filters=128
63 | size=3
64 | stride=1
65 | pad=1
66 | activation=leaky
67 |
68 | [maxpool]
69 | size=2
70 | stride=2
71 |
72 | [convolutional]
73 | batch_normalize=1
74 | filters=256
75 | size=3
76 | stride=1
77 | pad=1
78 | activation=leaky
79 |
80 | [maxpool]
81 | size=2
82 | stride=2
83 |
84 | [convolutional]
85 | batch_normalize=1
86 | filters=512
87 | size=3
88 | stride=1
89 | pad=1
90 | activation=leaky
91 |
92 | [maxpool]
93 | size=2
94 | stride=1
95 |
96 | [convolutional]
97 | batch_normalize=1
98 | filters=1024
99 | size=3
100 | stride=1
101 | pad=1
102 | activation=leaky
103 |
104 | ###########
105 |
106 | [convolutional]
107 | batch_normalize=1
108 | size=3
109 | stride=1
110 | pad=1
111 | filters=1024
112 | activation=leaky
113 |
114 | [convolutional]
115 | size=1
116 | stride=1
117 | pad=1
118 | filters=125
119 | activation=linear
120 |
121 | [region]
122 | anchors = 1.08,1.19, 3.42,4.41, 6.63,11.38, 9.42,5.11, 16.62,10.52
123 | bias_match=1
124 | classes=20
125 | coords=4
126 | num=5
127 | softmax=1
128 | jitter=.2
129 | rescore=1
130 |
131 | object_scale=5
132 | noobject_scale=1
133 | class_scale=1
134 | coord_scale=1
135 |
136 | absolute=1
137 | thresh = .6
138 | random=1
139 |
--------------------------------------------------------------------------------
/darknet_ros_old/darknet_ros/yolo_network_config/cfg/yolov2-tiny.cfg:
--------------------------------------------------------------------------------
1 | [net]
2 | # Testing
3 | batch=1
4 | subdivisions=1
5 | # Training
6 | # batch=64
7 | # subdivisions=2
8 | width=416
9 | height=416
10 | channels=3
11 | momentum=0.9
12 | decay=0.0005
13 | angle=0
14 | saturation = 1.5
15 | exposure = 1.5
16 | hue=.1
17 |
18 | learning_rate=0.001
19 | burn_in=1000
20 | max_batches = 500200
21 | policy=steps
22 | steps=400000,450000
23 | scales=.1,.1
24 |
25 | [convolutional]
26 | batch_normalize=1
27 | filters=16
28 | size=3
29 | stride=1
30 | pad=1
31 | activation=leaky
32 |
33 | [maxpool]
34 | size=2
35 | stride=2
36 |
37 | [convolutional]
38 | batch_normalize=1
39 | filters=32
40 | size=3
41 | stride=1
42 | pad=1
43 | activation=leaky
44 |
45 | [maxpool]
46 | size=2
47 | stride=2
48 |
49 | [convolutional]
50 | batch_normalize=1
51 | filters=64
52 | size=3
53 | stride=1
54 | pad=1
55 | activation=leaky
56 |
57 | [maxpool]
58 | size=2
59 | stride=2
60 |
61 | [convolutional]
62 | batch_normalize=1
63 | filters=128
64 | size=3
65 | stride=1
66 | pad=1
67 | activation=leaky
68 |
69 | [maxpool]
70 | size=2
71 | stride=2
72 |
73 | [convolutional]
74 | batch_normalize=1
75 | filters=256
76 | size=3
77 | stride=1
78 | pad=1
79 | activation=leaky
80 |
81 | [maxpool]
82 | size=2
83 | stride=2
84 |
85 | [convolutional]
86 | batch_normalize=1
87 | filters=512
88 | size=3
89 | stride=1
90 | pad=1
91 | activation=leaky
92 |
93 | [maxpool]
94 | size=2
95 | stride=1
96 |
97 | [convolutional]
98 | batch_normalize=1
99 | filters=1024
100 | size=3
101 | stride=1
102 | pad=1
103 | activation=leaky
104 |
105 | ###########
106 |
107 | [convolutional]
108 | batch_normalize=1
109 | size=3
110 | stride=1
111 | pad=1
112 | filters=512
113 | activation=leaky
114 |
115 | [convolutional]
116 | size=1
117 | stride=1
118 | pad=1
119 | filters=425
120 | activation=linear
121 |
122 | [region]
123 | anchors = 0.57273, 0.677385, 1.87446, 2.06253, 3.33843, 5.47434, 7.88282, 3.52778, 9.77052, 9.16828
124 | bias_match=1
125 | classes=80
126 | coords=4
127 | num=5
128 | softmax=1
129 | jitter=.2
130 | rescore=0
131 |
132 | object_scale=5
133 | noobject_scale=1
134 | class_scale=1
135 | coord_scale=1
136 |
137 | absolute=1
138 | thresh = .6
139 | random=1
140 |
--------------------------------------------------------------------------------
/darknet_ros_old/darknet_ros/yolo_network_config/weights/.gitignore:
--------------------------------------------------------------------------------
1 | *.weights
2 |
--------------------------------------------------------------------------------
/darknet_ros_old/darknet_ros/yolo_network_config/weights/how_to_download_weights.txt:
--------------------------------------------------------------------------------
1 | cd catkin_workspace/src/darknet_ros/darknet_ros/yolo_network_config/weights/
2 |
3 | COCO data set (Yolo v2):
4 | wget http://pjreddie.com/media/files/yolov2.weights
5 | wget http://pjreddie.com/media/files/yolov2-tiny.weights
6 |
7 | VOC data set (Yolo v2):
8 | wget http://pjreddie.com/media/files/yolov2-voc.weights
9 | wget http://pjreddie.com/media/files/yolov2-tiny-voc.weights
10 |
11 | Yolo v3:
12 | wget http://pjreddie.com/media/files/yolov3.weights
13 | wget http://pjreddie.com/media/files/yolov3-voc.weights
14 |
--------------------------------------------------------------------------------
/darknet_ros_old/darknet_ros_msgs/CHANGELOG.rst:
--------------------------------------------------------------------------------
1 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2 | Changelog for package darknet_ros_msgs
3 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
4 |
5 | 1.1.3 (2018-04-26)
6 | ------------------
7 | * Fixed formatting part 2.
8 | * Merge branch 'firephinx-master'
9 | * Merge branch 'master' of https://github.com/firephinx/darknet_ros into firephinx-master
10 | * Added rgb_image_header to BoundingBoxes msg.
11 | * Merge pull request `#57 `_ from leggedrobotics/devel/threads
12 | Devel/threads
13 | * Adapted package description.
14 | * Merge branch 'master' into devel/threads
15 | * Update package.xml
16 | * Contributors: Kevin Zhang, Marko Bjelonic
17 |
18 | 1.1.2 (2018-01-06)
19 | ------------------
20 | * First release of darknet_ros_msgs.
21 |
--------------------------------------------------------------------------------
/darknet_ros_old/darknet_ros_msgs/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | cmake_minimum_required(VERSION 2.8.12)
2 |
3 | project(darknet_ros_msgs)
4 |
5 | set(CMAKE_CXX_FLAGS "-std=c++11 ${CMAKE_CXX_FLAGS}")
6 |
7 | find_package(catkin REQUIRED
8 | COMPONENTS
9 | actionlib_msgs
10 | geometry_msgs
11 | sensor_msgs
12 | std_msgs
13 | message_generation
14 | )
15 |
16 | add_message_files(
17 | FILES
18 | BoundingBox.msg
19 | BoundingBoxes.msg
20 | )
21 |
22 | add_action_files(
23 | FILES
24 | CheckForObjects.action
25 | )
26 |
27 | generate_messages(
28 | DEPENDENCIES
29 | actionlib_msgs
30 | geometry_msgs
31 | sensor_msgs
32 | std_msgs
33 | )
34 |
35 | catkin_package(
36 | CATKIN_DEPENDS
37 | actionlib_msgs
38 | geometry_msgs
39 | sensor_msgs
40 | message_runtime
41 | std_msgs
42 | )
43 |
--------------------------------------------------------------------------------
/darknet_ros_old/darknet_ros_msgs/action/CheckForObjects.action:
--------------------------------------------------------------------------------
1 | # Check if objects in image
2 |
3 | # Goal definition
4 | int16 id
5 | sensor_msgs/Image image
6 |
7 | ---
8 | # Result definition
9 | int16 id
10 | darknet_ros_msgs/BoundingBoxes bounding_boxes
11 |
12 | ---
13 | # Feedback definition
14 |
--------------------------------------------------------------------------------
/darknet_ros_old/darknet_ros_msgs/msg/BoundingBox.msg:
--------------------------------------------------------------------------------
1 | string Class
2 | float64 probability
3 | int64 xmin
4 | int64 ymin
5 | int64 xmax
6 | int64 ymax
7 |
8 |
--------------------------------------------------------------------------------
/darknet_ros_old/darknet_ros_msgs/msg/BoundingBoxes.msg:
--------------------------------------------------------------------------------
1 | Header header
2 | Header image_header
3 | BoundingBox[] bounding_boxes
4 |
--------------------------------------------------------------------------------
/darknet_ros_old/darknet_ros_msgs/package.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | darknet_ros_msgs
4 | 1.1.3
5 | Darknet is an open source neural network framework that runs on CPU and GPU. You only look once (YOLO) is a state-of-the-art, real-time object detection system.
6 | Marko Bjelonic
7 | BSD
8 | https://github.com/leggedrobotics/darknet_ros
9 | Marko Bjelonic
10 |
11 | catkin
12 |
13 | actionlib_msgs
14 | geometry_msgs
15 | sensor_msgs
16 | message_generation
17 | std_msgs
18 |
19 | actionlib_msgs
20 | geometry_msgs
21 | sensor_msgs
22 | message_runtime
23 | std_msgs
24 |
25 |
--------------------------------------------------------------------------------
/darknet_ros_old/jenkins-pipeline:
--------------------------------------------------------------------------------
1 | library 'continuous_integration_pipeline'
2 | ciPipeline("")
3 |
--------------------------------------------------------------------------------
/depthGet/msg/BboxL.msg:
--------------------------------------------------------------------------------
1 | float64 minx
2 | float64 miny
3 | float64 maxx
4 | float64 maxy
5 | float64 navi
6 | float64 centerx
7 | float64 centery
8 |
--------------------------------------------------------------------------------
/depthGet/msg/BboxLes.msg:
--------------------------------------------------------------------------------
1 | Header header
2 | Header image_header
3 | BboxL[] bboxl
4 |
--------------------------------------------------------------------------------
/depthGet/msg/BoundingBox.msg:
--------------------------------------------------------------------------------
1 | string Class
2 | float64 probability
3 | int64 xmin
4 | int64 ymin
5 | int64 xmax
6 | int64 ymax
7 |
8 |
--------------------------------------------------------------------------------
/depthGet/msg/BoundingBoxes.msg:
--------------------------------------------------------------------------------
1 | Header header
2 | Header image_header
3 | BoundingBox[] bounding_boxes
4 |
--------------------------------------------------------------------------------
/depthGet/package.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | depthGet
4 | 0.0.0
5 | The depthGet package
6 |
7 |
8 |
9 |
10 | lfg
11 |
12 |
13 |
14 |
15 |
16 | TODO
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 | message_generation
41 |
42 | message_generation
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 | catkin
52 | pcl_conversions
53 | pcl_msgs
54 | pcl_ros
55 | sensor_msgs
56 | pcl_conversions
57 | pcl_msgs
58 | pcl_ros
59 | sensor_msgs
60 | pcl_conversions
61 | pcl_msgs
62 | pcl_ros
63 | sensor_msgs
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
--------------------------------------------------------------------------------
/figure/data.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LiuFG/Camera-Lidar-Fusion-ROS/27341783f19b1e5d7e513879f21e6928a926cbff/figure/data.jpg
--------------------------------------------------------------------------------
/figure/fact.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LiuFG/Camera-Lidar-Fusion-ROS/27341783f19b1e5d7e513879f21e6928a926cbff/figure/fact.png
--------------------------------------------------------------------------------
/figure/grid.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LiuFG/Camera-Lidar-Fusion-ROS/27341783f19b1e5d7e513879f21e6928a926cbff/figure/grid.png
--------------------------------------------------------------------------------
/figure/kitti_player.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LiuFG/Camera-Lidar-Fusion-ROS/27341783f19b1e5d7e513879f21e6928a926cbff/figure/kitti_player.png
--------------------------------------------------------------------------------
/figure/pclvis.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LiuFG/Camera-Lidar-Fusion-ROS/27341783f19b1e5d7e513879f21e6928a926cbff/figure/pclvis.png
--------------------------------------------------------------------------------
/figure/result.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LiuFG/Camera-Lidar-Fusion-ROS/27341783f19b1e5d7e513879f21e6928a926cbff/figure/result.gif
--------------------------------------------------------------------------------
/figure/roibox.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LiuFG/Camera-Lidar-Fusion-ROS/27341783f19b1e5d7e513879f21e6928a926cbff/figure/roibox.png
--------------------------------------------------------------------------------
/figure/rosnode.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LiuFG/Camera-Lidar-Fusion-ROS/27341783f19b1e5d7e513879f21e6928a926cbff/figure/rosnode.jpg
--------------------------------------------------------------------------------
/figure/yolov3.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LiuFG/Camera-Lidar-Fusion-ROS/27341783f19b1e5d7e513879f21e6928a926cbff/figure/yolov3.png
--------------------------------------------------------------------------------
/kitti_player/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | cmake_minimum_required(VERSION 2.8.3)
2 | project(kitti_player)
3 |
4 | SET (CMAKE_BUILD_TYPE Release)
5 | SET (CMAKE_CXX_FLAGS "-O3 -std=c++11 -Wall")
6 | find_package( OpenCV REQUIRED )
7 | find_package(catkin REQUIRED COMPONENTS
8 | roscpp
9 | tf
10 | tf2
11 | std_msgs
12 | geometry_msgs
13 | cv_bridge
14 | image_transport
15 | dynamic_reconfigure
16 | )
17 |
18 | find_package(PCL 1.8 REQUIRED)
19 | find_package(Boost REQUIRED COMPONENTS thread system program_options)
20 |
21 |
22 | generate_dynamic_reconfigure_options(cfg/kitti_player.cfg)
23 | catkin_package(CATKIN_DEPENDS dynamic_reconfigure)
24 |
25 | include_directories(
26 | ${}
27 | ${catkin_INCLUDE_DIRS}
28 | ${PCL_INCLUDE_DIRS}
29 | ${Boost_INCLUDE_DIRS}
30 | )
31 |
32 | link_directories(${PCL_LIBRARY_DIRS})
33 | add_definitions(${PCL_DEFINITIONS})
34 |
35 | add_executable(kitti_player src/kitti_player.cpp)
36 |
37 | target_link_libraries(kitti_player ${catkin_LIBRARIES} ${PCL_LIBRARIES} ${Boost_LIBRARIES})
38 |
39 | target_link_libraries(kitti_player ${catkin_LIBRARIES} ${OpenCV_LIBRARIES})
40 | #Add all files in subdirectories of the project in
41 | # a dummy_target so qtcreator have access to all files
42 | FILE(GLOB children ${CMAKE_SOURCE_DIR}/*)
43 | FOREACH(child ${children})
44 | IF(IS_DIRECTORY ${child})
45 | file(GLOB_RECURSE dir_files "${child}/*")
46 | LIST(APPEND extra_files ${dir_files})
47 | ENDIF()
48 | ENDFOREACH()
49 | add_custom_target(dummy_${PROJECT_NAME} SOURCES ${extra_files})
50 |
--------------------------------------------------------------------------------
/kitti_player/Makefile:
--------------------------------------------------------------------------------
1 | include $(shell rospack find mk)/cmake.mk
--------------------------------------------------------------------------------
/kitti_player/README_reference.md:
--------------------------------------------------------------------------------
1 | # kitti_player
2 |
3 | From version 2, this node aims to play the whole kitti data into ROS (Color/Grayscale images, Velodyne scan as PCL, sensor_msgs/Imu Message, GPS as sensor_msgs/NavSatFix Message).
4 |
5 | * http://www.ira.disco.unimib.it/kitti_player
6 | * https://github.com/iralabdisco/kitti_player
7 |
8 | =========
9 |
10 | Kitti_player, a player for KITTI raw datasets
11 | Datasets can be downloaded from: http://www.cvlibs.net/datasets/kitti/raw_data.php
12 |
13 | ```
14 | Allowed options:
15 | help h help message
16 | directory d *required* - path to the kitti dataset Directory
17 | frequency f set replay Frequency
18 | all a replay All data
19 | velodyne v replay Velodyne data
20 | gps g replay Gps data
21 | imu i replay Imu data
22 | grayscale G replay Stereo Grayscale images
23 | color C replay Stereo Color images
24 | viewer V enable image viewer
25 | timestamps T use KITTI timestamps
26 | stereoDisp s use pre-calculated disparities
27 | viewDisp D view loaded disparity images
28 | frame F start playing at frame...
29 | gpsPoints p publish GPS/RTK markers to RVIZ, having reference frame as [example: -p map]
30 | synchMode S Enable Synch mode (wait for signal to load next frame [std_msgs/Bool "data: true"]
31 |
32 | kitti_player needs a directory tree like the following:
33 | └── 2011_09_26_drive_0001_sync
34 | ├── image_00
35 | │ └── data
36 | │ └ timestamps.txt
37 | ├── image_01
38 | │ └── data
39 | │ └ timestamps.txt
40 | ├── image_02
41 | │ └── data
42 | │ └ timestamps.txt
43 | ├── image_03
44 | │ └── data
45 | │ └ timestamps.txt
46 | ├── oxts
47 | │ └── data
48 | │ └ timestamps.txt
49 | ├── velodyne_points
50 | │ └── data
51 | │ └ timestamps.txt
52 | └── calib_cam_to_cam.txt
53 | ```
54 |
--------------------------------------------------------------------------------
/kitti_player/cfg/kitti_player.cfg:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python
2 | PACKAGE = "kitti_player"
3 |
4 | from dynamic_reconfigure.parameter_generator_catkin import *
5 |
6 | gen = ParameterGenerator()
7 |
8 | gen.add("loop_rate", double_t, 0, "Publish frequency", 1, 0, 10)
9 | gen.add("start", bool_t, 0, "Select to start playback", True)
10 | gen.add("continuous", bool_t, 0, "Select to play every frame at loop rate", False)
11 | gen.add("publish", bool_t, 0, "Publish a single frame", False)
12 |
13 | gen.add("generateGroundtruth", bool_t, 0, "If true the groundtruth is published", True)
14 | gen.add("generateUncertain", bool_t, 0, "If true the uncertain pose is published", True)
15 | gen.add("alphaPose", double_t, 0, "standard deviation of the pose", 0,0,1)
16 | gen.add("alphaOrientation", double_t, 0, "standard deviaton of the orientation", 0,0,1)
17 |
18 |
19 | #deprecated section
20 | gen.add("sequence", int_t, 0, "Sequence to load", 1, 0, 21)
21 | gen.add("exitIfNotFound", bool_t, 0, "If true it exits if no file is found", False)
22 |
23 | exit(gen.generate(PACKAGE, "kitti_player", "kitti_player"))
24 |
--------------------------------------------------------------------------------
/kitti_player/launch/kittiplayer_libviso2.launch:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
9 |
10 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
38 |
39 |
40 |
--------------------------------------------------------------------------------
/kitti_player/launch/kittiplayer_standalone.launch:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
8 |
9 |
15 |
16 |
17 |
19 |
20 |
21 |
22 |
23 |
24 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
62 |
--------------------------------------------------------------------------------
/kitti_player/package.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | kitti_player
4 | 1.0.2
5 |
6 | This node aims to play the kitti data into ROS. This repository is a
7 | catkin upgrade from the original work by Francesco Sacchi
8 | http://irawiki.disco.unimib.it/irawiki/index.php/Kitti_Player
9 |
10 |
11 | Augusto Luis Ballardini
12 |
13 | BSD
14 |
15 | catkin
16 |
17 | roscpp
18 | tf
19 | message_filters
20 | dynamic_reconfigure
21 | pcl_ros
22 |
23 | roscpp
24 | tf
25 | message_filters
26 | dynamic_reconfigure
27 | pcl_ros
28 |
29 |
30 |
--------------------------------------------------------------------------------
/opencv_deal/msg/BboxL.msg:
--------------------------------------------------------------------------------
1 | float64 minx
2 | float64 miny
3 | float64 maxx
4 | float64 maxy
5 | float64 navi
6 | float64 centerx
7 | float64 centery
8 |
--------------------------------------------------------------------------------
/opencv_deal/msg/BboxLes.msg:
--------------------------------------------------------------------------------
1 | Header header
2 | Header image_header
3 | BboxL[] bboxl
4 |
--------------------------------------------------------------------------------
/opencv_deal/src/calib.txt:
--------------------------------------------------------------------------------
1 | P0: 7.188560000000e+02 0.000000000000e+00 6.071928000000e+02 0.000000000000e+00 0.000000000000e+00 7.188560000000e+02 1.852157000000e+02 0.000000000000e+00 0.000000000000e+00 0.000000000000e+00 1.000000000000e+00 0.000000000000e+00
2 | P1: 7.188560000000e+02 0.000000000000e+00 6.071928000000e+02 -3.861448000000e+02 0.000000000000e+00 7.188560000000e+02 1.852157000000e+02 0.000000000000e+00 0.000000000000e+00 0.000000000000e+00 1.000000000000e+00 0.000000000000e+00
3 | P2: 7.188560000000e+02 0.000000000000e+00 6.071928000000e+02 4.538225000000e+01 0.000000000000e+00 7.188560000000e+02 1.852157000000e+02 -1.130887000000e-01 0.000000000000e+00 0.000000000000e+00 1.000000000000e+00 3.779761000000e-03
4 | P3: 7.188560000000e+02 0.000000000000e+00 6.071928000000e+02 -3.372877000000e+02 0.000000000000e+00 7.188560000000e+02 1.852157000000e+02 2.369057000000e+00 0.000000000000e+00 0.000000000000e+00 1.000000000000e+00 4.915215000000e-03
5 | Tr: 4.276802385584e-04 -9.999672484946e-01 -8.084491683471e-03 -1.198459927713e-02 -7.210626507497e-03 8.081198471645e-03 -9.999413164504e-01 -5.403984729748e-02 9.999738645903e-01 4.859485810390e-04 -7.206933692422e-03 -2.921968648686e-01
6 |
--------------------------------------------------------------------------------
/pcl_deal/package.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | pcl_deal
4 | 0.0.0
5 | The pcl_deal package
6 |
7 |
8 |
9 |
10 | lfg
11 |
12 |
13 |
14 |
15 |
16 | TODO
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 | catkin
52 | pcl_conversions
53 | pcl_msgs
54 | pcl_ros
55 | sensor_msgs
56 | pcl_conversions
57 | pcl_msgs
58 | pcl_ros
59 | sensor_msgs
60 | pcl_conversions
61 | pcl_msgs
62 | pcl_ros
63 | sensor_msgs
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
--------------------------------------------------------------------------------
/pcl_deal/src/pclvirualtest.cpp:
--------------------------------------------------------------------------------
1 | #include
2 | #include
3 | #include
4 | #include
5 | #include
6 |
7 | class cloudHandler
8 | {
9 | public:
10 | cloudHandler()
11 | : viewer("Cloud Viewer")
12 | {
13 | output_sub = nh.subscribe("kitti_player/hdl64e", 1, &cloudHandler::outputCB, this);
14 | // downsampled_sub = nh.subscribe("pcl_partitioned", 1, &cloudHandler::downsampledCB, this);
15 | viewer_timer = nh.createTimer(ros::Duration(0.1), &cloudHandler::timerCB, this);
16 |
17 | // viewer.createViewPort(0.0, 0.0, 0.5, 1.0, output_view);
18 | viewer.setBackgroundColor(0, 0, 0, output_view);
19 |
20 | // viewer.createViewPort(0.5, 0.0, 1.0, 1.0, downsampled_view);
21 | // viewer.setBackgroundColor(0, 0, 0, downsampled_view);
22 |
23 | viewer.addCoordinateSystem(1.0);
24 | viewer.initCameraParameters();
25 | }
26 |
27 | void outputCB(const sensor_msgs::PointCloud2ConstPtr& input)
28 | {
29 | pcl::PointCloud cloud;
30 | pcl::fromROSMsg(*input, cloud);
31 | // viewer.updatePointCloud(cloud.makeShared(), "output");
32 | viewer.removeAllPointClouds(output_view);
33 | viewer.addPointCloud(cloud.makeShared(), "output", output_view);
34 | }
35 |
36 | /* void downsampledCB(const sensor_msgs::PointCloud2ConstPtr& input)
37 | {
38 | pcl::PointCloud cloud;
39 | pcl::fromROSMsg(*input, cloud);
40 |
41 | viewer.removeAllPointClouds(downsampled_view);
42 | viewer.addPointCloud(cloud.makeShared(), "downsampled", downsampled_view);
43 | }
44 | */
45 | void timerCB(const ros::TimerEvent&)
46 | {
47 | viewer.spinOnce();
48 |
49 | if (viewer.wasStopped())
50 | {
51 | ros::shutdown();
52 | }
53 | }
54 |
55 | protected:
56 | ros::NodeHandle nh;
57 | ros::Subscriber output_sub;//, downsampled_sub;
58 | pcl::visualization::PCLVisualizer viewer;
59 | int output_view, downsampled_view;
60 | ros::Timer viewer_timer;
61 | };
62 |
63 | main (int argc, char **argv)
64 | {
65 | ros::init (argc, argv, "pcl_visualize2");
66 |
67 | cloudHandler handler;
68 |
69 | ros::spin();
70 |
71 | return 0;
72 | }
73 |
--------------------------------------------------------------------------------
/pcl_deal/src/pclvis.cpp:
--------------------------------------------------------------------------------
1 | #include
2 | #include
3 | #include
4 | #include
5 | #include
6 |
7 | class cloudHandler
8 | {
9 | public:
10 | cloudHandler()
11 | : viewer("Cloud Viewer")
12 | {
13 | pcl_sub = nh.subscribe("kitti_player/hdl64e", 10, &cloudHandler::cloudCB, this);
14 | viewer_timer = nh.createTimer(ros::Duration(0.1), &cloudHandler::timerCB, this);
15 | }
16 |
17 | void cloudCB(const sensor_msgs::PointCloud2 &input)
18 | {
19 | pcl::PointCloud cloud;
20 | pcl::fromROSMsg(input, cloud);
21 |
22 | viewer.showCloud(cloud.makeShared());
23 | }
24 |
25 | void timerCB(const ros::TimerEvent&)
26 | {
27 | if (viewer.wasStopped())
28 | {
29 | ros::shutdown();
30 | }
31 | }
32 |
33 | protected:
34 | ros::NodeHandle nh;
35 | ros::Subscriber pcl_sub;
36 | pcl::visualization::CloudViewer viewer;
37 | ros::Timer viewer_timer;
38 | };
39 |
40 | main (int argc, char **argv)
41 | {
42 | ros::init (argc, argv, "pcl_visualize");
43 |
44 | cloudHandler handler;
45 |
46 | ros::spin();
47 |
48 | return 0;
49 | }
50 |
--------------------------------------------------------------------------------