karta0807913 / caffe-yolo-9000 Goto Github PK
View Code? Open in Web Editor NEWcaffe-yolo-9000
License: Other
caffe-yolo-9000
License: Other
Is here any method to calculate the mAP of model?
And i did run netforward.cpp using 30000 iter weight, but when i checked the differences between ground truth and prediction. Does it need to be trained more?
Thanks.
I have anchor boxes of my dataset, how to set anchor boxes in your code?
thanks!
I have trained the model as instructions, and run the code for testing VOC image, but it has poor result.
After I learn the darknet yolo v2 source code, I find that the box_data_layer may be wrong, because it still takes side_side_(1+1+1+4), the same with yolo v1, that means one cell still only have one label class.
I have modified the box_data_layer implementation according to yolo v2 based on darknet. But it has some link problems.
According to Caffe Implementation, The BN is implemented as 2 separated layers. And In your code, only the first part of BN is presented. Are you sure this is right?
Hello,
Thanks for sharing this code. I have few small questions:
When I complie caffe, I get some error, the output information is list bellow! Can you help me?
#######################################################################
In file included from /usr/include/c++/4.8/algorithm:62:0,
from /home/zouhongwei/workspce/caffe-yolo-9000/include/caffe/blob.hpp:4,
from /home/zouhongwei/workspce/caffe-yolo-9000/include/caffe/caffe.hpp:7,
from /home/zouhongwei/workspce/caffe-yolo-9000/examples/yolo_9000_test/netforward.cpp:1:
/usr/include/c++/4.8/bits/stl_algo.h: In instantiation of ‘_RandomAccessIterator std::__unguarded_partition(_RandomAccessIterator, _Ra ndomAccessIterator, const _Tp&) [with _RandomAccessIterator = yolo_v2::DATA*; _Tp = yolo_v2::DATA]’:
/usr/include/c++/4.8/bits/stl_algo.h:2283:70: required from ‘_RandomAccessIterator std::__unguarded_partition_pivot(_RandomAccessIte rator, _RandomAccessIterator) [with _RandomAccessIterator = yolo_v2::DATA*]’
/usr/include/c++/4.8/bits/stl_algo.h:2315:54: required from ‘void std::__introsort_loop(_RandomAccessIterator, _RandomAccessIterator , _Size) [with _RandomAccessIterator = yolo_v2::DATA*; _Size = long int]’
/usr/include/c++/4.8/bits/stl_algo.h:5461:36: required from ‘void std::sort(_RAIter, RAIter) [with RAIter = yolo_v2::DATA*]’
/home/zouhongwei/workspce/caffe-yolo-9000/examples/yolo_9000_test/yolo_v2_output.h:97:51: required from ‘std::vector<yolo_v2::DATA> yolo_v2::getResult(std::vector&, std::vector&, int, float, float) [with int OBJECT_NUM = 5; int SIDE = 13]’
/home/zouhongwei/workspce/caffe-yolo-9000/examples/yolo_9000_test/netforward.cpp:86:86: required from here
/usr/include/c++/4.8/bits/stl_algo.h:2245:19: error: passing ‘const yolo_v2::DATA’ as ‘this’ argument of ‘bool yolo_v2::DATA::operator <(yolo_v2::DATA)’ discards qualifiers [-fpermissive]
while (__pivot < *__last)
^
make[2]: *** [examples/CMakeFiles/netforward.dir/yolo_9000_test/netforward.cpp.o] Error 1
make[1]: *** [examples/CMakeFiles/netforward.dir/all] Error 2
make: *** [all] Error 2
######################################################################
out of shear luck, the python inference code I wrote gave me significantly better detection results. So I did a big more debugging on the C++ netforward code under examples/yolo_9000_test.
I found one bug in yolo_v2_output.h in getResult function where the class label scores are compared. The best_score variable is currently declared as int. But it must be float. Otherwise any score less than 1 will treated as 0 and wrong class of object will be selected.
.build_release/tools/convert_box_data.o:在函数‘main’中:
convert_box_data.cpp:(.text.startup+0x858):对‘caffe::ReadBoxDataToDatum(std::string const&, std::string const&, std::map<std::string, int, std::lessstd::string, std::allocator<std::pair<std::string const, int> > > const&, int, int, bool, std::string const&, caffe::Datum*)’未定义的引用
collect2: 错误: ld 返回 1
make: *** [.build_release/tools/convert_box_data.bin] 错误 1
Q1: Some tips occured to me when using 'make all -j8', are you annotated with the above code or the following code???
src/caffe/layers/yolo_v2_loss_layer.cpp:113:1: warning: "/" within comment [-Wcomment]
/ **/
yolo_v2_loss_layer.cpp:113
/**/ diff[index + 2 * SHIFT] = scale * (pred_box.w - truth_box.w) * pred_box.w; diff[index + 3 * SHIFT] = scale * (pred_box.h - truth_box.h) * pred_box.h; /** / diff[index + 2 * SHIFT] = scale * (log(pred_box.w / biases[2 * n + 0]) - log(truth_box.w / biases[2 * n + 0])); diff[index + 3 * SHIFT] = scale * (log(pred_box.h / biases[2 * n + 1]) - log(truth_box.h / biases[2 * n + 1])); /* **/
Q2:How to detec images through the voc_model_iter_30000.caffemodel you provide?
The get_region_box function in yolo_v2_loss_layer.cpp doesn't appear to be using sigmoid to compute box.x and box.y. I wonder why? The logistic_activate() function is defined by never called.
//why aren't we use sigmoid for box.x and box.y?
box.x = (i + x[0 * SIZE]) / side;
box.y = (j + x[1 * SIZE]) / side;
box.w = exp(x[2 * SIZE]) * biases[2 * n];
box.h = exp(x[3 * SIZE]) * biases[2 * n + 1];
I checked the ground truth label conversion steps. The ground truth values seem to be used just as normalized x, y values relative to image size. There doesn't appear to be any conversion in box_data_layer.cpp either. So how can we use the prediction value without applying sigmoid, in the mix with a linear ground truth to compute the diff?
Is it because the way the diff gradient formula is written in delta_region_box()?
When I first tried to compile it wih cmake, there were a problem occurred like 👍
/usr/include/c++/4.8/bits/cpp_type_traits.h(314): error: expected a ">"
/usr/include/c++/4.8/cmath(80): error: inline specifier allowed on function declarations only
/usr/include/c++/4.8/cmath(80): error: expected a ";"
/usr/include/c++/4.8/cmath(105): error: inline specifier allowed on function declarations only
/usr/include/c++/4.8/cmath(105): error: variable "std::constexpr" has already been defined
/usr/include/c++/4.8/cmath(105): error: expected a ";"
/usr/include/c++/4.8/cmath(124): error: inline specifier allowed on function declarations only
/usr/include/c++/4.8/cmath(124): error: variable "std::constexpr" has already been defined
/usr/include/c++/4.8/cmath(124): error: expected a ";"
/usr/include/c++/4.8/cmath(143): error: inline specifier allowed on function declarations only
/usr/include/c++/4.8/cmath(143): error: variable "std::constexpr" has already been defined
/usr/include/c++/4.8/cmath(143): error: expected a ";"
/usr/include/c++/4.8/cmath(162): error: inline specifier allowed on function declarations only
/usr/include/c++/4.8/cmath(162): error: variable "std::constexpr" has already been defined
/usr/include/c++/4.8/cmath(162): error: expected a ";"
/usr/include/c++/4.8/cmath(183): error: inline specifier allowed on function declarations only
/usr/include/c++/4.8/cmath(183): error: variable "std::constexpr" has already been defined
/usr/include/c++/4.8/cmath(183): error: expected a ";"
/usr/include/c++/4.8/cmath(202): error: inline specifier allowed on function declarations only
/usr/include/c++/4.8/cmath(202): error: variable "std::constexpr" has already been defined
/usr/include/c++/4.8/cmath(202): error: expected a ";"
/usr/include/c++/4.8/cmath(221): error: inline specifier allowed on function declarations only
/usr/include/c++/4.8/cmath(221): error: variable "std::constexpr" has already been defined
/usr/include/c++/4.8/cmath(221): error: expected a ";"
/usr/include/c++/4.8/cmath(240): error: inline specifier allowed on function declarations only
/usr/include/c++/4.8/cmath(240): error: variable "std::constexpr" has already been defined
/usr/include/c++/4.8/cmath(240): error: expected a ";"
/usr/include/c++/4.8/cmath(259): error: inline specifier allowed on function declarations only
/usr/include/c++/4.8/cmath(259): error: variable "std::constexpr" has already been defined
/usr/include/c++/4.8/cmath(259): error: expected a ";"
/usr/include/c++/4.8/cmath(278): error: inline specifier allowed on function declarations only
/usr/include/c++/4.8/cmath(278): error: variable "std::constexpr" has already been defined
After I searched I found that I need to add "-std=c++11" in cmake/Cuda.cmake line 150. With this change, I successfully compiled it.
" list(APPEND CUDA_NVCC_FLAGS -Xcompiler -fPIC -std=c++11)
"
Hope this can help someone
Could you share the yolov2 test file?
thank you very much
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.