lsrock1 / maskrcnn_benchmark.cpp Goto Github PK
View Code? Open in Web Editor NEWImplementation maskrcnn-benchmark, pytorch c++ frontend
License: MIT License
Implementation maskrcnn-benchmark, pytorch c++ frontend
License: MIT License
Hi, do you plan to add keypoints structures/heads?
Regards,
Hi i'm still new in deep learning, may I know where can i train my own data ?
and i still cant find which file indicate the epoch and activation function to define the model
Thank you
my gcc is 4.9 and cuda is 9.0
[ 3%] Building CXX object source/rcnn/layers/CMakeFiles/layers.dir/batch_norm.cpp.o
[ 6%] Building CXX object source/rcnn/layers/CMakeFiles/layers.dir/conv2d.cpp.o
[ 10%] Building CXX object source/rcnn/layers/CMakeFiles/layers.dir/cpu/ROIAlign_cpu.cpp.o
[ 13%] Building CXX object source/rcnn/layers/CMakeFiles/layers.dir/cpu/nms_cpu.cpp.o
[ 16%] Building CUDA object source/rcnn/layers/CMakeFiles/layers.dir/cuda/ROIAlign_cuda.cu.o
In file included from /usr/include/c++/4.9/atomic:38:0,
from /home/f1684326/anaconda3/envs/rcnn/lib/python2.7/site-packages/torch/include/c10/core/TensorTypeIdRegistration.h:15,
from /home/f1684326/anaconda3/envs/rcnn/lib/python2.7/site-packages/torch/include/c10/core/Backend.h:5,
from /home/f1684326/anaconda3/envs/rcnn/lib/python2.7/site-packages/torch/include/c10/core/Layout.h:3,
from /home/f1684326/anaconda3/envs/rcnn/lib/python2.7/site-packages/torch/include/ATen/core/Type.h:7,
from /home/f1684326/anaconda3/envs/rcnn/lib/python2.7/site-packages/torch/include/ATen/Type.h:2,
from /home/f1684326/anaconda3/envs/rcnn/lib/python2.7/site-packages/torch/include/ATen/Context.h:4,
from /home/f1684326/anaconda3/envs/rcnn/lib/python2.7/site-packages/torch/include/ATen/ATen.h:5,
from /home/f1684326/github/maskrcnn_benchmark_cpp/maskrcnn_benchmark.cpp/source/rcnn/layers/cuda/ROIAlign_cuda.cu:2:
/usr/include/c++/4.9/bits/c++0x_warning.h:32:2: error: #error This file requires compiler and library support for the ISO C++ 2011 standard. This support is currently experimental, and must be enabled with the -std=c++11 or -std=gnu++11 compiler options.
#error This file requires compiler and library support for the
^
source/rcnn/layers/CMakeFiles/layers.dir/build.make:114: recipe for target 'source/rcnn/layers/CMakeFiles/layers.dir/cuda/ROIAlign_cuda.cu.o' failed
make[2]: *** [source/rcnn/layers/CMakeFiles/layers.dir/cuda/ROIAlign_cuda.cu.o] Error 1
CMakeFiles/Makefile2:212: recipe for target 'source/rcnn/layers/CMakeFiles/layers.dir/all' failed
make[1]: *** [source/rcnn/layers/CMakeFiles/layers.dir/all] Error 2
Makefile:83: recipe for target 'all' failed
make: *** [all] Error 2
Excuse me, is the C ++ code for coco and rcnn in your source folder written by you or where is the official code?
I tried to use the same e2e_faster_rcnn_101_fpn_1x.yaml configuration to convert the model to a C ++ callable torchscript. However, when traversing module.get_attributes () in jit_to_cpp.cpp, a boolean error cannot be assigned to the tensor. I checked the model in python, and indeed there is a Boolean variable (eg. Training). Have you encountered this problem during conversion?
Hi, are there any benefits from source compilation instead of using binaries? It takes hell lot of time :)
Regards,
dear @lsrock1 ,
I'm trying to compile your repo with gcc 7.4 libtorch 1.3.1
it seemed to be going well first but showed an error related to "fmap" as below
[ 79%] Building CXX object source/rcnn/engine/CMakeFiles/engine.dir/inference.cpp.o
[ 80%] Building CXX object source/rcnn/engine/CMakeFiles/engine.dir/parallel.cpp.o
/home/lee/maskrcnn_benchmark.cpp/source/rcnn/engine/parallel.cpp: In function ‘std::pair<at::Tensor, std::map<std::__cxx11::basic_string, at::Tensor> > rcnn::engine::data_parallel(rcnn::modeling::GeneralizedRCNN, rcnn::structures::ImageList, std::vectorrcnn::structures::BoxList, c10::optional<std::vectorc10::Device >, c10::optionalc10::Device, int64_t)’:
/home/lee/maskrcnn_benchmark.cpp/source/rcnn/engine/parallel.cpp:118:28: error: ‘fmap’ was not declared in this scope
auto scattered_tensors = fmaptorch::Tensor(scatter.apply({std::move(input)}));
^~~~
/home/lee/maskrcnn_benchmark.cpp/source/rcnn/engine/parallel.cpp:118:28: note: suggested alternatives:
In file included from /home/lee/Downloads/libtorch/include/ATen/core/ivalue_inl.h:6:0,
from /home/lee/Downloads/libtorch/include/ATen/core/ivalue.h:636,
from /home/lee/Downloads/libtorch/include/ATen/core/stack.h:3,
from /home/lee/Downloads/libtorch/include/ATen/core/ATenDispatch.h:15,
from /home/lee/Downloads/libtorch/include/ATen/core/TensorMethods.h:10,
from /home/lee/Downloads/libtorch/include/ATen/Tensor.h:12,
from /home/lee/Downloads/libtorch/include/ATen/Context.h:4,
from /home/lee/Downloads/libtorch/include/ATen/ATen.h:5,
from /home/lee/Downloads/libtorch/include/torch/csrc/api/include/torch/types.h:3,
from /home/lee/Downloads/libtorch/include/torch/csrc/api/include/torch/data/dataloader_options.h:4,
from /home/lee/Downloads/libtorch/include/torch/csrc/api/include/torch/data/dataloader/base.h:3,
from /home/lee/Downloads/libtorch/include/torch/csrc/api/include/torch/data/dataloader/stateful.h:3,
from /home/lee/Downloads/libtorch/include/torch/csrc/api/include/torch/data/dataloader.h:3,
from /home/lee/Downloads/libtorch/include/torch/csrc/api/include/torch/data.h:3,
from /home/lee/Downloads/libtorch/include/torch/csrc/api/include/torch/all.h:4,
from /home/lee/Downloads/libtorch/include/torch/csrc/api/include/torch/torch.h:3,
from /home/lee/maskrcnn_benchmark.cpp/source/rcnn/engine/../../../include/rcnn/engine/parallel.h:2,
from /home/lee/maskrcnn_benchmark.cpp/source/rcnn/engine/parallel.cpp:1:
/home/lee/Downloads/libtorch/include/ATen/core/functional.h:29:23: note: ‘c10::fmap’
inline std::vector fmap(const T& inputs) {
^~~~
/home/lee/Downloads/libtorch/include/ATen/core/functional.h:18:13: note: ‘c10::fmap’
inline auto fmap(const T& inputs, const F& fn) -> std::vector<decltype(fn(*inputs.begin()))> {
^~~~
/home/lee/Downloads/libtorch/include/ATen/core/functional.h:29:23: note: ‘c10::fmap’
inline std::vector fmap(const T& inputs) {
^~~~
/home/lee/Downloads/libtorch/include/ATen/core/functional.h:29:23: note: ‘c10::fmap’
/home/lee/Downloads/libtorch/include/ATen/core/functional.h:29:23: note: ‘c10::fmap’
/home/lee/maskrcnn_benchmark.cpp/source/rcnn/engine/parallel.cpp:118:46: error: expected primary-expression before ‘>’ token
auto scattered_tensors = fmaptorch::Tensor(scatter.apply({std::move(input)}));
^
/home/lee/maskrcnn_benchmark.cpp/source/rcnn/engine/parallel.cpp:121:22: error: unable to deduce ‘auto&&’ from ‘scattered_tensors’
for(auto& tensor : scattered_tensors){
^~~~~~~~~~~~~~~~~
/home/lee/maskrcnn_benchmark.cpp/source/rcnn/engine/parallel.cpp:156:44: error: expected primary-expression before ‘>’ token
.apply(fmaptorch::autograd::Variable(std::move(total_loss)))
^
Im struggling to find the reason.
I hope you can give me some hints
Thank you!
I'm very interested in this project, and will use it for defect detection in images, marked the defect region( defect segment), but fail to download models for test
[ 26%] Building CXX object source/rcnn/solver/CMakeFiles/solver.dir/solver_build.cpp.o
In file included from /home/chenxin/Desktop/maskrcnn_benchmark.cpp/source/rcnn/layers/../../../include/rcnn/layers/roi_align.h:4:0,
from /home/chenxin/Desktop/maskrcnn_benchmark.cpp/source/rcnn/modeling/../../../include/rcnn/modeling/poolers.h:4,
from /home/chenxin/Desktop/maskrcnn_benchmark.cpp/source/rcnn/modeling/../../../include/rcnn/modeling/roi_heads/box_head/roi_box_feature_extractors.h:6,
from /home/chenxin/Desktop/maskrcnn_benchmark.cpp/source/rcnn/modeling/../../../include/rcnn/modeling/roi_heads/box_head/box_head.h:6,
from /home/chenxin/Desktop/maskrcnn_benchmark.cpp/source/rcnn/modeling/../../../include/rcnn/modeling/roi_heads/roi_heads.h:5,
from /home/chenxin/Desktop/maskrcnn_benchmark.cpp/source/rcnn/modeling/../../../include/rcnn/modeling/detector/generalized_rcnn.h:12,
from /home/chenxin/Desktop/maskrcnn_benchmark.cpp/source/rcnn/solver/../../../include/rcnn/solver/solver_build.h:4,
from /home/chenxin/Desktop/maskrcnn_benchmark.cpp/source/rcnn/solver/solver_build.cpp:1:
/home/chenxin/Desktop/libtorch-shared-with-deps-latest/libtorch/include/torch/csrc/autograd/VariableTypeUtils.h: In function ‘void torch::autograd::check_inplace(const at::Tensor&)’:
/home/chenxin/Desktop/libtorch-shared-with-deps-latest/libtorch/include/torch/csrc/autograd/VariableTypeUtils.h:45:13: error: redefinition of ‘void torch::autograd::check_inplace(const at::Tensor&)’
inline void check_inplace(const Tensor& tensor) {
^~~~~~~~~~~~~
A minimal standalone forward c++ project would be better.
And directly trace model out using python branch.
In the last step, after finishing cmake, I compiling the project in vs2015 and meet more than 400 errors, how can I solve them?
For example:
错误 C2131 表达式的计算结果不是常数
maskrcnn_benchmark.cpp\source\coco\mask.cpp 123
严重性 代码 说明 项目 文件 行 禁止显示状态
错误 C3863 不可指定数组类型“double ['函数']” maskrcnn_benchmark.cpp\source\coco\mask.cpp 125
严重性 代码 说明 项目 文件 行 禁止显示状态
错误 member "torch::jit::ArgumentSpecCreator::DEPTH_LIMIT" may not be initialized layers maskrcnn_benchmark.cpp\lib\libtorch\include\torch\csrc\jit\argument_spec.h 161
hi,how can i generate anchors with libtorch on gpu device.
I wonder how to train the model to inference, By python, which framework ?
Thank you a lot!
Jack
In file included from /home2/maskrcnn_benchmark.cpp/source/rcnn/layers/conv2d.cpp:2:0:
/home2/maskrcnn_benchmark.cpp/source/rcnn/layers/../../../include/rcnn/layers/conv2d.h:12:68: error: expected class-name before ‘{’ token
struct _NewEmptyTensorOpBackward : public torch::autograd::Function{
^
/home2/maskrcnn_benchmark.cpp/source/rcnn/layers/../../../include/rcnn/layers/conv2d.h:14:34: error: ‘torch::autograd::variable_list rcnn::layers::_NewEmptyTensorOpBackward::apply(torch::autograd::variable_list&&)’ marked ‘override’, but does not override
torch::autograd::variable_list apply(torch::autograd::variable_list&& grads) override;
^~~~~
/home2/maskrcnn_benchmark.cpp/source/rcnn/layers/conv2d.cpp: In member function ‘torch::autograd::variable_list rcnn::layers::_NewEmptyTensorOpBackward::apply(torch::autograd::variable_list&&)’:
/home2/maskrcnn_benchmark.cpp/source/rcnn/layers/conv2d.cpp:16:9: error: ‘should_compute_output’ was not declared in this scope
if (should_compute_output(0)) {
^~~~~~~~~~~~~~~~~~~~~
/home2/maskrcnn_benchmark.cpp/source/rcnn/layers/conv2d.cpp: In function ‘at::Tensor rcnn::layers::_NewEmptyTensorOp(at::Tensor, c10::IntArrayRef)’:
/home2/maskrcnn_benchmark.cpp/source/rcnn/layers/conv2d.cpp:55:113: error: ‘deleteFunction’ is not a member of ‘torch::autograd’
auto grad_fn = std::shared_ptr<_NewEmptyTensorOpBackward>(new _NewEmptyTensorOpBackward(), torch::autograd::deleteFunction);
^~~~~~~~~~~~~~
/home2/maskrcnn_benchmark.cpp/source/rcnn/layers/conv2d.cpp:55:113: note: suggested alternative: ‘TraceableFunction’
auto grad_fn = std::shared_ptr<_NewEmptyTensorOpBackward>(new _NewEmptyTensorOpBackward(), torch::autograd::deleteFunction);
^~~~~~~~~~~~~~
TraceableFunction
source/rcnn/layers/CMakeFiles/layers.dir/build.make:75: recipe for target 'source/rcnn/layers/CMakeFiles/layers.dir/conv2d.cpp.o' failed
make[2]: *** [source/rcnn/layers/CMakeFiles/layers.dir/conv2d.cpp.o] Error 1
CMakeFiles/Makefile2:342: recipe for target 'source/rcnn/layers/CMakeFiles/layers.dir/all' failed
make[1]: *** [source/rcnn/layers/CMakeFiles/layers.dir/all] Error 2
Makefile:129: recipe for target 'all' failed
make: *** [all] Error 2
How to convert the model trained in python into c++ format, and then whether the inference will affect the result of inference?Can I use Windows to do this?
[ 1%] Building CXX object source/rcnn/layers/CMakeFiles/layers.dir/batch_norm.cpp.o
[ 2%] Building CXX object source/rcnn/layers/CMakeFiles/layers.dir/conv2d.cpp.o
In file included from /home/b324-no2/lg/maskrcnn_benchmark.cpp-master/source/rcnn/layers/conv2d.cpp:1:0:
/home/b324-no2/lg/maskrcnn_benchmark.cpp-master/source/rcnn/layers/../../../include/rcnn/layers/conv2d.h:9:59: error: expected template-name before ‘<’ token
class _NewEmptyTensorOp : public torch::autograd::Function<_NewEmptyTensorOp> {
^
/home/b324-no2/lg/maskrcnn_benchmark.cpp-master/source/rcnn/layers/../../../include/rcnn/layers/conv2d.h:9:59: error: expected ‘{’ before ‘<’ token
/home/b324-no2/lg/maskrcnn_benchmark.cpp-master/source/rcnn/layers/../../../include/rcnn/layers/conv2d.h:9:59: error: expected unqualified-id before ‘<’ token
/home/b324-no2/lg/maskrcnn_benchmark.cpp-master/source/rcnn/layers/conv2d.cpp:42:1: error: expected ‘}’ at end of input
} // namespace rcnn
^
/home/b324-no2/lg/maskrcnn_benchmark.cpp-master/source/rcnn/layers/conv2d.cpp:42:1: error: expected ‘}’ at end of input
make[2]: *** [source/rcnn/layers/CMakeFiles/layers.dir/build.make:76: source/rcnn/layers/CMakeFiles/layers.dir/conv2d.cpp.o] Error 1
make[2]: Leaving directory '/home/b324-no2/lg/maskrcnn_benchmark.cpp-master/build'
make[1]: *** [CMakeFiles/Makefile2:343: source/rcnn/layers/CMakeFiles/layers.dir/all] Error 2
make[1]: Leaving directory '/home/b324-no2/lg/maskrcnn_benchmark.cpp-master/build'
make: *** [Makefile:130: all] Error 2
please help me ,tks!!!!
Hi, I noticed you reimplemented torch::nn::parallel::parallel_apply(). Is it supposed to be for multi-threaded evaluation? In general I wonder what would be the benefit od multi-threaded inference in C++ in comparision to Python?
Regards,
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.