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

Additional support for custom network architectures #176

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

nightduck
Copy link

This fixes 2 issues: one where NetworkRT hardcodes the names of input and output layers (issue #154), and another where it permits use of 2D layers, like fully-connected layers (issue #175)

@nightduck
Copy link
Author

NetworkRT.cpp, as is, assumes the batch dimension to be 1. The yolo models in this repo follow that convention, and I have not editted them, lest this PR be too disruptive. But other TensorRT engines generated through other means may not keep to this convention. Or if they do, they may explicity declare the batch dimension (eg 1x3x224x224). Keras works this way. When NetworkRT loads in their dimensions, you get:

n: 1
c: 1
h: 3
w: 224
l: 224

A PR that says "adds suppport for custom network architectures" and still forces them to have an omitted batch dimension is misleading. This likely shouldn't be accepted until that is adressed.

@nightduck
Copy link
Author

nightduck commented Jan 10, 2021

Added another commit that will, by default, assume the TensorRT engine does not specify the batch dimension. (This is the current default behaviour in master branch). However, it also allows the developer to specify that the batch dimension is present, or that the dimensions are in channel-last order.

When creating a NetworkRT object, you can specify the dimension format: CHW (default), NCHW, or NHWC. The latter is useful for TensorRT files that were exported from keras

I've removed channels last format, since this is built in for intermediate layers. So this recent commit only specifies whether the TensorRT engine includes the batch dimension

@nightduck
Copy link
Author

nightduck commented Apr 28, 2021

In retrospect, this PR is garbage, don't pull it. But the 1st commit is a good fix for issue #175, shall I remove the other two? Or just trash this PR and provide a patch instead?

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.

1 participant