RPI Zero - ARM32v6 - Compile error
chrstnwhlrt opened this issue · 4 comments
Running the go-face installation with the current go version and raspian (debian buster) leads to a compiling error:
...
/usr/include/c++/8/bits/vector.tcc: In member function ‘void dlib::loss_mmod_::tensor_to_dets(const dlib::tensor&, const dlib::tensor&, long int, std::vector<dlib::loss_mmod_::intermediate_detection>&, double, const net_type&) const [with net_type = dlib::dimpl::subnet_wrapper<dlib::add_layer<dlib::con_<1, 9, 9, 1, 1, 4, 4>, dlib::add_layer<dlib::relu_, dlib::add_layer<dlib::affine_, dlib::add_layer<dlib::con_<45, 5, 5, 1, 1, 2, 2>, dlib::add_layer<dlib::relu_, dlib::add_layer<dlib::affine_, dlib::add_layer<dlib::con_<45, 5, 5, 1, 1, 2, 2>, dlib::add_layer<dlib::relu_, dlib::add_layer<dlib::affine_, dlib::add_layer<dlib::con_<45, 5, 5, 1, 1, 2, 2>, dlib::add_layer<dlib::relu_, dlib::add_layer<dlib::affine_, dlib::add_layer<dlib::con_<32, 5, 5, 2, 2, 0, 0>, dlib::add_layer<dlib::relu_, dlib::add_layer<dlib::affine_, dlib::add_layer<dlib::con_<32, 5, 5, 2, 2, 0, 0>, dlib::add_layer<dlib::relu_, dlib::add_layer<dlib::affine_, dlib::add_layer<dlib::con_<16, 5, 5, 2, 2, 0, 0>, dlib::input_rgb_image_pyramid<dlib::pyramid_down<6> >, void>, void>, void>, void>, void>, void>, void>, void>, void>, void>, void>, void>, void>, void>, void>, void>, void>, void>, void>, true, void>]’:
/usr/include/c++/8/bits/vector.tcc:109:4: note: parameter passing for argument of type ‘__gnu_cxx::__normal_iterator<dlib::loss_mmod_::intermediate_detection*, std::vector<dlib::loss_mmod_::intermediate_detection> >’ changed in GCC 7.1
_M_realloc_insert(end(), std::forward<_Args>(__args)...);
^~~~~~~~~~~~~~~~~
/usr/include/c++/8/bits/vector.tcc: In member function ‘void dlib::loss_mmod_::to_label(const dlib::tensor&, const SUB_TYPE&, label_iterator, double) const [with SUB_TYPE = dlib::dimpl::subnet_wrapper<dlib::add_layer<dlib::con_<1, 9, 9, 1, 1, 4, 4>, dlib::add_layer<dlib::relu_, dlib::add_layer<dlib::affine_, dlib::add_layer<dlib::con_<45, 5, 5, 1, 1, 2, 2>, dlib::add_layer<dlib::relu_, dlib::add_layer<dlib::affine_, dlib::add_layer<dlib::con_<45, 5, 5, 1, 1, 2, 2>, dlib::add_layer<dlib::relu_, dlib::add_layer<dlib::affine_, dlib::add_layer<dlib::con_<45, 5, 5, 1, 1, 2, 2>, dlib::add_layer<dlib::relu_, dlib::add_layer<dlib::affine_, dlib::add_layer<dlib::con_<32, 5, 5, 2, 2, 0, 0>, dlib::add_layer<dlib::relu_, dlib::add_layer<dlib::affine_, dlib::add_layer<dlib::con_<32, 5, 5, 2, 2, 0, 0>, dlib::add_layer<dlib::relu_, dlib::add_layer<dlib::affine_, dlib::add_layer<dlib::con_<16, 5, 5, 2, 2, 0, 0>, dlib::input_rgb_image_pyramid<dlib::pyramid_down<6> >, void>, void>, void>, void>, void>, void>, void>, void>, void>, void>, void>, void>, void>, void>, void>, void>, void>, void>, void>, true, void>; label_iterator = std::vector<dlib::mmod_rect>*]’:
/usr/include/c++/8/bits/vector.tcc:109:4: note: parameter passing for argument of type ‘__gnu_cxx::__normal_iterator<dlib::mmod_rect*, std::vector<dlib::mmod_rect> >’ changed in GCC 7.1
_M_realloc_insert(end(), std::forward<_Args>(__args)...);
^~~~~~~~~~~~~~~~~
# github.com/Kagami/go-face
../github.com/Kagami/go-face/face.go:117:13: type [1073741824]_Ctype_long larger than address space
../github.com/Kagami/go-face/face.go:117:13: type [1073741824]_Ctype_long too large
../github.com/Kagami/go-face/face.go:121:13: type [1073741824]float32 larger than address space
../github.com/Kagami/go-face/face.go:121:13: type [1073741824]float32 too large
../github.com/Kagami/go-face/face.go:125:13: type [1073741824]_Ctype_long larger than address space
../github.com/Kagami/go-face/face.go:125:13: type [1073741824]_Ctype_long too large
The bit shifts in the face.go file
rDataLen := numFaces * rectLen
rDataPtr := unsafe.Pointer(ret.rectangles)
rData := (*[1 << 30]C.long)(rDataPtr)[:rDataLen:rDataLen]
dDataLen := numFaces * descrLen
dDataPtr := unsafe.Pointer(ret.descriptors)
dData := (*[1 << 30]float32)(dDataPtr)[:dDataLen:dDataLen]
sDataLen := numFaces * numShapes * shapeLen
sDataPtr := unsafe.Pointer(ret.shapes)
sData := (*[1 << 30]C.long)(sDataPtr)[:sDataLen:sDataLen]
Seem to fail with this 32 bit architecture. Is there any workaround?
I installed all requirements as needed but It seems that go get tries to compile dlib itself which take a long time (and swaps obviously a lot). Is there any pre built solution?
Try with 29
instead of 30
(in those 3 places).
compile dlib itself
dlib is mostly header-only library so yes, compilation takes a lot. And compilation of C++ templates takes a lot of memory.
Is there any pre built solution?
No.
Thanks for the quick response!
I changed the bit shifts from 30 to 29, this actually changed the compiling error:
/usr/include/c++/8/bits/stl_vector.h:1085:4: note: parameter passing for argument of type ‘__gnu_cxx::__normal_iterator<dlib::rect_detection*, std::vector<dlib::rect_detection> >’ changed in GCC 7.1
_M_realloc_insert(end(), __x);
^~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/8/vector:69,
from /usr/include/dlib/is_kind.h:6,
from /usr/include/dlib/matrix/matrix_exp.h:7,
from /usr/include/dlib/matrix/matrix.h:6,
from /usr/include/dlib/matrix.h:6,
from /usr/include/dlib/dnn/tensor.h:8,
from /usr/include/dlib/dnn.h:12,
from facerec.cc:2:
/usr/include/c++/8/bits/vector.tcc: In member function ‘void dlib::loss_mmod_::tensor_to_dets(const dlib::tensor&, const dlib::tensor&, long int, std::vector<dlib::loss_mmod_::intermediate_detection>&, double, const net_type&) const [with net_type = dlib::dimpl::subnet_wrapper<dlib::add_layer<dlib::con_<1, 9, 9, 1, 1, 4, 4>, dlib::add_layer<dlib::relu_, dlib::add_layer<dlib::affine_, dlib::add_layer<dlib::con_<45, 5, 5, 1, 1, 2, 2>, dlib::add_layer<dlib::relu_, dlib::add_layer<dlib::affine_, dlib::add_layer<dlib::con_<45, 5, 5, 1, 1, 2, 2>, dlib::add_layer<dlib::relu_, dlib::add_layer<dlib::affine_, dlib::add_layer<dlib::con_<45, 5, 5, 1, 1, 2, 2>, dlib::add_layer<dlib::relu_, dlib::add_layer<dlib::affine_, dlib::add_layer<dlib::con_<32, 5, 5, 2, 2, 0, 0>, dlib::add_layer<dlib::relu_, dlib::add_layer<dlib::affine_, dlib::add_layer<dlib::con_<32, 5, 5, 2, 2, 0, 0>, dlib::add_layer<dlib::relu_, dlib::add_layer<dlib::affine_, dlib::add_layer<dlib::con_<16, 5, 5, 2, 2, 0, 0>, dlib::input_rgb_image_pyramid<dlib::pyramid_down<6> >, void>, void>, void>, void>, void>, void>, void>, void>, void>, void>, void>, void>, void>, void>, void>, void>, void>, void>, void>, true, void>]’:
/usr/include/c++/8/bits/vector.tcc:109:4: note: parameter passing for argument of type ‘__gnu_cxx::__normal_iterator<dlib::loss_mmod_::intermediate_detection*, std::vector<dlib::loss_mmod_::intermediate_detection> >’ changed in GCC 7.1
_M_realloc_insert(end(), std::forward<_Args>(__args)...);
^~~~~~~~~~~~~~~~~
/usr/include/c++/8/bits/vector.tcc: In member function ‘void dlib::loss_mmod_::to_label(const dlib::tensor&, const SUB_TYPE&, label_iterator, double) const [with SUB_TYPE = dlib::dimpl::subnet_wrapper<dlib::add_layer<dlib::con_<1, 9, 9, 1, 1, 4, 4>, dlib::add_layer<dlib::relu_, dlib::add_layer<dlib::affine_, dlib::add_layer<dlib::con_<45, 5, 5, 1, 1, 2, 2>, dlib::add_layer<dlib::relu_, dlib::add_layer<dlib::affine_, dlib::add_layer<dlib::con_<45, 5, 5, 1, 1, 2, 2>, dlib::add_layer<dlib::relu_, dlib::add_layer<dlib::affine_, dlib::add_layer<dlib::con_<45, 5, 5, 1, 1, 2, 2>, dlib::add_layer<dlib::relu_, dlib::add_layer<dlib::affine_, dlib::add_layer<dlib::con_<32, 5, 5, 2, 2, 0, 0>, dlib::add_layer<dlib::relu_, dlib::add_layer<dlib::affine_, dlib::add_layer<dlib::con_<32, 5, 5, 2, 2, 0, 0>, dlib::add_layer<dlib::relu_, dlib::add_layer<dlib::affine_, dlib::add_layer<dlib::con_<16, 5, 5, 2, 2, 0, 0>, dlib::input_rgb_image_pyramid<dlib::pyramid_down<6> >, void>, void>, void>, void>, void>, void>, void>, void>, void>, void>, void>, void>, void>, void>, void>, void>, void>, void>, void>, true, void>; label_iterator = std::vector<dlib::mmod_rect>*]’:
/usr/include/c++/8/bits/vector.tcc:109:4: note: parameter passing for argument of type ‘__gnu_cxx::__normal_iterator<dlib::mmod_rect*, std::vector<dlib::mmod_rect> >’ changed in GCC 7.1
_M_realloc_insert(end(), std::forward<_Args>(__args)...);
^~~~~~~~~~~~~~~~~
# github.com/Kagami/go-face
../github.com/Kagami/go-face/face.go:117:13: type [536870912]_Ctype_long too large
../github.com/Kagami/go-face/face.go:121:13: type [536870912]float32 too large
../github.com/Kagami/go-face/face.go:125:13: type [536870912]_Ctype_long too large
Should I reduce the number of shifts further?
Yes, try something lower.
I successfully built go-face using << 24 bit
shifts, works like a charm even with a decent performance (takes ~4-6 seconds to analyze a picture).
Nice work, thanks!