Skip to content

Additional support for custom network architectures - #176

Open
nightduck wants to merge 3 commits into
ceccocats:masterfrom
nightduck:custom_arch_support
Open

Additional support for custom network architectures#176
nightduck wants to merge 3 commits into
ceccocats:masterfrom
nightduck:custom_arch_support

Conversation

@nightduck

Copy link
Copy Markdown

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
Copy Markdown
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

nightduck commented Jan 10, 2021

Copy link
Copy Markdown
Author

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
nightduck force-pushed the custom_arch_support branch from 454e72a to 04a5823 Compare January 12, 2021 15:44
@nightduck

nightduck commented Apr 28, 2021

Copy link
Copy Markdown
Author

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