Skip to content

Commit

Permalink
Update Yolov8 ignored scope utilizing subgraphs approach (#2610)
Browse files Browse the repository at this point in the history
### Changes

Change ingored_scope utilizing node names to subgraph.

### Reason for changes

New ignored_scope is independent on export to OpenVINO format (dynamic,
static)

### Related tickets

136835

### Tests

Manually tested
  • Loading branch information
kshpv authored Apr 16, 2024
1 parent 8cb9457 commit 47342f2
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 42 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -195,20 +195,17 @@ def validation_ac(
preset=nncf.QuantizationPreset.MIXED,
ignored_scope=nncf.IgnoredScope(
types=["Mul", "Sub", "Sigmoid"], # ignore operations
names=[
"/model.22/dfl/conv/Conv", # in the post-processing subgraph
"/model.22/Add",
"/model.22/Add_1",
"/model.22/Add_2",
"/model.22/Add_3",
"/model.22/Add_4",
"/model.22/Add_5",
"/model.22/Add_6",
"/model.22/Add_7",
"/model.22/Add_8",
"/model.22/Add_9",
"/model.22/Add_10",
"/model.22/Add_11",
subgraphs=[
nncf.Subgraph(
inputs=[
"/model.22/Concat_3",
"/model.22/Concat_6",
"/model.22/Concat_24",
"/model.22/Concat_5",
"/model.22/Concat_4",
],
outputs=["/model.22/Concat_29"],
)
],
),
)
Expand Down
20 changes: 6 additions & 14 deletions examples/post_training_quantization/openvino/yolov8/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,20 +122,12 @@ def transform_fn(data_item: Dict):
quantization_dataset,
preset=nncf.QuantizationPreset.MIXED,
ignored_scope=nncf.IgnoredScope(
types=["Multiply", "Subtract", "Sigmoid"], # ignore operations
names=[
"/model.22/dfl/conv/Conv", # in the post-processing subgraph
"/model.22/Add",
"/model.22/Add_1",
"/model.22/Add_2",
"/model.22/Add_3",
"/model.22/Add_4",
"/model.22/Add_5",
"/model.22/Add_6",
"/model.22/Add_7",
"/model.22/Add_8",
"/model.22/Add_9",
"/model.22/Add_10",
types=["Multiply", "Subtract", "Sigmoid"],
subgraphs=[
nncf.Subgraph(
inputs=["/model.22/Concat", "/model.22/Concat_1", "/model.22/Concat_2"],
outputs=["output0/sink_port_0"],
)
],
),
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -186,20 +186,17 @@ def validation_ac(
preset=nncf.QuantizationPreset.MIXED,
ignored_scope=nncf.IgnoredScope(
types=["Multiply", "Subtract", "Sigmoid"], # ignore operations
names=[
"/model.22/dfl/conv/Conv", # in the post-processing subgraph
"/model.22/Add",
"/model.22/Add_1",
"/model.22/Add_2",
"/model.22/Add_3",
"/model.22/Add_4",
"/model.22/Add_5",
"/model.22/Add_6",
"/model.22/Add_7",
"/model.22/Add_8",
"/model.22/Add_9",
"/model.22/Add_10",
"/model.22/Add_11",
subgraphs=[
nncf.Subgraph(
inputs=[
"/model.22/Concat_3",
"/model.22/Concat_6",
"/model.22/Concat_24",
"/model.22/Concat_5",
"/model.22/Concat_4",
],
outputs=["output0"],
)
],
),
)
Expand Down

0 comments on commit 47342f2

Please sign in to comment.