nncf icon indicating copy to clipboard operation
nncf copied to clipboard

Enable to load models with low opset version

Open sungchul2 opened this issue 2 years ago • 4 comments

Changes

  • Enable to load models with low opset version
  • Add to change tensor shape in Accuracy

Reason for changes

  1. The models with opset==7, 8, 9 have not only input tensor, but also every weight and bias in original_model.graph.input. But the model with opset==12, which have only input tensor in original_model.graph.input, can be only loaded. <opset==7, 8, 9> image <opset==12> image

  2. densenets output a 4d tensor , but Accuracy metric cannot use it because it can only handle a 2d tensor.

Related tickets

88636

Tests

sungchul2 avatar Aug 02 '22 08:08 sungchul2

@sungchul2 thanks! Could you also add a test that will failed without your fix and pass with it?

kshpv avatar Aug 02 '22 15:08 kshpv

@sungchul2 Please rebase this PR on the latest develop branch and push again. This is because of https://github.com/openvinotoolkit/nncf/pull/1248.

vinnamkim avatar Aug 10 '22 04:08 vinnamkim

run tensorflow pre-commit tests

sungchul2 avatar Aug 12 '22 07:08 sungchul2

run pytorch pre-commit tests

sungchul2 avatar Aug 12 '22 08:08 sungchul2

@sungchul2 , do you plan to finalize this PR?

MaximProshin avatar Aug 17 '22 11:08 MaximProshin

run pytorch pre-commit tests

sungchul2 avatar Aug 24 '22 00:08 sungchul2

@kshpv I saw models from torchvision just have single input, not multiple inputs, and it is not the purpose of this ticket. So, I changed them to models from onnx model zoo, which directly have had this issue, such as densenet.

And I added Mask R-CNN and yolov3 for test as you requested. These models have dynamic input_shape and have been converted with high opset version (10, 12). So, I separately added a test for them and renamed the test file.

sungchul2 avatar Sep 01 '22 05:09 sungchul2

@sungchul2 thank you for the PR. It looks very good!

kshpv avatar Sep 01 '22 09:09 kshpv

retest this please

sungchul2 avatar Sep 02 '22 02:09 sungchul2