libtorch C++, fasterrcnn_resnet50_fpn module.forward() Assert
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 17.9k
- Forks
- 7.3k
- Avg merge
- 1d 15h
- Merged PRs (30d)
- 13
Description
🐛 Bug
module.forward() launches Debug assert
File: minkernel\crts\ucrt\src\appcrt\heap\debug_heap.cpp
Line: 966
Expression: __acrt_first_block == header
To Reproduce
Loaded scripted model with
torch::jit::script::Module module;
try {
module = torch::jit::load(model_path);
}
catch (const c10::Error& e) {
std::cerr << e.what();
return -1;
}
module.eval();
Loaded image into tensor with
cv::Mat image;
cv::Mat3f image_32fc3;
image = cv::imread(image_path, cv::IMREAD_COLOR);
auto h = image.rows;
auto w = image.cols;
auto c = image.channels();
image.convertTo(image_32fc3, CV_32FC3, 1.0f / 255.0f);
at::Tensor inputTensor = torch::from_blob(image_32fc3.data, { 1, h, w, c });
inputTensor = inputTensor.permute({ 0, 3, 1, 2 });
torch::DeviceType device_type = torch::kCPU;
inputTensor = inputTensor.to(device_type);
Both model and tensor seem to be loaded correctly anyway
std::vector<torch::jit::IValue> input_to_net;
input_to_net.push_back(inputTensor);
at::Tensor output = module.forward(input_to_net).toTensor();
does not work.
call stack is:

Environment
OS: Microsoft Windows 7 Professional
Language: C++
CMake version: version 3.17.1
Python version: 3.7 (64-bit runtime)
Is CUDA available: N/A
numpy==1.18.5
torch==1.7.1+cpu
torchaudio==0.7.2
torchvision==nightly
Python version:
Additional context
cc @vfdev-5
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing module.forward() with the scripted fasterrcnn_resnet50_fpn model and input construction shown in the issue. Inspect the Windows debug assertion and call stack under the listed torch 1.7.1+cpu and torchvision nightly environment. Done means isolating the cause of the heap assertion and documenting or validating a fix.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp, opencv, pytorch
- Domain
- computer-vision
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100