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

Sanitize NN output (NaN, Infinite); handle corrupted frames #18

Merged
merged 6 commits into from
May 12, 2020

Conversation

SzabolcsGergely
Copy link
Collaborator

Discard NN output if it is NaN or Infinite.
Internal frame queue size was reduced from 100 to 30.

@SzabolcsGergely SzabolcsGergely changed the title Sanitize nn output Sanitize NN output (NaN, Infinite); handle corrupted frames May 8, 2020
@SzabolcsGergely SzabolcsGergely merged commit 1022dbb into master May 12, 2020
@SzabolcsGergely SzabolcsGergely deleted the sanitize-nn-output branch May 12, 2020 15:23
@ConnorChristie
Copy link
Contributor

@szabi-luxonis I just pulled this latest code down and am now getting compilation errors in tensor_entry.hpp due to the new usage of isnan and isinf.

In file included from /root/build/3rdparty/depthai-api/host/core/pipeline/../nnet/nnet_packet.hpp:9:0,
                 from /root/build/3rdparty/depthai-api/host/core/pipeline/cnn_host_pipeline.hpp:8,
                 from /root/build/3rdparty/depthai-api/host/core/pipeline/cnn_host_pipeline.cpp:3:
/root/build/3rdparty/depthai-api/host/core/pipeline/../nnet/tensor_entry.hpp: In member function 'bool TensorEntry::checkValidTensorEntry() const':
/root/build/3rdparty/depthai-api/host/core/pipeline/../nnet/tensor_entry.hpp:53:33: error: 'isnan' was not declared in this scope
             if(isnan(tensorValue) || isinf(tensorValue))
                                 ^
/root/build/3rdparty/depthai-api/host/core/pipeline/../nnet/tensor_entry.hpp:53:55: error: 'isinf' was not declared in this scope
             if(isnan(tensorValue) || isinf(tensorValue))
                                                       ^
CMakeFiles/cpp_drone_depthai.dir/build.make:218: recipe for target 'CMakeFiles/cpp_drone_depthai.dir/3rdparty/depthai-api/host/core/pipeline/cnn_host_pipeline.cpp.o' failed
make[2]: *** [CMakeFiles/cpp_drone_depthai.dir/3rdparty/depthai-api/host/core/pipeline/cnn_host_pipeline.cpp.o] Error 1
make[2]: *** Waiting for unfinished jobs....
In file included from /root/build/3rdparty/depthai-api/host/core/../core/pipeline/../nnet/nnet_packet.hpp:9:0,
                 from /root/build/3rdparty/depthai-api/host/core/../core/pipeline/cnn_host_pipeline.hpp:8,
                 from /root/build/depthai_core.hpp:5,
                 from /root/build/depthai_core.cpp:1:
/root/build/3rdparty/depthai-api/host/core/../core/pipeline/../nnet/tensor_entry.hpp: In member function 'bool TensorEntry::checkValidTensorEntry() const':
/root/build/3rdparty/depthai-api/host/core/../core/pipeline/../nnet/tensor_entry.hpp:53:33: error: 'isnan' was not declared in this scope
             if(isnan(tensorValue) || isinf(tensorValue))
                                 ^
/root/build/3rdparty/depthai-api/host/core/../core/pipeline/../nnet/tensor_entry.hpp:53:55: error: 'isinf' was not declared in this scope
             if(isnan(tensorValue) || isinf(tensorValue))
                                                       ^

Is this working on your end because I have to add an include to math.h for it to work.

@SzabolcsGergely
Copy link
Collaborator Author

@ConnorChristie yes, it does, on all 3 OSes (Linux, MacOS, Windows). But I should have included math.h, I will fix it next week.
If i understand correctly you are building cpp code, right ? It's something that we have on our roadmap, to update our outdated host code in host/app

@ConnorChristie
Copy link
Contributor

@szabi-luxonis Thank you and yes, I am building a C++ app. And I can't wait for the C++ side of the API to come. I currently have to copy and paste the python initialization logic that's done inside of py_bindings.cpp to something like this: https://github.com/ConnorChristie/drone-depthai/blob/master/depthai_core.cpp since I don't want to have to include the python binding in my final binary.

@themarpe
Copy link
Collaborator

@ConnorChristie if you are not relying on latest features, there is a branch called "refactor" which addresses the issue of having logic in python bindings among other things. It is still under development, so changes in API are expected. I'll also update it with upstream changes from master in a close future, as it is currently a bit behind.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants