Hahn-Schickard/Automatic-Structured-Pruning

Towards Supporting Skip Connections

vse-motec opened this issue · 6 comments

I am currently working an adding support to prune networks with skip connections.
If you are interested, I can provide all steps towards this goal as individual pull requests (as soon as I have them).

The first step is checking each layers's parent during filter / node deletion in the functions "delete_filter" and "delete_dense_neuron".
So far, these functions assume that a layer at index (i+1) has its parent at index i. However, since this is not the case for skip connections, we have to add parent layer checking.

This additional check should not affect your code in a negative way. I can provide the corresponding pull request for you to run your tests.

Hi, this sounds very interesting, If you want to be a part of the development, we would be very happy.

Kind regards
Daniel

Hello, yes, I would like to contribute. Short update: there has been a delay because I was working on an outdated version of this repository. Need some more testing that the merge went smoothly. Get back to this next week.
Best regards,
Viktor

Hello again,

I have implemented a preliminary version that allows handling networks with skip connections (but not the connections itself, yet).
In more detail:

  • when parsing the network structure in the beginning I collect information on each layer
  • this information comprises its parent node(s) and its child node(s)
  • also (for now): for conv layers it is important to know whether it is the last conv layer before a branch (outgoing skip connection) or whether it is the first conv layer after a merge (incoming skip connection) - these conv layers can not be pruned for now
  • when deleting filters this parent-child information is used to find the correct layers
  • conv layers are not pruned if they are the output layers

However, all conv layers that are not last before branch or first after merge can be pruned. This allows the software to handle networks with skip connections without failing. I have tested it with a (functional) Yolov3 model and with the (sequential) model that you provide in the Jupyther notebook - both work fine.

Please review my changes and give me some feedback. I suggest for now to create a separate experimental branch and not yet merge into main. Also the code formatting might not be completely in your style. I will improve this in a future pull request.

Best regards
Viktor

Hi and sorry for the late answer.
Thank you very much for your work. We can also discuss it in a call.

Best regards
Daniel

Hi all,
I have now added the missing functionality to prune all conv layers. So far only tested with the provided Jupyter Notebook (sequential model) and with YoloV3 (functional model).
Best regards
Viktor

Hey,
thank you very much for your work and the second pull request.

Best regards
Daniel