Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

wait first frame result to avoid empty result while dual_buf is true. #69

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions components/nn/include/maix_nn.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -334,6 +334,7 @@ namespace maix::nn
private:
MUD _mud;
NNBase *_impl;
bool wait_first; // wait result for first frame
};

}; // namespace maix::nn
5 changes: 5 additions & 0 deletions components/nn/src/maix_nn.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ namespace maix::nn

NN::NN(const std::string &model_path, bool dual_buff)
{
wait_first = dual_buff; // if dual_buff is true, wait first frame result
_impl = nullptr;
#if PLATFORM_MAIXCAM
_impl = new NN_MaixCam(dual_buff);
Expand Down Expand Up @@ -201,6 +202,10 @@ namespace maix::nn

tensor::Tensors *NN::forward_image(image::Image &img, std::vector<float> mean, std::vector<float> scale, image::Fit fit, bool copy_result, bool dual_buff_wait)
{
if(wait_first){
wait_first = false;
dual_buff_wait = true; // wait first frame result , to avoid empty return
}
return _impl->forward_image(img, mean, scale, fit, copy_result, dual_buff_wait);
}

Expand Down
Loading