diff --git a/app/build.gradle.kts b/app/build.gradle.kts index 699e52e..8494af8 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -36,5 +36,5 @@ dependencies { implementation("com.google.mlkit:face-detection:16.1.7") implementation("org.jetbrains.kotlinx:kotlinx-coroutines-android:1.9.0") implementation("org.jetbrains.kotlinx:kotlinx-coroutines-play-services:1.9.0") - implementation("org.tensorflow:tensorflow-lite:2.16.1") + implementation("com.google.ai.edge.litert:litert:2.0.3") } diff --git a/app/src/main/assets/facenet_512.tflite b/app/src/main/assets/facenet_512.tflite deleted file mode 100644 index 8e48044..0000000 Binary files a/app/src/main/assets/facenet_512.tflite and /dev/null differ diff --git a/app/src/main/assets/facenet_512_int_quantized.tflite b/app/src/main/assets/facenet_512_int_quantized.tflite deleted file mode 100644 index d933171..0000000 Binary files a/app/src/main/assets/facenet_512_int_quantized.tflite and /dev/null differ diff --git a/app/src/main/assets/facenet_int_quantized.tflite b/app/src/main/assets/facenet_int_quantized.tflite deleted file mode 100644 index efa25d5..0000000 Binary files a/app/src/main/assets/facenet_int_quantized.tflite and /dev/null differ diff --git a/app/src/main/assets/glint360k_r50.onnx b/app/src/main/assets/glint360k_r50.onnx deleted file mode 100644 index f521a0d..0000000 Binary files a/app/src/main/assets/glint360k_r50.onnx and /dev/null differ diff --git a/app/src/main/assets/glint360k_r50_float16.tflite b/app/src/main/assets/glint360k_r50_float16.tflite deleted file mode 100644 index e27d4f4..0000000 Binary files a/app/src/main/assets/glint360k_r50_float16.tflite and /dev/null differ diff --git a/app/src/main/assets/glint360k_r50_float32.tflite b/app/src/main/assets/glint360k_r50_float32.tflite deleted file mode 100644 index 3f77702..0000000 Binary files a/app/src/main/assets/glint360k_r50_float32.tflite and /dev/null differ diff --git a/app/src/main/assets/glint360k_r50_tensor_correspondence_report.json b/app/src/main/assets/glint360k_r50_tensor_correspondence_report.json deleted file mode 100644 index 71976b9..0000000 --- a/app/src/main/assets/glint360k_r50_tensor_correspondence_report.json +++ /dev/null @@ -1,6555 +0,0 @@ -{ - "schema_version": 1, - "summary": { - "total_onnx_node_outputs": 130, - "direct_count": 6, - "rewritten_count": 124, - "inferred_count": 0, - "missing_count": 0, - "rewritten_but_missing_count": 0, - "lineage_event_count": 302 - }, - "lineage_events": [ - { - "kind": "prune_unused_tensors", - "removed_names": [ - "input.1_onnx_ncx_internal", - "input.1_onnx_ncx_internal_perm", - "685", - "686", - "843", - "layer1.0.bn1.weight", - "layer1.0.bn1.bias", - "layer1.0.bn1.running_mean", - "layer1.0.bn1.running_var", - "694", - "695", - "688", - "689", - "844", - "691", - "692", - "layer1.1.bn1.weight", - "layer1.1.bn1.bias", - "layer1.1.bn1.running_mean", - "layer1.1.bn1.running_var", - "697", - "698", - "845", - "700", - "701", - "layer1.2.bn1.weight", - "layer1.2.bn1.bias", - "layer1.2.bn1.running_mean", - "layer1.2.bn1.running_var", - "703", - "704", - "846", - "706", - "707", - "layer2.0.bn1.weight", - "layer2.0.bn1.bias", - "layer2.0.bn1.running_mean", - "layer2.0.bn1.running_var", - "715", - "716", - "709", - "710", - "847", - "712", - "713", - "layer2.1.bn1.weight", - "layer2.1.bn1.bias", - "layer2.1.bn1.running_mean", - "layer2.1.bn1.running_var", - "718", - "719", - "848", - "721", - "722", - "layer2.2.bn1.weight", - "layer2.2.bn1.bias", - "layer2.2.bn1.running_mean", - "layer2.2.bn1.running_var", - "724", - "725", - "849", - "727", - "728", - "layer2.3.bn1.weight", - "layer2.3.bn1.bias", - "layer2.3.bn1.running_mean", - "layer2.3.bn1.running_var", - "730", - "731", - "850", - "733", - "734", - "layer3.0.bn1.weight", - "layer3.0.bn1.bias", - "layer3.0.bn1.running_mean", - "layer3.0.bn1.running_var", - "742", - "743", - "736", - "737", - "851", - "739", - "740", - "layer3.1.bn1.weight", - "layer3.1.bn1.bias", - "layer3.1.bn1.running_mean", - "layer3.1.bn1.running_var", - "745", - "746", - "852", - "748", - "749", - "layer3.2.bn1.weight", - "layer3.2.bn1.bias", - "layer3.2.bn1.running_mean", - "layer3.2.bn1.running_var", - "751", - "752", - "853", - "754", - "755", - "layer3.3.bn1.weight", - "layer3.3.bn1.bias", - "layer3.3.bn1.running_mean", - "layer3.3.bn1.running_var", - "757", - "758", - "854", - "760", - "761", - "layer3.4.bn1.weight", - "layer3.4.bn1.bias", - "layer3.4.bn1.running_mean", - "layer3.4.bn1.running_var", - "763", - "764", - "855", - "766", - "767", - "layer3.5.bn1.weight", - "layer3.5.bn1.bias", - "layer3.5.bn1.running_mean", - "layer3.5.bn1.running_var", - "769", - "770", - "856", - "772", - "773", - "layer3.6.bn1.weight", - "layer3.6.bn1.bias", - "layer3.6.bn1.running_mean", - "layer3.6.bn1.running_var", - "775", - "776", - "857", - "778", - "779", - "layer3.7.bn1.weight", - "layer3.7.bn1.bias", - "layer3.7.bn1.running_mean", - "layer3.7.bn1.running_var", - "781", - "782", - "858", - "784", - "785", - "layer3.8.bn1.weight", - "layer3.8.bn1.bias", - "layer3.8.bn1.running_mean", - "layer3.8.bn1.running_var", - "787", - "788", - "859", - "790", - "791", - "layer3.9.bn1.weight", - "layer3.9.bn1.bias", - "layer3.9.bn1.running_mean", - "layer3.9.bn1.running_var", - "793", - "794", - "860", - "796", - "797", - "layer3.10.bn1.weight", - "layer3.10.bn1.bias", - "layer3.10.bn1.running_mean", - "layer3.10.bn1.running_var", - "799", - "800", - "861", - "802", - "803", - "layer3.11.bn1.weight", - "layer3.11.bn1.bias", - "layer3.11.bn1.running_mean", - "layer3.11.bn1.running_var", - "805", - "806", - "862", - "808", - "809", - "layer3.12.bn1.weight", - "layer3.12.bn1.bias", - "layer3.12.bn1.running_mean", - "layer3.12.bn1.running_var", - "811", - "812", - "863", - "814", - "815", - "layer3.13.bn1.weight", - "layer3.13.bn1.bias", - "layer3.13.bn1.running_mean", - "layer3.13.bn1.running_var", - "817", - "818", - "864", - "820", - "821", - "layer4.0.bn1.weight", - "layer4.0.bn1.bias", - "layer4.0.bn1.running_mean", - "layer4.0.bn1.running_var", - "829", - "830", - "823", - "824", - "865", - "826", - "827", - "layer4.1.bn1.weight", - "layer4.1.bn1.bias", - "layer4.1.bn1.running_mean", - "layer4.1.bn1.running_var", - "832", - "833", - "866", - "835", - "836", - "layer4.2.bn1.weight", - "layer4.2.bn1.bias", - "layer4.2.bn1.running_mean", - "layer4.2.bn1.running_var", - "838", - "839", - "867", - "841", - "842", - "bn2.weight", - "bn2.bias", - "bn2.running_mean", - "bn2.running_var", - "fc.weight", - "fc.bias", - "features.weight", - "features.bias", - "features.running_mean", - "features.running_var", - "Conv_0_input_nhwc" - ], - "event_index": 0 - }, - { - "kind": "replace_input", - "src_name": "684", - "dst_name": "Conv_0_output_nhwc", - "source": "set_operator_inputs", - "event_index": 1 - }, - { - "kind": "rename_tensor", - "old_name": "479", - "new_name": "Conv_6_input_nhwc", - "source": "set_operator_outputs", - "event_index": 2 - }, - { - "kind": "replace_input", - "src_name": "479", - "dst_name": "Conv_6_input_nhwc", - "source": "set_operator_inputs", - "event_index": 3 - }, - { - "kind": "rename_tensor", - "old_name": "Conv_6_input_nhwc", - "new_name": "479", - "source": "set_operator_outputs", - "event_index": 4 - }, - { - "kind": "replace_input", - "src_name": "687", - "dst_name": "Conv_3_output_nhwc", - "source": "set_operator_inputs", - "event_index": 5 - }, - { - "kind": "rename_tensor", - "old_name": "484", - "new_name": "Conv_5_input_nhwc", - "source": "set_operator_outputs", - "event_index": 6 - }, - { - "kind": "replace_input", - "src_name": "696", - "dst_name": "Conv_9_output_nhwc", - "source": "set_operator_inputs", - "event_index": 7 - }, - { - "kind": "rename_tensor", - "old_name": "494", - "new_name": "Conv_11_input_nhwc", - "source": "set_operator_outputs", - "event_index": 8 - }, - { - "kind": "replace_input", - "src_name": "702", - "dst_name": "Conv_14_output_nhwc", - "source": "set_operator_inputs", - "event_index": 9 - }, - { - "kind": "rename_tensor", - "old_name": "502", - "new_name": "Conv_16_input_nhwc", - "source": "set_operator_outputs", - "event_index": 10 - }, - { - "kind": "replace_input", - "src_name": "708", - "dst_name": "Conv_19_output_nhwc", - "source": "set_operator_inputs", - "event_index": 11 - }, - { - "kind": "rename_tensor", - "old_name": "510", - "new_name": "Conv_21_input_nhwc", - "source": "set_operator_outputs", - "event_index": 12 - }, - { - "kind": "replace_input", - "src_name": "717", - "dst_name": "Conv_25_output_nhwc", - "source": "set_operator_inputs", - "event_index": 13 - }, - { - "kind": "rename_tensor", - "old_name": "520", - "new_name": "Conv_27_input_nhwc", - "source": "set_operator_outputs", - "event_index": 14 - }, - { - "kind": "replace_input", - "src_name": "723", - "dst_name": "Conv_30_output_nhwc", - "source": "set_operator_inputs", - "event_index": 15 - }, - { - "kind": "rename_tensor", - "old_name": "528", - "new_name": "Conv_32_input_nhwc", - "source": "set_operator_outputs", - "event_index": 16 - }, - { - "kind": "replace_input", - "src_name": "729", - "dst_name": "Conv_35_output_nhwc", - "source": "set_operator_inputs", - "event_index": 17 - }, - { - "kind": "rename_tensor", - "old_name": "536", - "new_name": "Conv_37_input_nhwc", - "source": "set_operator_outputs", - "event_index": 18 - }, - { - "kind": "replace_input", - "src_name": "735", - "dst_name": "Conv_40_output_nhwc", - "source": "set_operator_inputs", - "event_index": 19 - }, - { - "kind": "rename_tensor", - "old_name": "544", - "new_name": "Conv_42_input_nhwc", - "source": "set_operator_outputs", - "event_index": 20 - }, - { - "kind": "replace_input", - "src_name": "744", - "dst_name": "Conv_46_output_nhwc", - "source": "set_operator_inputs", - "event_index": 21 - }, - { - "kind": "rename_tensor", - "old_name": "554", - "new_name": "Conv_48_input_nhwc", - "source": "set_operator_outputs", - "event_index": 22 - }, - { - "kind": "replace_input", - "src_name": "750", - "dst_name": "Conv_51_output_nhwc", - "source": "set_operator_inputs", - "event_index": 23 - }, - { - "kind": "rename_tensor", - "old_name": "562", - "new_name": "Conv_53_input_nhwc", - "source": "set_operator_outputs", - "event_index": 24 - }, - { - "kind": "replace_input", - "src_name": "756", - "dst_name": "Conv_56_output_nhwc", - "source": "set_operator_inputs", - "event_index": 25 - }, - { - "kind": "rename_tensor", - "old_name": "570", - "new_name": "Conv_58_input_nhwc", - "source": "set_operator_outputs", - "event_index": 26 - }, - { - "kind": "replace_input", - "src_name": "762", - "dst_name": "Conv_61_output_nhwc", - "source": "set_operator_inputs", - "event_index": 27 - }, - { - "kind": "rename_tensor", - "old_name": "578", - "new_name": "Conv_63_input_nhwc", - "source": "set_operator_outputs", - "event_index": 28 - }, - { - "kind": "replace_input", - "src_name": "768", - "dst_name": "Conv_66_output_nhwc", - "source": "set_operator_inputs", - "event_index": 29 - }, - { - "kind": "rename_tensor", - "old_name": "586", - "new_name": "Conv_68_input_nhwc", - "source": "set_operator_outputs", - "event_index": 30 - }, - { - "kind": "replace_input", - "src_name": "774", - "dst_name": "Conv_71_output_nhwc", - "source": "set_operator_inputs", - "event_index": 31 - }, - { - "kind": "rename_tensor", - "old_name": "594", - "new_name": "Conv_73_input_nhwc", - "source": "set_operator_outputs", - "event_index": 32 - }, - { - "kind": "replace_input", - "src_name": "780", - "dst_name": "Conv_76_output_nhwc", - "source": "set_operator_inputs", - "event_index": 33 - }, - { - "kind": "rename_tensor", - "old_name": "602", - "new_name": "Conv_78_input_nhwc", - "source": "set_operator_outputs", - "event_index": 34 - }, - { - "kind": "replace_input", - "src_name": "786", - "dst_name": "Conv_81_output_nhwc", - "source": "set_operator_inputs", - "event_index": 35 - }, - { - "kind": "rename_tensor", - "old_name": "610", - "new_name": "Conv_83_input_nhwc", - "source": "set_operator_outputs", - "event_index": 36 - }, - { - "kind": "replace_input", - "src_name": "792", - "dst_name": "Conv_86_output_nhwc", - "source": "set_operator_inputs", - "event_index": 37 - }, - { - "kind": "rename_tensor", - "old_name": "618", - "new_name": "Conv_88_input_nhwc", - "source": "set_operator_outputs", - "event_index": 38 - }, - { - "kind": "replace_input", - "src_name": "798", - "dst_name": "Conv_91_output_nhwc", - "source": "set_operator_inputs", - "event_index": 39 - }, - { - "kind": "rename_tensor", - "old_name": "626", - "new_name": "Conv_93_input_nhwc", - "source": "set_operator_outputs", - "event_index": 40 - }, - { - "kind": "replace_input", - "src_name": "804", - "dst_name": "Conv_96_output_nhwc", - "source": "set_operator_inputs", - "event_index": 41 - }, - { - "kind": "rename_tensor", - "old_name": "634", - "new_name": "Conv_98_input_nhwc", - "source": "set_operator_outputs", - "event_index": 42 - }, - { - "kind": "replace_input", - "src_name": "810", - "dst_name": "Conv_101_output_nhwc", - "source": "set_operator_inputs", - "event_index": 43 - }, - { - "kind": "rename_tensor", - "old_name": "642", - "new_name": "Conv_103_input_nhwc", - "source": "set_operator_outputs", - "event_index": 44 - }, - { - "kind": "replace_input", - "src_name": "816", - "dst_name": "Conv_106_output_nhwc", - "source": "set_operator_inputs", - "event_index": 45 - }, - { - "kind": "rename_tensor", - "old_name": "650", - "new_name": "Conv_108_input_nhwc", - "source": "set_operator_outputs", - "event_index": 46 - }, - { - "kind": "replace_input", - "src_name": "822", - "dst_name": "Conv_111_output_nhwc", - "source": "set_operator_inputs", - "event_index": 47 - }, - { - "kind": "rename_tensor", - "old_name": "658", - "new_name": "Conv_113_input_nhwc", - "source": "set_operator_outputs", - "event_index": 48 - }, - { - "kind": "replace_input", - "src_name": "831", - "dst_name": "Conv_117_output_nhwc", - "source": "set_operator_inputs", - "event_index": 49 - }, - { - "kind": "rename_tensor", - "old_name": "668", - "new_name": "Conv_119_input_nhwc", - "source": "set_operator_outputs", - "event_index": 50 - }, - { - "kind": "replace_input", - "src_name": "837", - "dst_name": "Conv_122_output_nhwc", - "source": "set_operator_inputs", - "event_index": 51 - }, - { - "kind": "rename_tensor", - "old_name": "676", - "new_name": "Conv_124_input_nhwc", - "source": "set_operator_outputs", - "event_index": 52 - }, - { - "kind": "prune_unused_tensors", - "removed_names": [ - "684", - "684_perm", - "687", - "687_perm", - "484", - "Conv_5_input_nhwc_perm", - "696", - "696_perm", - "494", - "Conv_11_input_nhwc_perm", - "702", - "702_perm", - "502", - "Conv_16_input_nhwc_perm", - "708", - "708_perm", - "510", - "Conv_21_input_nhwc_perm", - "717", - "717_perm", - "520", - "Conv_27_input_nhwc_perm", - "723", - "723_perm", - "528", - "Conv_32_input_nhwc_perm", - "729", - "729_perm", - "536", - "Conv_37_input_nhwc_perm", - "735", - "735_perm", - "544", - "Conv_42_input_nhwc_perm", - "744", - "744_perm", - "554", - "Conv_48_input_nhwc_perm", - "750", - "750_perm", - "562", - "Conv_53_input_nhwc_perm", - "756", - "756_perm", - "570", - "Conv_58_input_nhwc_perm", - "762", - "762_perm", - "578", - "Conv_63_input_nhwc_perm", - "768", - "768_perm", - "586", - "Conv_68_input_nhwc_perm", - "774", - "774_perm", - "594", - "Conv_73_input_nhwc_perm", - "780", - "780_perm", - "602", - "Conv_78_input_nhwc_perm", - "786", - "786_perm", - "610", - "Conv_83_input_nhwc_perm", - "792", - "792_perm", - "618", - "Conv_88_input_nhwc_perm", - "798", - "798_perm", - "626", - "Conv_93_input_nhwc_perm", - "804", - "804_perm", - "634", - "Conv_98_input_nhwc_perm", - "810", - "810_perm", - "642", - "Conv_103_input_nhwc_perm", - "816", - "816_perm", - "650", - "Conv_108_input_nhwc_perm", - "822", - "822_perm", - "658", - "Conv_113_input_nhwc_perm", - "831", - "831_perm", - "668", - "Conv_119_input_nhwc_perm", - "837", - "837_perm", - "676", - "Conv_124_input_nhwc_perm" - ], - "event_index": 53 - }, - { - "kind": "prune_unused_tensors", - "removed_names": [ - "__nhwc_to_nchw_perm_rank4__" - ], - "event_index": 54 - }, - { - "kind": "replace_input", - "src_name": "BatchNormalization_2_mul_out", - "dst_name": "BatchNormalization_2_mul_out_nhwc_bridge", - "source": "set_operator_inputs", - "event_index": 55 - }, - { - "kind": "rename_tensor", - "old_name": "480", - "new_name": "Conv_3_input_nhwc", - "source": "set_operator_outputs", - "event_index": 56 - }, - { - "kind": "replace_input", - "src_name": "BatchNormalization_8_mul_out", - "dst_name": "BatchNormalization_8_mul_out_nhwc_bridge", - "source": "set_operator_inputs", - "event_index": 57 - }, - { - "kind": "rename_tensor", - "old_name": "490", - "new_name": "Conv_9_input_nhwc", - "source": "set_operator_outputs", - "event_index": 58 - }, - { - "kind": "replace_input", - "src_name": "BatchNormalization_13_mul_out", - "dst_name": "BatchNormalization_13_mul_out_nhwc_bridge", - "source": "set_operator_inputs", - "event_index": 59 - }, - { - "kind": "rename_tensor", - "old_name": "498", - "new_name": "Conv_14_input_nhwc", - "source": "set_operator_outputs", - "event_index": 60 - }, - { - "kind": "replace_input", - "src_name": "705", - "dst_name": "Conv_16_output_nhwc", - "source": "set_operator_inputs", - "event_index": 61 - }, - { - "kind": "replace_input", - "src_name": "497", - "dst_name": "497_nhwc_bridge", - "source": "set_operator_inputs", - "event_index": 62 - }, - { - "kind": "rename_tensor", - "old_name": "505", - "new_name": "Conv_22_input_nhwc", - "source": "set_operator_outputs", - "event_index": 63 - }, - { - "kind": "replace_input", - "src_name": "505", - "dst_name": "Conv_22_input_nhwc", - "source": "set_operator_inputs", - "event_index": 64 - }, - { - "kind": "rename_tensor", - "old_name": "Conv_22_input_nhwc", - "new_name": "505", - "source": "set_operator_outputs", - "event_index": 65 - }, - { - "kind": "replace_input", - "src_name": "699", - "dst_name": "Conv_11_output_nhwc", - "source": "set_operator_inputs", - "event_index": 66 - }, - { - "kind": "replace_input", - "src_name": "489", - "dst_name": "489_nhwc_bridge", - "source": "set_operator_inputs", - "event_index": 67 - }, - { - "kind": "rename_tensor", - "old_name": "497", - "new_name": "497_nhwc_bridge", - "source": "set_operator_outputs", - "event_index": 68 - }, - { - "kind": "replace_input", - "src_name": "497", - "dst_name": "497_nhwc_bridge", - "source": "set_operator_inputs", - "event_index": 69 - }, - { - "kind": "rename_tensor", - "old_name": "497_nhwc_bridge", - "new_name": "497", - "source": "set_operator_outputs", - "event_index": 70 - }, - { - "kind": "replace_input", - "src_name": "690", - "dst_name": "Conv_5_output_nhwc", - "source": "set_operator_inputs", - "event_index": 71 - }, - { - "kind": "replace_input", - "src_name": "693", - "dst_name": "Conv_6_output_nhwc", - "source": "set_operator_inputs", - "event_index": 72 - }, - { - "kind": "rename_tensor", - "old_name": "489", - "new_name": "489_nhwc_bridge", - "source": "set_operator_outputs", - "event_index": 73 - }, - { - "kind": "replace_input", - "src_name": "489", - "dst_name": "489_nhwc_bridge", - "source": "set_operator_inputs", - "event_index": 74 - }, - { - "kind": "rename_tensor", - "old_name": "489_nhwc_bridge", - "new_name": "489", - "source": "set_operator_outputs", - "event_index": 75 - }, - { - "kind": "replace_input", - "src_name": "505", - "dst_name": "Conv_22_input_nhwc", - "source": "set_operator_inputs", - "event_index": 76 - }, - { - "kind": "rename_tensor", - "old_name": "506", - "new_name": "Conv_19_input_nhwc", - "source": "set_operator_outputs", - "event_index": 77 - }, - { - "kind": "replace_input", - "src_name": "BatchNormalization_24_mul_out", - "dst_name": "BatchNormalization_24_mul_out_nhwc_bridge", - "source": "set_operator_inputs", - "event_index": 78 - }, - { - "kind": "rename_tensor", - "old_name": "516", - "new_name": "Conv_25_input_nhwc", - "source": "set_operator_outputs", - "event_index": 79 - }, - { - "kind": "replace_input", - "src_name": "BatchNormalization_29_mul_out", - "dst_name": "BatchNormalization_29_mul_out_nhwc_bridge", - "source": "set_operator_inputs", - "event_index": 80 - }, - { - "kind": "rename_tensor", - "old_name": "524", - "new_name": "Conv_30_input_nhwc", - "source": "set_operator_outputs", - "event_index": 81 - }, - { - "kind": "replace_input", - "src_name": "BatchNormalization_34_mul_out", - "dst_name": "BatchNormalization_34_mul_out_nhwc_bridge", - "source": "set_operator_inputs", - "event_index": 82 - }, - { - "kind": "rename_tensor", - "old_name": "532", - "new_name": "Conv_35_input_nhwc", - "source": "set_operator_outputs", - "event_index": 83 - }, - { - "kind": "replace_input", - "src_name": "732", - "dst_name": "Conv_37_output_nhwc", - "source": "set_operator_inputs", - "event_index": 84 - }, - { - "kind": "replace_input", - "src_name": "531", - "dst_name": "531_nhwc_bridge", - "source": "set_operator_inputs", - "event_index": 85 - }, - { - "kind": "rename_tensor", - "old_name": "539", - "new_name": "Conv_43_input_nhwc", - "source": "set_operator_outputs", - "event_index": 86 - }, - { - "kind": "replace_input", - "src_name": "539", - "dst_name": "Conv_43_input_nhwc", - "source": "set_operator_inputs", - "event_index": 87 - }, - { - "kind": "rename_tensor", - "old_name": "Conv_43_input_nhwc", - "new_name": "539", - "source": "set_operator_outputs", - "event_index": 88 - }, - { - "kind": "replace_input", - "src_name": "726", - "dst_name": "Conv_32_output_nhwc", - "source": "set_operator_inputs", - "event_index": 89 - }, - { - "kind": "replace_input", - "src_name": "523", - "dst_name": "523_nhwc_bridge", - "source": "set_operator_inputs", - "event_index": 90 - }, - { - "kind": "rename_tensor", - "old_name": "531", - "new_name": "531_nhwc_bridge", - "source": "set_operator_outputs", - "event_index": 91 - }, - { - "kind": "replace_input", - "src_name": "531", - "dst_name": "531_nhwc_bridge", - "source": "set_operator_inputs", - "event_index": 92 - }, - { - "kind": "rename_tensor", - "old_name": "531_nhwc_bridge", - "new_name": "531", - "source": "set_operator_outputs", - "event_index": 93 - }, - { - "kind": "replace_input", - "src_name": "720", - "dst_name": "Conv_27_output_nhwc", - "source": "set_operator_inputs", - "event_index": 94 - }, - { - "kind": "replace_input", - "src_name": "515", - "dst_name": "515_nhwc_bridge", - "source": "set_operator_inputs", - "event_index": 95 - }, - { - "kind": "rename_tensor", - "old_name": "523", - "new_name": "523_nhwc_bridge", - "source": "set_operator_outputs", - "event_index": 96 - }, - { - "kind": "replace_input", - "src_name": "523", - "dst_name": "523_nhwc_bridge", - "source": "set_operator_inputs", - "event_index": 97 - }, - { - "kind": "rename_tensor", - "old_name": "523_nhwc_bridge", - "new_name": "523", - "source": "set_operator_outputs", - "event_index": 98 - }, - { - "kind": "replace_input", - "src_name": "711", - "dst_name": "Conv_21_output_nhwc", - "source": "set_operator_inputs", - "event_index": 99 - }, - { - "kind": "replace_input", - "src_name": "714", - "dst_name": "Conv_22_output_nhwc", - "source": "set_operator_inputs", - "event_index": 100 - }, - { - "kind": "rename_tensor", - "old_name": "515", - "new_name": "515_nhwc_bridge", - "source": "set_operator_outputs", - "event_index": 101 - }, - { - "kind": "replace_input", - "src_name": "515", - "dst_name": "515_nhwc_bridge", - "source": "set_operator_inputs", - "event_index": 102 - }, - { - "kind": "rename_tensor", - "old_name": "515_nhwc_bridge", - "new_name": "515", - "source": "set_operator_outputs", - "event_index": 103 - }, - { - "kind": "replace_input", - "src_name": "539", - "dst_name": "Conv_43_input_nhwc", - "source": "set_operator_inputs", - "event_index": 104 - }, - { - "kind": "rename_tensor", - "old_name": "540", - "new_name": "Conv_40_input_nhwc", - "source": "set_operator_outputs", - "event_index": 105 - }, - { - "kind": "replace_input", - "src_name": "BatchNormalization_45_mul_out", - "dst_name": "BatchNormalization_45_mul_out_nhwc_bridge", - "source": "set_operator_inputs", - "event_index": 106 - }, - { - "kind": "rename_tensor", - "old_name": "550", - "new_name": "Conv_46_input_nhwc", - "source": "set_operator_outputs", - "event_index": 107 - }, - { - "kind": "replace_input", - "src_name": "BatchNormalization_50_mul_out", - "dst_name": "BatchNormalization_50_mul_out_nhwc_bridge", - "source": "set_operator_inputs", - "event_index": 108 - }, - { - "kind": "rename_tensor", - "old_name": "558", - "new_name": "Conv_51_input_nhwc", - "source": "set_operator_outputs", - "event_index": 109 - }, - { - "kind": "replace_input", - "src_name": "BatchNormalization_55_mul_out", - "dst_name": "BatchNormalization_55_mul_out_nhwc_bridge", - "source": "set_operator_inputs", - "event_index": 110 - }, - { - "kind": "rename_tensor", - "old_name": "566", - "new_name": "Conv_56_input_nhwc", - "source": "set_operator_outputs", - "event_index": 111 - }, - { - "kind": "replace_input", - "src_name": "BatchNormalization_60_mul_out", - "dst_name": "BatchNormalization_60_mul_out_nhwc_bridge", - "source": "set_operator_inputs", - "event_index": 112 - }, - { - "kind": "rename_tensor", - "old_name": "574", - "new_name": "Conv_61_input_nhwc", - "source": "set_operator_outputs", - "event_index": 113 - }, - { - "kind": "replace_input", - "src_name": "BatchNormalization_65_mul_out", - "dst_name": "BatchNormalization_65_mul_out_nhwc_bridge", - "source": "set_operator_inputs", - "event_index": 114 - }, - { - "kind": "rename_tensor", - "old_name": "582", - "new_name": "Conv_66_input_nhwc", - "source": "set_operator_outputs", - "event_index": 115 - }, - { - "kind": "replace_input", - "src_name": "BatchNormalization_70_mul_out", - "dst_name": "BatchNormalization_70_mul_out_nhwc_bridge", - "source": "set_operator_inputs", - "event_index": 116 - }, - { - "kind": "rename_tensor", - "old_name": "590", - "new_name": "Conv_71_input_nhwc", - "source": "set_operator_outputs", - "event_index": 117 - }, - { - "kind": "replace_input", - "src_name": "BatchNormalization_75_mul_out", - "dst_name": "BatchNormalization_75_mul_out_nhwc_bridge", - "source": "set_operator_inputs", - "event_index": 118 - }, - { - "kind": "rename_tensor", - "old_name": "598", - "new_name": "Conv_76_input_nhwc", - "source": "set_operator_outputs", - "event_index": 119 - }, - { - "kind": "replace_input", - "src_name": "BatchNormalization_80_mul_out", - "dst_name": "BatchNormalization_80_mul_out_nhwc_bridge", - "source": "set_operator_inputs", - "event_index": 120 - }, - { - "kind": "rename_tensor", - "old_name": "606", - "new_name": "Conv_81_input_nhwc", - "source": "set_operator_outputs", - "event_index": 121 - }, - { - "kind": "replace_input", - "src_name": "BatchNormalization_85_mul_out", - "dst_name": "BatchNormalization_85_mul_out_nhwc_bridge", - "source": "set_operator_inputs", - "event_index": 122 - }, - { - "kind": "rename_tensor", - "old_name": "614", - "new_name": "Conv_86_input_nhwc", - "source": "set_operator_outputs", - "event_index": 123 - }, - { - "kind": "replace_input", - "src_name": "BatchNormalization_90_mul_out", - "dst_name": "BatchNormalization_90_mul_out_nhwc_bridge", - "source": "set_operator_inputs", - "event_index": 124 - }, - { - "kind": "rename_tensor", - "old_name": "622", - "new_name": "Conv_91_input_nhwc", - "source": "set_operator_outputs", - "event_index": 125 - }, - { - "kind": "replace_input", - "src_name": "BatchNormalization_95_mul_out", - "dst_name": "BatchNormalization_95_mul_out_nhwc_bridge", - "source": "set_operator_inputs", - "event_index": 126 - }, - { - "kind": "rename_tensor", - "old_name": "630", - "new_name": "Conv_96_input_nhwc", - "source": "set_operator_outputs", - "event_index": 127 - }, - { - "kind": "replace_input", - "src_name": "BatchNormalization_100_mul_out", - "dst_name": "BatchNormalization_100_mul_out_nhwc_bridge", - "source": "set_operator_inputs", - "event_index": 128 - }, - { - "kind": "rename_tensor", - "old_name": "638", - "new_name": "Conv_101_input_nhwc", - "source": "set_operator_outputs", - "event_index": 129 - }, - { - "kind": "replace_input", - "src_name": "BatchNormalization_105_mul_out", - "dst_name": "BatchNormalization_105_mul_out_nhwc_bridge", - "source": "set_operator_inputs", - "event_index": 130 - }, - { - "kind": "rename_tensor", - "old_name": "646", - "new_name": "Conv_106_input_nhwc", - "source": "set_operator_outputs", - "event_index": 131 - }, - { - "kind": "replace_input", - "src_name": "819", - "dst_name": "Conv_108_output_nhwc", - "source": "set_operator_inputs", - "event_index": 132 - }, - { - "kind": "replace_input", - "src_name": "645", - "dst_name": "645_nhwc_bridge", - "source": "set_operator_inputs", - "event_index": 133 - }, - { - "kind": "rename_tensor", - "old_name": "653", - "new_name": "Conv_114_input_nhwc", - "source": "set_operator_outputs", - "event_index": 134 - }, - { - "kind": "replace_input", - "src_name": "653", - "dst_name": "Conv_114_input_nhwc", - "source": "set_operator_inputs", - "event_index": 135 - }, - { - "kind": "rename_tensor", - "old_name": "Conv_114_input_nhwc", - "new_name": "653", - "source": "set_operator_outputs", - "event_index": 136 - }, - { - "kind": "replace_input", - "src_name": "813", - "dst_name": "Conv_103_output_nhwc", - "source": "set_operator_inputs", - "event_index": 137 - }, - { - "kind": "replace_input", - "src_name": "637", - "dst_name": "637_nhwc_bridge", - "source": "set_operator_inputs", - "event_index": 138 - }, - { - "kind": "rename_tensor", - "old_name": "645", - "new_name": "645_nhwc_bridge", - "source": "set_operator_outputs", - "event_index": 139 - }, - { - "kind": "replace_input", - "src_name": "645", - "dst_name": "645_nhwc_bridge", - "source": "set_operator_inputs", - "event_index": 140 - }, - { - "kind": "rename_tensor", - "old_name": "645_nhwc_bridge", - "new_name": "645", - "source": "set_operator_outputs", - "event_index": 141 - }, - { - "kind": "replace_input", - "src_name": "807", - "dst_name": "Conv_98_output_nhwc", - "source": "set_operator_inputs", - "event_index": 142 - }, - { - "kind": "replace_input", - "src_name": "629", - "dst_name": "629_nhwc_bridge", - "source": "set_operator_inputs", - "event_index": 143 - }, - { - "kind": "rename_tensor", - "old_name": "637", - "new_name": "637_nhwc_bridge", - "source": "set_operator_outputs", - "event_index": 144 - }, - { - "kind": "replace_input", - "src_name": "637", - "dst_name": "637_nhwc_bridge", - "source": "set_operator_inputs", - "event_index": 145 - }, - { - "kind": "rename_tensor", - "old_name": "637_nhwc_bridge", - "new_name": "637", - "source": "set_operator_outputs", - "event_index": 146 - }, - { - "kind": "replace_input", - "src_name": "801", - "dst_name": "Conv_93_output_nhwc", - "source": "set_operator_inputs", - "event_index": 147 - }, - { - "kind": "replace_input", - "src_name": "621", - "dst_name": "621_nhwc_bridge", - "source": "set_operator_inputs", - "event_index": 148 - }, - { - "kind": "rename_tensor", - "old_name": "629", - "new_name": "629_nhwc_bridge", - "source": "set_operator_outputs", - "event_index": 149 - }, - { - "kind": "replace_input", - "src_name": "629", - "dst_name": "629_nhwc_bridge", - "source": "set_operator_inputs", - "event_index": 150 - }, - { - "kind": "rename_tensor", - "old_name": "629_nhwc_bridge", - "new_name": "629", - "source": "set_operator_outputs", - "event_index": 151 - }, - { - "kind": "replace_input", - "src_name": "795", - "dst_name": "Conv_88_output_nhwc", - "source": "set_operator_inputs", - "event_index": 152 - }, - { - "kind": "replace_input", - "src_name": "613", - "dst_name": "613_nhwc_bridge", - "source": "set_operator_inputs", - "event_index": 153 - }, - { - "kind": "rename_tensor", - "old_name": "621", - "new_name": "621_nhwc_bridge", - "source": "set_operator_outputs", - "event_index": 154 - }, - { - "kind": "replace_input", - "src_name": "621", - "dst_name": "621_nhwc_bridge", - "source": "set_operator_inputs", - "event_index": 155 - }, - { - "kind": "rename_tensor", - "old_name": "621_nhwc_bridge", - "new_name": "621", - "source": "set_operator_outputs", - "event_index": 156 - }, - { - "kind": "replace_input", - "src_name": "789", - "dst_name": "Conv_83_output_nhwc", - "source": "set_operator_inputs", - "event_index": 157 - }, - { - "kind": "replace_input", - "src_name": "605", - "dst_name": "605_nhwc_bridge", - "source": "set_operator_inputs", - "event_index": 158 - }, - { - "kind": "rename_tensor", - "old_name": "613", - "new_name": "613_nhwc_bridge", - "source": "set_operator_outputs", - "event_index": 159 - }, - { - "kind": "replace_input", - "src_name": "613", - "dst_name": "613_nhwc_bridge", - "source": "set_operator_inputs", - "event_index": 160 - }, - { - "kind": "rename_tensor", - "old_name": "613_nhwc_bridge", - "new_name": "613", - "source": "set_operator_outputs", - "event_index": 161 - }, - { - "kind": "replace_input", - "src_name": "783", - "dst_name": "Conv_78_output_nhwc", - "source": "set_operator_inputs", - "event_index": 162 - }, - { - "kind": "replace_input", - "src_name": "597", - "dst_name": "597_nhwc_bridge", - "source": "set_operator_inputs", - "event_index": 163 - }, - { - "kind": "rename_tensor", - "old_name": "605", - "new_name": "605_nhwc_bridge", - "source": "set_operator_outputs", - "event_index": 164 - }, - { - "kind": "replace_input", - "src_name": "605", - "dst_name": "605_nhwc_bridge", - "source": "set_operator_inputs", - "event_index": 165 - }, - { - "kind": "rename_tensor", - "old_name": "605_nhwc_bridge", - "new_name": "605", - "source": "set_operator_outputs", - "event_index": 166 - }, - { - "kind": "replace_input", - "src_name": "777", - "dst_name": "Conv_73_output_nhwc", - "source": "set_operator_inputs", - "event_index": 167 - }, - { - "kind": "replace_input", - "src_name": "589", - "dst_name": "589_nhwc_bridge", - "source": "set_operator_inputs", - "event_index": 168 - }, - { - "kind": "rename_tensor", - "old_name": "597", - "new_name": "597_nhwc_bridge", - "source": "set_operator_outputs", - "event_index": 169 - }, - { - "kind": "replace_input", - "src_name": "597", - "dst_name": "597_nhwc_bridge", - "source": "set_operator_inputs", - "event_index": 170 - }, - { - "kind": "rename_tensor", - "old_name": "597_nhwc_bridge", - "new_name": "597", - "source": "set_operator_outputs", - "event_index": 171 - }, - { - "kind": "replace_input", - "src_name": "771", - "dst_name": "Conv_68_output_nhwc", - "source": "set_operator_inputs", - "event_index": 172 - }, - { - "kind": "replace_input", - "src_name": "581", - "dst_name": "581_nhwc_bridge", - "source": "set_operator_inputs", - "event_index": 173 - }, - { - "kind": "rename_tensor", - "old_name": "589", - "new_name": "589_nhwc_bridge", - "source": "set_operator_outputs", - "event_index": 174 - }, - { - "kind": "replace_input", - "src_name": "589", - "dst_name": "589_nhwc_bridge", - "source": "set_operator_inputs", - "event_index": 175 - }, - { - "kind": "rename_tensor", - "old_name": "589_nhwc_bridge", - "new_name": "589", - "source": "set_operator_outputs", - "event_index": 176 - }, - { - "kind": "replace_input", - "src_name": "765", - "dst_name": "Conv_63_output_nhwc", - "source": "set_operator_inputs", - "event_index": 177 - }, - { - "kind": "replace_input", - "src_name": "573", - "dst_name": "573_nhwc_bridge", - "source": "set_operator_inputs", - "event_index": 178 - }, - { - "kind": "rename_tensor", - "old_name": "581", - "new_name": "581_nhwc_bridge", - "source": "set_operator_outputs", - "event_index": 179 - }, - { - "kind": "replace_input", - "src_name": "581", - "dst_name": "581_nhwc_bridge", - "source": "set_operator_inputs", - "event_index": 180 - }, - { - "kind": "rename_tensor", - "old_name": "581_nhwc_bridge", - "new_name": "581", - "source": "set_operator_outputs", - "event_index": 181 - }, - { - "kind": "replace_input", - "src_name": "759", - "dst_name": "Conv_58_output_nhwc", - "source": "set_operator_inputs", - "event_index": 182 - }, - { - "kind": "replace_input", - "src_name": "565", - "dst_name": "565_nhwc_bridge", - "source": "set_operator_inputs", - "event_index": 183 - }, - { - "kind": "rename_tensor", - "old_name": "573", - "new_name": "573_nhwc_bridge", - "source": "set_operator_outputs", - "event_index": 184 - }, - { - "kind": "replace_input", - "src_name": "573", - "dst_name": "573_nhwc_bridge", - "source": "set_operator_inputs", - "event_index": 185 - }, - { - "kind": "rename_tensor", - "old_name": "573_nhwc_bridge", - "new_name": "573", - "source": "set_operator_outputs", - "event_index": 186 - }, - { - "kind": "replace_input", - "src_name": "753", - "dst_name": "Conv_53_output_nhwc", - "source": "set_operator_inputs", - "event_index": 187 - }, - { - "kind": "replace_input", - "src_name": "557", - "dst_name": "557_nhwc_bridge", - "source": "set_operator_inputs", - "event_index": 188 - }, - { - "kind": "rename_tensor", - "old_name": "565", - "new_name": "565_nhwc_bridge", - "source": "set_operator_outputs", - "event_index": 189 - }, - { - "kind": "replace_input", - "src_name": "565", - "dst_name": "565_nhwc_bridge", - "source": "set_operator_inputs", - "event_index": 190 - }, - { - "kind": "rename_tensor", - "old_name": "565_nhwc_bridge", - "new_name": "565", - "source": "set_operator_outputs", - "event_index": 191 - }, - { - "kind": "replace_input", - "src_name": "747", - "dst_name": "Conv_48_output_nhwc", - "source": "set_operator_inputs", - "event_index": 192 - }, - { - "kind": "replace_input", - "src_name": "549", - "dst_name": "549_nhwc_bridge", - "source": "set_operator_inputs", - "event_index": 193 - }, - { - "kind": "rename_tensor", - "old_name": "557", - "new_name": "557_nhwc_bridge", - "source": "set_operator_outputs", - "event_index": 194 - }, - { - "kind": "replace_input", - "src_name": "557", - "dst_name": "557_nhwc_bridge", - "source": "set_operator_inputs", - "event_index": 195 - }, - { - "kind": "rename_tensor", - "old_name": "557_nhwc_bridge", - "new_name": "557", - "source": "set_operator_outputs", - "event_index": 196 - }, - { - "kind": "replace_input", - "src_name": "738", - "dst_name": "Conv_42_output_nhwc", - "source": "set_operator_inputs", - "event_index": 197 - }, - { - "kind": "replace_input", - "src_name": "741", - "dst_name": "Conv_43_output_nhwc", - "source": "set_operator_inputs", - "event_index": 198 - }, - { - "kind": "rename_tensor", - "old_name": "549", - "new_name": "549_nhwc_bridge", - "source": "set_operator_outputs", - "event_index": 199 - }, - { - "kind": "replace_input", - "src_name": "549", - "dst_name": "549_nhwc_bridge", - "source": "set_operator_inputs", - "event_index": 200 - }, - { - "kind": "rename_tensor", - "old_name": "549_nhwc_bridge", - "new_name": "549", - "source": "set_operator_outputs", - "event_index": 201 - }, - { - "kind": "replace_input", - "src_name": "653", - "dst_name": "Conv_114_input_nhwc", - "source": "set_operator_inputs", - "event_index": 202 - }, - { - "kind": "rename_tensor", - "old_name": "654", - "new_name": "Conv_111_input_nhwc", - "source": "set_operator_outputs", - "event_index": 203 - }, - { - "kind": "replace_input", - "src_name": "BatchNormalization_116_mul_out", - "dst_name": "BatchNormalization_116_mul_out_nhwc_bridge", - "source": "set_operator_inputs", - "event_index": 204 - }, - { - "kind": "rename_tensor", - "old_name": "664", - "new_name": "Conv_117_input_nhwc", - "source": "set_operator_outputs", - "event_index": 205 - }, - { - "kind": "replace_input", - "src_name": "BatchNormalization_121_mul_out", - "dst_name": "BatchNormalization_121_mul_out_nhwc_bridge", - "source": "set_operator_inputs", - "event_index": 206 - }, - { - "kind": "rename_tensor", - "old_name": "672", - "new_name": "Conv_122_input_nhwc", - "source": "set_operator_outputs", - "event_index": 207 - }, - { - "kind": "prune_unused_tensors", - "removed_names": [ - "480", - "693", - "693_perm", - "Conv_3_input_nhwc_perm", - "690", - "690_perm", - "490", - "Conv_9_input_nhwc_perm", - "699", - "699_perm", - "498", - "Conv_14_input_nhwc_perm", - "705", - "705_perm", - "505", - "506", - "714", - "Conv_22_input_nhwc_perm", - "714_perm", - "Conv_19_input_nhwc_perm", - "711", - "711_perm", - "516", - "Conv_25_input_nhwc_perm", - "720", - "720_perm", - "524", - "Conv_30_input_nhwc_perm", - "726", - "726_perm", - "532", - "Conv_35_input_nhwc_perm", - "732", - "732_perm", - "539", - "540", - "741", - "Conv_43_input_nhwc_perm", - "741_perm", - "Conv_40_input_nhwc_perm", - "738", - "738_perm", - "550", - "Conv_46_input_nhwc_perm", - "747", - "747_perm", - "558", - "Conv_51_input_nhwc_perm", - "753", - "753_perm", - "566", - "Conv_56_input_nhwc_perm", - "759", - "759_perm", - "574", - "Conv_61_input_nhwc_perm", - "765", - "765_perm", - "582", - "Conv_66_input_nhwc_perm", - "771", - "771_perm", - "590", - "Conv_71_input_nhwc_perm", - "777", - "777_perm", - "598", - "Conv_76_input_nhwc_perm", - "783", - "783_perm", - "606", - "Conv_81_input_nhwc_perm", - "789", - "789_perm", - "614", - "Conv_86_input_nhwc_perm", - "795", - "795_perm", - "622", - "Conv_91_input_nhwc_perm", - "801", - "801_perm", - "630", - "Conv_96_input_nhwc_perm", - "807", - "807_perm", - "638", - "Conv_101_input_nhwc_perm", - "813", - "813_perm", - "646", - "Conv_106_input_nhwc_perm", - "819", - "819_perm", - "653", - "654", - "Conv_114_input_nhwc_perm", - "Conv_111_input_nhwc_perm", - "664", - "Conv_117_input_nhwc_perm", - "672", - "Conv_122_input_nhwc_perm" - ], - "event_index": 208 - }, - { - "kind": "prune_unused_tensors", - "removed_names": [ - "__nhwc_to_nchw_perm_rank4__" - ], - "event_index": 209 - }, - { - "kind": "replace_input", - "src_name": "825", - "dst_name": "Conv_113_output_nhwc", - "source": "set_operator_inputs", - "event_index": 210 - }, - { - "kind": "replace_input", - "src_name": "828", - "dst_name": "Conv_114_output_nhwc", - "source": "set_operator_inputs", - "event_index": 211 - }, - { - "kind": "rename_tensor", - "old_name": "663", - "new_name": "663__raw", - "source": "set_operator_outputs", - "event_index": 212 - }, - { - "kind": "prune_unused_tensors", - "removed_names": [ - "828", - "828_perm", - "825" - ], - "event_index": 213 - }, - { - "kind": "replace_input", - "src_name": "479", - "dst_name": "Conv_6_input_nhwc", - "source": "set_operator_inputs", - "event_index": 214 - }, - { - "kind": "rename_tensor", - "old_name": "BatchNormalization_2_mul_out", - "new_name": "BatchNormalization_2_mul_out_nhwc_bridge", - "source": "set_operator_outputs", - "event_index": 215 - }, - { - "kind": "replace_input", - "src_name": "BatchNormalization_2_mul_out", - "dst_name": "BatchNormalization_2_mul_out_nhwc_bridge", - "event_index": 216 - }, - { - "kind": "replace_input", - "src_name": "489", - "dst_name": "489_nhwc_bridge", - "source": "set_operator_inputs", - "event_index": 217 - }, - { - "kind": "rename_tensor", - "old_name": "BatchNormalization_8_mul_out", - "new_name": "BatchNormalization_8_mul_out_nhwc_bridge", - "source": "set_operator_outputs", - "event_index": 218 - }, - { - "kind": "replace_input", - "src_name": "BatchNormalization_8_mul_out", - "dst_name": "BatchNormalization_8_mul_out_nhwc_bridge", - "event_index": 219 - }, - { - "kind": "replace_input", - "src_name": "497", - "dst_name": "497_nhwc_bridge", - "source": "set_operator_inputs", - "event_index": 220 - }, - { - "kind": "rename_tensor", - "old_name": "BatchNormalization_13_mul_out", - "new_name": "BatchNormalization_13_mul_out_nhwc_bridge", - "source": "set_operator_outputs", - "event_index": 221 - }, - { - "kind": "replace_input", - "src_name": "BatchNormalization_13_mul_out", - "dst_name": "BatchNormalization_13_mul_out_nhwc_bridge", - "event_index": 222 - }, - { - "kind": "replace_input", - "src_name": "515", - "dst_name": "515_nhwc_bridge", - "source": "set_operator_inputs", - "event_index": 223 - }, - { - "kind": "rename_tensor", - "old_name": "BatchNormalization_24_mul_out", - "new_name": "BatchNormalization_24_mul_out_nhwc_bridge", - "source": "set_operator_outputs", - "event_index": 224 - }, - { - "kind": "replace_input", - "src_name": "BatchNormalization_24_mul_out", - "dst_name": "BatchNormalization_24_mul_out_nhwc_bridge", - "event_index": 225 - }, - { - "kind": "replace_input", - "src_name": "523", - "dst_name": "523_nhwc_bridge", - "source": "set_operator_inputs", - "event_index": 226 - }, - { - "kind": "rename_tensor", - "old_name": "BatchNormalization_29_mul_out", - "new_name": "BatchNormalization_29_mul_out_nhwc_bridge", - "source": "set_operator_outputs", - "event_index": 227 - }, - { - "kind": "replace_input", - "src_name": "BatchNormalization_29_mul_out", - "dst_name": "BatchNormalization_29_mul_out_nhwc_bridge", - "event_index": 228 - }, - { - "kind": "replace_input", - "src_name": "531", - "dst_name": "531_nhwc_bridge", - "source": "set_operator_inputs", - "event_index": 229 - }, - { - "kind": "rename_tensor", - "old_name": "BatchNormalization_34_mul_out", - "new_name": "BatchNormalization_34_mul_out_nhwc_bridge", - "source": "set_operator_outputs", - "event_index": 230 - }, - { - "kind": "replace_input", - "src_name": "BatchNormalization_34_mul_out", - "dst_name": "BatchNormalization_34_mul_out_nhwc_bridge", - "event_index": 231 - }, - { - "kind": "replace_input", - "src_name": "549", - "dst_name": "549_nhwc_bridge", - "source": "set_operator_inputs", - "event_index": 232 - }, - { - "kind": "rename_tensor", - "old_name": "BatchNormalization_45_mul_out", - "new_name": "BatchNormalization_45_mul_out_nhwc_bridge", - "source": "set_operator_outputs", - "event_index": 233 - }, - { - "kind": "replace_input", - "src_name": "BatchNormalization_45_mul_out", - "dst_name": "BatchNormalization_45_mul_out_nhwc_bridge", - "event_index": 234 - }, - { - "kind": "replace_input", - "src_name": "557", - "dst_name": "557_nhwc_bridge", - "source": "set_operator_inputs", - "event_index": 235 - }, - { - "kind": "rename_tensor", - "old_name": "BatchNormalization_50_mul_out", - "new_name": "BatchNormalization_50_mul_out_nhwc_bridge", - "source": "set_operator_outputs", - "event_index": 236 - }, - { - "kind": "replace_input", - "src_name": "BatchNormalization_50_mul_out", - "dst_name": "BatchNormalization_50_mul_out_nhwc_bridge", - "event_index": 237 - }, - { - "kind": "replace_input", - "src_name": "565", - "dst_name": "565_nhwc_bridge", - "source": "set_operator_inputs", - "event_index": 238 - }, - { - "kind": "rename_tensor", - "old_name": "BatchNormalization_55_mul_out", - "new_name": "BatchNormalization_55_mul_out_nhwc_bridge", - "source": "set_operator_outputs", - "event_index": 239 - }, - { - "kind": "replace_input", - "src_name": "BatchNormalization_55_mul_out", - "dst_name": "BatchNormalization_55_mul_out_nhwc_bridge", - "event_index": 240 - }, - { - "kind": "replace_input", - "src_name": "573", - "dst_name": "573_nhwc_bridge", - "source": "set_operator_inputs", - "event_index": 241 - }, - { - "kind": "rename_tensor", - "old_name": "BatchNormalization_60_mul_out", - "new_name": "BatchNormalization_60_mul_out_nhwc_bridge", - "source": "set_operator_outputs", - "event_index": 242 - }, - { - "kind": "replace_input", - "src_name": "BatchNormalization_60_mul_out", - "dst_name": "BatchNormalization_60_mul_out_nhwc_bridge", - "event_index": 243 - }, - { - "kind": "replace_input", - "src_name": "581", - "dst_name": "581_nhwc_bridge", - "source": "set_operator_inputs", - "event_index": 244 - }, - { - "kind": "rename_tensor", - "old_name": "BatchNormalization_65_mul_out", - "new_name": "BatchNormalization_65_mul_out_nhwc_bridge", - "source": "set_operator_outputs", - "event_index": 245 - }, - { - "kind": "replace_input", - "src_name": "BatchNormalization_65_mul_out", - "dst_name": "BatchNormalization_65_mul_out_nhwc_bridge", - "event_index": 246 - }, - { - "kind": "replace_input", - "src_name": "589", - "dst_name": "589_nhwc_bridge", - "source": "set_operator_inputs", - "event_index": 247 - }, - { - "kind": "rename_tensor", - "old_name": "BatchNormalization_70_mul_out", - "new_name": "BatchNormalization_70_mul_out_nhwc_bridge", - "source": "set_operator_outputs", - "event_index": 248 - }, - { - "kind": "replace_input", - "src_name": "BatchNormalization_70_mul_out", - "dst_name": "BatchNormalization_70_mul_out_nhwc_bridge", - "event_index": 249 - }, - { - "kind": "replace_input", - "src_name": "597", - "dst_name": "597_nhwc_bridge", - "source": "set_operator_inputs", - "event_index": 250 - }, - { - "kind": "rename_tensor", - "old_name": "BatchNormalization_75_mul_out", - "new_name": "BatchNormalization_75_mul_out_nhwc_bridge", - "source": "set_operator_outputs", - "event_index": 251 - }, - { - "kind": "replace_input", - "src_name": "BatchNormalization_75_mul_out", - "dst_name": "BatchNormalization_75_mul_out_nhwc_bridge", - "event_index": 252 - }, - { - "kind": "replace_input", - "src_name": "605", - "dst_name": "605_nhwc_bridge", - "source": "set_operator_inputs", - "event_index": 253 - }, - { - "kind": "rename_tensor", - "old_name": "BatchNormalization_80_mul_out", - "new_name": "BatchNormalization_80_mul_out_nhwc_bridge", - "source": "set_operator_outputs", - "event_index": 254 - }, - { - "kind": "replace_input", - "src_name": "BatchNormalization_80_mul_out", - "dst_name": "BatchNormalization_80_mul_out_nhwc_bridge", - "event_index": 255 - }, - { - "kind": "replace_input", - "src_name": "613", - "dst_name": "613_nhwc_bridge", - "source": "set_operator_inputs", - "event_index": 256 - }, - { - "kind": "rename_tensor", - "old_name": "BatchNormalization_85_mul_out", - "new_name": "BatchNormalization_85_mul_out_nhwc_bridge", - "source": "set_operator_outputs", - "event_index": 257 - }, - { - "kind": "replace_input", - "src_name": "BatchNormalization_85_mul_out", - "dst_name": "BatchNormalization_85_mul_out_nhwc_bridge", - "event_index": 258 - }, - { - "kind": "replace_input", - "src_name": "621", - "dst_name": "621_nhwc_bridge", - "source": "set_operator_inputs", - "event_index": 259 - }, - { - "kind": "rename_tensor", - "old_name": "BatchNormalization_90_mul_out", - "new_name": "BatchNormalization_90_mul_out_nhwc_bridge", - "source": "set_operator_outputs", - "event_index": 260 - }, - { - "kind": "replace_input", - "src_name": "BatchNormalization_90_mul_out", - "dst_name": "BatchNormalization_90_mul_out_nhwc_bridge", - "event_index": 261 - }, - { - "kind": "replace_input", - "src_name": "629", - "dst_name": "629_nhwc_bridge", - "source": "set_operator_inputs", - "event_index": 262 - }, - { - "kind": "rename_tensor", - "old_name": "BatchNormalization_95_mul_out", - "new_name": "BatchNormalization_95_mul_out_nhwc_bridge", - "source": "set_operator_outputs", - "event_index": 263 - }, - { - "kind": "replace_input", - "src_name": "BatchNormalization_95_mul_out", - "dst_name": "BatchNormalization_95_mul_out_nhwc_bridge", - "event_index": 264 - }, - { - "kind": "replace_input", - "src_name": "637", - "dst_name": "637_nhwc_bridge", - "source": "set_operator_inputs", - "event_index": 265 - }, - { - "kind": "rename_tensor", - "old_name": "BatchNormalization_100_mul_out", - "new_name": "BatchNormalization_100_mul_out_nhwc_bridge", - "source": "set_operator_outputs", - "event_index": 266 - }, - { - "kind": "replace_input", - "src_name": "BatchNormalization_100_mul_out", - "dst_name": "BatchNormalization_100_mul_out_nhwc_bridge", - "event_index": 267 - }, - { - "kind": "replace_input", - "src_name": "645", - "dst_name": "645_nhwc_bridge", - "source": "set_operator_inputs", - "event_index": 268 - }, - { - "kind": "rename_tensor", - "old_name": "BatchNormalization_105_mul_out", - "new_name": "BatchNormalization_105_mul_out_nhwc_bridge", - "source": "set_operator_outputs", - "event_index": 269 - }, - { - "kind": "replace_input", - "src_name": "BatchNormalization_105_mul_out", - "dst_name": "BatchNormalization_105_mul_out_nhwc_bridge", - "event_index": 270 - }, - { - "kind": "prune_unused_tensors", - "removed_names": [ - "479", - "BatchNormalization_2_mul_out", - "Conv_6_input_nhwc_perm", - "489", - "BatchNormalization_8_mul_out", - "497", - "BatchNormalization_13_mul_out", - "515", - "BatchNormalization_24_mul_out", - "523", - "BatchNormalization_29_mul_out", - "531", - "BatchNormalization_34_mul_out", - "549", - "BatchNormalization_45_mul_out", - "557", - "BatchNormalization_50_mul_out", - "565", - "BatchNormalization_55_mul_out", - "573", - "BatchNormalization_60_mul_out", - "581", - "BatchNormalization_65_mul_out", - "589", - "BatchNormalization_70_mul_out", - "597", - "BatchNormalization_75_mul_out", - "605", - "BatchNormalization_80_mul_out", - "613", - "BatchNormalization_85_mul_out", - "621", - "BatchNormalization_90_mul_out", - "629", - "BatchNormalization_95_mul_out", - "637", - "BatchNormalization_100_mul_out", - "645", - "BatchNormalization_105_mul_out", - "BatchNormalization_2_mul_out_nhwc_bridge_perm", - "BatchNormalization_8_mul_out_nhwc_bridge_perm", - "BatchNormalization_13_mul_out_nhwc_bridge_perm", - "497_nhwc_bridge_perm", - "489_nhwc_bridge_perm", - "BatchNormalization_24_mul_out_nhwc_bridge_perm", - "BatchNormalization_29_mul_out_nhwc_bridge_perm", - "BatchNormalization_34_mul_out_nhwc_bridge_perm", - "531_nhwc_bridge_perm", - "523_nhwc_bridge_perm", - "515_nhwc_bridge_perm", - "BatchNormalization_45_mul_out_nhwc_bridge_perm", - "BatchNormalization_50_mul_out_nhwc_bridge_perm", - "BatchNormalization_55_mul_out_nhwc_bridge_perm", - "BatchNormalization_60_mul_out_nhwc_bridge_perm", - "BatchNormalization_65_mul_out_nhwc_bridge_perm", - "BatchNormalization_70_mul_out_nhwc_bridge_perm", - "BatchNormalization_75_mul_out_nhwc_bridge_perm", - "BatchNormalization_80_mul_out_nhwc_bridge_perm", - "BatchNormalization_85_mul_out_nhwc_bridge_perm", - "BatchNormalization_90_mul_out_nhwc_bridge_perm", - "BatchNormalization_95_mul_out_nhwc_bridge_perm", - "BatchNormalization_100_mul_out_nhwc_bridge_perm", - "BatchNormalization_105_mul_out_nhwc_bridge_perm", - "645_nhwc_bridge_perm", - "637_nhwc_bridge_perm", - "629_nhwc_bridge_perm", - "621_nhwc_bridge_perm", - "613_nhwc_bridge_perm", - "605_nhwc_bridge_perm", - "597_nhwc_bridge_perm", - "589_nhwc_bridge_perm", - "581_nhwc_bridge_perm", - "573_nhwc_bridge_perm", - "565_nhwc_bridge_perm", - "557_nhwc_bridge_perm", - "549_nhwc_bridge_perm" - ], - "event_index": 271 - }, - { - "kind": "prune_unused_tensors", - "removed_names": [ - "__nhwc_to_nchw_perm_rank4__" - ], - "event_index": 272 - }, - { - "kind": "prune_unused_tensors", - "removed_names": [ - "__nhwc_to_nchw_perm_rank4__" - ], - "event_index": 273 - }, - { - "kind": "prune_unused_tensors", - "removed_names": [ - "__nhwc_to_nchw_perm_rank4__" - ], - "event_index": 274 - }, - { - "kind": "prune_unused_tensors", - "removed_names": [ - "__nhwc_to_nchw_perm_rank4__" - ], - "event_index": 275 - }, - { - "kind": "prune_unused_tensors", - "removed_names": [ - "__nhwc_to_nchw_perm_rank4__" - ], - "event_index": 276 - }, - { - "kind": "prune_unused_tensors", - "removed_names": [ - "__nhwc_to_nchw_perm_rank4__" - ], - "event_index": 277 - }, - { - "kind": "prune_unused_tensors", - "removed_names": [ - "__nhwc_to_nchw_perm_rank4__" - ], - "event_index": 278 - }, - { - "kind": "prune_unused_tensors", - "removed_names": [ - "__nhwc_to_nchw_perm_rank4__" - ], - "event_index": 279 - }, - { - "kind": "prune_unused_tensors", - "removed_names": [ - "__nhwc_to_nchw_perm_rank4__" - ], - "event_index": 280 - }, - { - "kind": "prune_unused_tensors", - "removed_names": [ - "__nhwc_to_nchw_perm_rank4__" - ], - "event_index": 281 - }, - { - "kind": "prune_unused_tensors", - "removed_names": [ - "__nhwc_to_nchw_perm_rank4__" - ], - "event_index": 282 - }, - { - "kind": "prune_unused_tensors", - "removed_names": [ - "__nhwc_to_nchw_perm_rank4__" - ], - "event_index": 283 - }, - { - "kind": "replace_input", - "src_name": "663", - "dst_name": "663__raw", - "source": "replace_operator_input_at", - "event_index": 284 - }, - { - "kind": "replace_input", - "src_name": "BatchNormalization_116_mul_out_nhwc_bridge", - "dst_name": "BatchNormalization_116_mul_out", - "source": "replace_operator_input_at", - "event_index": 285 - }, - { - "kind": "prune_unused_tensors", - "removed_names": [ - "BatchNormalization_116_mul_out_nhwc_bridge_perm", - "BatchNormalization_116_mul_out_nhwc_bridge" - ], - "event_index": 286 - }, - { - "kind": "replace_input", - "src_name": "834", - "dst_name": "Conv_119_output_nhwc", - "source": "set_operator_inputs", - "event_index": 287 - }, - { - "kind": "replace_input", - "src_name": "663", - "dst_name": "663__to_nhwc", - "source": "set_operator_inputs", - "event_index": 288 - }, - { - "kind": "replace_input", - "src_name": "840", - "dst_name": "840__to_nhwc", - "source": "set_operator_inputs", - "event_index": 289 - }, - { - "kind": "rename_tensor", - "old_name": "BatchNormalization_121_mul_out", - "new_name": "BatchNormalization_121_mul_out__to_nhwc", - "source": "set_operator_outputs", - "event_index": 290 - }, - { - "kind": "replace_input", - "src_name": "BatchNormalization_121_mul_out", - "dst_name": "BatchNormalization_121_mul_out__to_nhwc", - "event_index": 291 - }, - { - "kind": "replace_input", - "src_name": "BatchNormalization_121_mul_out__to_nhwc", - "dst_name": "BatchNormalization_121_mul_out", - "source": "set_operator_inputs", - "event_index": 292 - }, - { - "kind": "rename_tensor", - "old_name": "680", - "new_name": "680__to_nhwc", - "source": "set_operator_outputs", - "event_index": 293 - }, - { - "kind": "replace_input", - "src_name": "680", - "dst_name": "680__to_nhwc", - "event_index": 294 - }, - { - "kind": "replace_input", - "src_name": "680__to_nhwc", - "dst_name": "680", - "source": "set_operator_inputs", - "event_index": 295 - }, - { - "kind": "prune_unused_tensors", - "removed_names": [ - "834", - "834_perm" - ], - "event_index": 296 - }, - { - "kind": "replace_input", - "src_name": "663__to_nhwc", - "dst_name": "663__raw", - "event_index": 297 - }, - { - "kind": "replace_input", - "src_name": "840__to_nhwc", - "dst_name": "Conv_124_output_nhwc", - "event_index": 298 - }, - { - "kind": "replace_input", - "src_name": "BatchNormalization_121_mul_out_nhwc_bridge", - "dst_name": "BatchNormalization_121_mul_out__to_nhwc", - "event_index": 299 - }, - { - "kind": "prune_unused_tensors", - "removed_names": [ - "825_perm", - "663", - "BatchNormalization_121_mul_out", - "840", - "840_perm", - "BatchNormalization_121_mul_out_nhwc_bridge_perm", - "BatchNormalization_121_mul_out_nhwc_bridge", - "663__to_nhwc_perm", - "663__to_nhwc", - "840__to_nhwc_perm", - "840__to_nhwc", - "BatchNormalization_121_mul_out__to_nchw_perm" - ], - "event_index": 300 - }, - { - "kind": "prune_unused_tensors", - "removed_names": [ - "__nhwc_to_nchw_perm_rank4__" - ], - "event_index": 301 - } - ], - "records": [ - { - "identifier": 1, - "onnx_op_type": "Conv", - "onnx_op_name": "Conv_0", - "onnx_output_index": 0, - "onnx_output_name": "684", - "resolved_tflite_tensor_name": "Conv_0_output_nhwc", - "exists_in_final_model": true, - "is_graph_output": false, - "consumer_count": 1, - "producer_operator_index": 0, - "producer_op_type": "CONV_2D", - "assume_channel_last_layout": true, - "status": "rewritten", - "is_rewritten": true, - "rewrite_events": [ - { - "event_index": 1, - "kind": "replace_input", - "from": "684", - "to": "Conv_0_output_nhwc" - } - ], - "rewrite_name_chain": [ - "684", - "Conv_0_output_nhwc" - ] - }, - { - "identifier": 2, - "onnx_op_type": "PRelu", - "onnx_op_name": "PRelu_1", - "onnx_output_index": 0, - "onnx_output_name": "479", - "resolved_tflite_tensor_name": "Conv_6_input_nhwc", - "exists_in_final_model": true, - "is_graph_output": false, - "consumer_count": 2, - "producer_operator_index": 1, - "producer_op_type": "PRELU", - "assume_channel_last_layout": true, - "status": "rewritten", - "is_rewritten": true, - "rewrite_events": [ - { - "event_index": 2, - "kind": "rename_tensor", - "from": "479", - "to": "Conv_6_input_nhwc" - }, - { - "event_index": 4, - "kind": "rename_tensor", - "from": "Conv_6_input_nhwc", - "to": "479" - }, - { - "event_index": 214, - "kind": "replace_input", - "from": "479", - "to": "Conv_6_input_nhwc" - } - ], - "rewrite_name_chain": [ - "479", - "Conv_6_input_nhwc", - "479", - "Conv_6_input_nhwc" - ] - }, - { - "identifier": 3, - "onnx_op_type": "BatchNormalization", - "onnx_op_name": "BatchNormalization_2", - "onnx_output_index": 0, - "onnx_output_name": "480", - "resolved_tflite_tensor_name": "Conv_3_input_nhwc", - "exists_in_final_model": true, - "is_graph_output": false, - "consumer_count": 1, - "producer_operator_index": 3, - "producer_op_type": "ADD", - "assume_channel_last_layout": true, - "status": "rewritten", - "is_rewritten": true, - "rewrite_events": [ - { - "event_index": 56, - "kind": "rename_tensor", - "from": "480", - "to": "Conv_3_input_nhwc" - } - ], - "rewrite_name_chain": [ - "480", - "Conv_3_input_nhwc" - ] - }, - { - "identifier": 4, - "onnx_op_type": "Conv", - "onnx_op_name": "Conv_6", - "onnx_output_index": 0, - "onnx_output_name": "693", - "resolved_tflite_tensor_name": "Conv_6_output_nhwc", - "exists_in_final_model": true, - "is_graph_output": false, - "consumer_count": 1, - "producer_operator_index": 4, - "producer_op_type": "CONV_2D", - "assume_channel_last_layout": true, - "status": "rewritten", - "is_rewritten": true, - "rewrite_events": [ - { - "event_index": 72, - "kind": "replace_input", - "from": "693", - "to": "Conv_6_output_nhwc" - } - ], - "rewrite_name_chain": [ - "693", - "Conv_6_output_nhwc" - ] - }, - { - "identifier": 5, - "onnx_op_type": "Conv", - "onnx_op_name": "Conv_3", - "onnx_output_index": 0, - "onnx_output_name": "687", - "resolved_tflite_tensor_name": "Conv_3_output_nhwc", - "exists_in_final_model": true, - "is_graph_output": false, - "consumer_count": 1, - "producer_operator_index": 5, - "producer_op_type": "CONV_2D", - "assume_channel_last_layout": true, - "status": "rewritten", - "is_rewritten": true, - "rewrite_events": [ - { - "event_index": 5, - "kind": "replace_input", - "from": "687", - "to": "Conv_3_output_nhwc" - } - ], - "rewrite_name_chain": [ - "687", - "Conv_3_output_nhwc" - ] - }, - { - "identifier": 6, - "onnx_op_type": "PRelu", - "onnx_op_name": "PRelu_4", - "onnx_output_index": 0, - "onnx_output_name": "484", - "resolved_tflite_tensor_name": "Conv_5_input_nhwc", - "exists_in_final_model": true, - "is_graph_output": false, - "consumer_count": 1, - "producer_operator_index": 6, - "producer_op_type": "PRELU", - "assume_channel_last_layout": true, - "status": "rewritten", - "is_rewritten": true, - "rewrite_events": [ - { - "event_index": 6, - "kind": "rename_tensor", - "from": "484", - "to": "Conv_5_input_nhwc" - } - ], - "rewrite_name_chain": [ - "484", - "Conv_5_input_nhwc" - ] - }, - { - "identifier": 7, - "onnx_op_type": "Conv", - "onnx_op_name": "Conv_5", - "onnx_output_index": 0, - "onnx_output_name": "690", - "resolved_tflite_tensor_name": "Conv_5_output_nhwc", - "exists_in_final_model": true, - "is_graph_output": false, - "consumer_count": 1, - "producer_operator_index": 8, - "producer_op_type": "CONV_2D", - "assume_channel_last_layout": true, - "status": "rewritten", - "is_rewritten": true, - "rewrite_events": [ - { - "event_index": 71, - "kind": "replace_input", - "from": "690", - "to": "Conv_5_output_nhwc" - } - ], - "rewrite_name_chain": [ - "690", - "Conv_5_output_nhwc" - ] - }, - { - "identifier": 8, - "onnx_op_type": "Add", - "onnx_op_name": "Add_7", - "onnx_output_index": 0, - "onnx_output_name": "489", - "resolved_tflite_tensor_name": "489_nhwc_bridge", - "exists_in_final_model": true, - "is_graph_output": false, - "consumer_count": 2, - "producer_operator_index": 9, - "producer_op_type": "ADD", - "assume_channel_last_layout": true, - "status": "rewritten", - "is_rewritten": true, - "rewrite_events": [ - { - "event_index": 67, - "kind": "replace_input", - "from": "489", - "to": "489_nhwc_bridge" - }, - { - "event_index": 75, - "kind": "rename_tensor", - "from": "489_nhwc_bridge", - "to": "489" - }, - { - "event_index": 217, - "kind": "replace_input", - "from": "489", - "to": "489_nhwc_bridge" - } - ], - "rewrite_name_chain": [ - "489", - "489_nhwc_bridge", - "489", - "489_nhwc_bridge" - ] - }, - { - "identifier": 9, - "onnx_op_type": "BatchNormalization", - "onnx_op_name": "BatchNormalization_8", - "onnx_output_index": 0, - "onnx_output_name": "490", - "resolved_tflite_tensor_name": "Conv_9_input_nhwc", - "exists_in_final_model": true, - "is_graph_output": false, - "consumer_count": 1, - "producer_operator_index": 11, - "producer_op_type": "ADD", - "assume_channel_last_layout": true, - "status": "rewritten", - "is_rewritten": true, - "rewrite_events": [ - { - "event_index": 58, - "kind": "rename_tensor", - "from": "490", - "to": "Conv_9_input_nhwc" - } - ], - "rewrite_name_chain": [ - "490", - "Conv_9_input_nhwc" - ] - }, - { - "identifier": 10, - "onnx_op_type": "Conv", - "onnx_op_name": "Conv_9", - "onnx_output_index": 0, - "onnx_output_name": "696", - "resolved_tflite_tensor_name": "Conv_9_output_nhwc", - "exists_in_final_model": true, - "is_graph_output": false, - "consumer_count": 1, - "producer_operator_index": 12, - "producer_op_type": "CONV_2D", - "assume_channel_last_layout": true, - "status": "rewritten", - "is_rewritten": true, - "rewrite_events": [ - { - "event_index": 7, - "kind": "replace_input", - "from": "696", - "to": "Conv_9_output_nhwc" - } - ], - "rewrite_name_chain": [ - "696", - "Conv_9_output_nhwc" - ] - }, - { - "identifier": 11, - "onnx_op_type": "PRelu", - "onnx_op_name": "PRelu_10", - "onnx_output_index": 0, - "onnx_output_name": "494", - "resolved_tflite_tensor_name": "Conv_11_input_nhwc", - "exists_in_final_model": true, - "is_graph_output": false, - "consumer_count": 1, - "producer_operator_index": 13, - "producer_op_type": "PRELU", - "assume_channel_last_layout": true, - "status": "rewritten", - "is_rewritten": true, - "rewrite_events": [ - { - "event_index": 8, - "kind": "rename_tensor", - "from": "494", - "to": "Conv_11_input_nhwc" - } - ], - "rewrite_name_chain": [ - "494", - "Conv_11_input_nhwc" - ] - }, - { - "identifier": 12, - "onnx_op_type": "Conv", - "onnx_op_name": "Conv_11", - "onnx_output_index": 0, - "onnx_output_name": "699", - "resolved_tflite_tensor_name": "Conv_11_output_nhwc", - "exists_in_final_model": true, - "is_graph_output": false, - "consumer_count": 1, - "producer_operator_index": 14, - "producer_op_type": "CONV_2D", - "assume_channel_last_layout": true, - "status": "rewritten", - "is_rewritten": true, - "rewrite_events": [ - { - "event_index": 66, - "kind": "replace_input", - "from": "699", - "to": "Conv_11_output_nhwc" - } - ], - "rewrite_name_chain": [ - "699", - "Conv_11_output_nhwc" - ] - }, - { - "identifier": 13, - "onnx_op_type": "Add", - "onnx_op_name": "Add_12", - "onnx_output_index": 0, - "onnx_output_name": "497", - "resolved_tflite_tensor_name": "497_nhwc_bridge", - "exists_in_final_model": true, - "is_graph_output": false, - "consumer_count": 2, - "producer_operator_index": 15, - "producer_op_type": "ADD", - "assume_channel_last_layout": true, - "status": "rewritten", - "is_rewritten": true, - "rewrite_events": [ - { - "event_index": 62, - "kind": "replace_input", - "from": "497", - "to": "497_nhwc_bridge" - }, - { - "event_index": 70, - "kind": "rename_tensor", - "from": "497_nhwc_bridge", - "to": "497" - }, - { - "event_index": 220, - "kind": "replace_input", - "from": "497", - "to": "497_nhwc_bridge" - } - ], - "rewrite_name_chain": [ - "497", - "497_nhwc_bridge", - "497", - "497_nhwc_bridge" - ] - }, - { - "identifier": 14, - "onnx_op_type": "BatchNormalization", - "onnx_op_name": "BatchNormalization_13", - "onnx_output_index": 0, - "onnx_output_name": "498", - "resolved_tflite_tensor_name": "Conv_14_input_nhwc", - "exists_in_final_model": true, - "is_graph_output": false, - "consumer_count": 1, - "producer_operator_index": 17, - "producer_op_type": "ADD", - "assume_channel_last_layout": true, - "status": "rewritten", - "is_rewritten": true, - "rewrite_events": [ - { - "event_index": 60, - "kind": "rename_tensor", - "from": "498", - "to": "Conv_14_input_nhwc" - } - ], - "rewrite_name_chain": [ - "498", - "Conv_14_input_nhwc" - ] - }, - { - "identifier": 15, - "onnx_op_type": "Conv", - "onnx_op_name": "Conv_14", - "onnx_output_index": 0, - "onnx_output_name": "702", - "resolved_tflite_tensor_name": "Conv_14_output_nhwc", - "exists_in_final_model": true, - "is_graph_output": false, - "consumer_count": 1, - "producer_operator_index": 18, - "producer_op_type": "CONV_2D", - "assume_channel_last_layout": true, - "status": "rewritten", - "is_rewritten": true, - "rewrite_events": [ - { - "event_index": 9, - "kind": "replace_input", - "from": "702", - "to": "Conv_14_output_nhwc" - } - ], - "rewrite_name_chain": [ - "702", - "Conv_14_output_nhwc" - ] - }, - { - "identifier": 16, - "onnx_op_type": "PRelu", - "onnx_op_name": "PRelu_15", - "onnx_output_index": 0, - "onnx_output_name": "502", - "resolved_tflite_tensor_name": "Conv_16_input_nhwc", - "exists_in_final_model": true, - "is_graph_output": false, - "consumer_count": 1, - "producer_operator_index": 19, - "producer_op_type": "PRELU", - "assume_channel_last_layout": true, - "status": "rewritten", - "is_rewritten": true, - "rewrite_events": [ - { - "event_index": 10, - "kind": "rename_tensor", - "from": "502", - "to": "Conv_16_input_nhwc" - } - ], - "rewrite_name_chain": [ - "502", - "Conv_16_input_nhwc" - ] - }, - { - "identifier": 17, - "onnx_op_type": "Conv", - "onnx_op_name": "Conv_16", - "onnx_output_index": 0, - "onnx_output_name": "705", - "resolved_tflite_tensor_name": "Conv_16_output_nhwc", - "exists_in_final_model": true, - "is_graph_output": false, - "consumer_count": 1, - "producer_operator_index": 20, - "producer_op_type": "CONV_2D", - "assume_channel_last_layout": true, - "status": "rewritten", - "is_rewritten": true, - "rewrite_events": [ - { - "event_index": 61, - "kind": "replace_input", - "from": "705", - "to": "Conv_16_output_nhwc" - } - ], - "rewrite_name_chain": [ - "705", - "Conv_16_output_nhwc" - ] - }, - { - "identifier": 18, - "onnx_op_type": "Add", - "onnx_op_name": "Add_17", - "onnx_output_index": 0, - "onnx_output_name": "505", - "resolved_tflite_tensor_name": "Conv_22_input_nhwc", - "exists_in_final_model": true, - "is_graph_output": false, - "consumer_count": 2, - "producer_operator_index": 21, - "producer_op_type": "ADD", - "assume_channel_last_layout": true, - "status": "rewritten", - "is_rewritten": true, - "rewrite_events": [ - { - "event_index": 63, - "kind": "rename_tensor", - "from": "505", - "to": "Conv_22_input_nhwc" - }, - { - "event_index": 65, - "kind": "rename_tensor", - "from": "Conv_22_input_nhwc", - "to": "505" - }, - { - "event_index": 76, - "kind": "replace_input", - "from": "505", - "to": "Conv_22_input_nhwc" - } - ], - "rewrite_name_chain": [ - "505", - "Conv_22_input_nhwc", - "505", - "Conv_22_input_nhwc" - ] - }, - { - "identifier": 19, - "onnx_op_type": "BatchNormalization", - "onnx_op_name": "BatchNormalization_18", - "onnx_output_index": 0, - "onnx_output_name": "506", - "resolved_tflite_tensor_name": "Conv_19_input_nhwc", - "exists_in_final_model": true, - "is_graph_output": false, - "consumer_count": 1, - "producer_operator_index": 23, - "producer_op_type": "ADD", - "assume_channel_last_layout": true, - "status": "rewritten", - "is_rewritten": true, - "rewrite_events": [ - { - "event_index": 77, - "kind": "rename_tensor", - "from": "506", - "to": "Conv_19_input_nhwc" - } - ], - "rewrite_name_chain": [ - "506", - "Conv_19_input_nhwc" - ] - }, - { - "identifier": 20, - "onnx_op_type": "Conv", - "onnx_op_name": "Conv_22", - "onnx_output_index": 0, - "onnx_output_name": "714", - "resolved_tflite_tensor_name": "Conv_22_output_nhwc", - "exists_in_final_model": true, - "is_graph_output": false, - "consumer_count": 1, - "producer_operator_index": 24, - "producer_op_type": "CONV_2D", - "assume_channel_last_layout": true, - "status": "rewritten", - "is_rewritten": true, - "rewrite_events": [ - { - "event_index": 100, - "kind": "replace_input", - "from": "714", - "to": "Conv_22_output_nhwc" - } - ], - "rewrite_name_chain": [ - "714", - "Conv_22_output_nhwc" - ] - }, - { - "identifier": 21, - "onnx_op_type": "Conv", - "onnx_op_name": "Conv_19", - "onnx_output_index": 0, - "onnx_output_name": "708", - "resolved_tflite_tensor_name": "Conv_19_output_nhwc", - "exists_in_final_model": true, - "is_graph_output": false, - "consumer_count": 1, - "producer_operator_index": 25, - "producer_op_type": "CONV_2D", - "assume_channel_last_layout": true, - "status": "rewritten", - "is_rewritten": true, - "rewrite_events": [ - { - "event_index": 11, - "kind": "replace_input", - "from": "708", - "to": "Conv_19_output_nhwc" - } - ], - "rewrite_name_chain": [ - "708", - "Conv_19_output_nhwc" - ] - }, - { - "identifier": 22, - "onnx_op_type": "PRelu", - "onnx_op_name": "PRelu_20", - "onnx_output_index": 0, - "onnx_output_name": "510", - "resolved_tflite_tensor_name": "Conv_21_input_nhwc", - "exists_in_final_model": true, - "is_graph_output": false, - "consumer_count": 1, - "producer_operator_index": 26, - "producer_op_type": "PRELU", - "assume_channel_last_layout": true, - "status": "rewritten", - "is_rewritten": true, - "rewrite_events": [ - { - "event_index": 12, - "kind": "rename_tensor", - "from": "510", - "to": "Conv_21_input_nhwc" - } - ], - "rewrite_name_chain": [ - "510", - "Conv_21_input_nhwc" - ] - }, - { - "identifier": 23, - "onnx_op_type": "Conv", - "onnx_op_name": "Conv_21", - "onnx_output_index": 0, - "onnx_output_name": "711", - "resolved_tflite_tensor_name": "Conv_21_output_nhwc", - "exists_in_final_model": true, - "is_graph_output": false, - "consumer_count": 1, - "producer_operator_index": 28, - "producer_op_type": "CONV_2D", - "assume_channel_last_layout": true, - "status": "rewritten", - "is_rewritten": true, - "rewrite_events": [ - { - "event_index": 99, - "kind": "replace_input", - "from": "711", - "to": "Conv_21_output_nhwc" - } - ], - "rewrite_name_chain": [ - "711", - "Conv_21_output_nhwc" - ] - }, - { - "identifier": 24, - "onnx_op_type": "Add", - "onnx_op_name": "Add_23", - "onnx_output_index": 0, - "onnx_output_name": "515", - "resolved_tflite_tensor_name": "515_nhwc_bridge", - "exists_in_final_model": true, - "is_graph_output": false, - "consumer_count": 2, - "producer_operator_index": 29, - "producer_op_type": "ADD", - "assume_channel_last_layout": true, - "status": "rewritten", - "is_rewritten": true, - "rewrite_events": [ - { - "event_index": 95, - "kind": "replace_input", - "from": "515", - "to": "515_nhwc_bridge" - }, - { - "event_index": 103, - "kind": "rename_tensor", - "from": "515_nhwc_bridge", - "to": "515" - }, - { - "event_index": 223, - "kind": "replace_input", - "from": "515", - "to": "515_nhwc_bridge" - } - ], - "rewrite_name_chain": [ - "515", - "515_nhwc_bridge", - "515", - "515_nhwc_bridge" - ] - }, - { - "identifier": 25, - "onnx_op_type": "BatchNormalization", - "onnx_op_name": "BatchNormalization_24", - "onnx_output_index": 0, - "onnx_output_name": "516", - "resolved_tflite_tensor_name": "Conv_25_input_nhwc", - "exists_in_final_model": true, - "is_graph_output": false, - "consumer_count": 1, - "producer_operator_index": 31, - "producer_op_type": "ADD", - "assume_channel_last_layout": true, - "status": "rewritten", - "is_rewritten": true, - "rewrite_events": [ - { - "event_index": 79, - "kind": "rename_tensor", - "from": "516", - "to": "Conv_25_input_nhwc" - } - ], - "rewrite_name_chain": [ - "516", - "Conv_25_input_nhwc" - ] - }, - { - "identifier": 26, - "onnx_op_type": "Conv", - "onnx_op_name": "Conv_25", - "onnx_output_index": 0, - "onnx_output_name": "717", - "resolved_tflite_tensor_name": "Conv_25_output_nhwc", - "exists_in_final_model": true, - "is_graph_output": false, - "consumer_count": 1, - "producer_operator_index": 32, - "producer_op_type": "CONV_2D", - "assume_channel_last_layout": true, - "status": "rewritten", - "is_rewritten": true, - "rewrite_events": [ - { - "event_index": 13, - "kind": "replace_input", - "from": "717", - "to": "Conv_25_output_nhwc" - } - ], - "rewrite_name_chain": [ - "717", - "Conv_25_output_nhwc" - ] - }, - { - "identifier": 27, - "onnx_op_type": "PRelu", - "onnx_op_name": "PRelu_26", - "onnx_output_index": 0, - "onnx_output_name": "520", - "resolved_tflite_tensor_name": "Conv_27_input_nhwc", - "exists_in_final_model": true, - "is_graph_output": false, - "consumer_count": 1, - "producer_operator_index": 33, - "producer_op_type": "PRELU", - "assume_channel_last_layout": true, - "status": "rewritten", - "is_rewritten": true, - "rewrite_events": [ - { - "event_index": 14, - "kind": "rename_tensor", - "from": "520", - "to": "Conv_27_input_nhwc" - } - ], - "rewrite_name_chain": [ - "520", - "Conv_27_input_nhwc" - ] - }, - { - "identifier": 28, - "onnx_op_type": "Conv", - "onnx_op_name": "Conv_27", - "onnx_output_index": 0, - "onnx_output_name": "720", - "resolved_tflite_tensor_name": "Conv_27_output_nhwc", - "exists_in_final_model": true, - "is_graph_output": false, - "consumer_count": 1, - "producer_operator_index": 34, - "producer_op_type": "CONV_2D", - "assume_channel_last_layout": true, - "status": "rewritten", - "is_rewritten": true, - "rewrite_events": [ - { - "event_index": 94, - "kind": "replace_input", - "from": "720", - "to": "Conv_27_output_nhwc" - } - ], - "rewrite_name_chain": [ - "720", - "Conv_27_output_nhwc" - ] - }, - { - "identifier": 29, - "onnx_op_type": "Add", - "onnx_op_name": "Add_28", - "onnx_output_index": 0, - "onnx_output_name": "523", - "resolved_tflite_tensor_name": "523_nhwc_bridge", - "exists_in_final_model": true, - "is_graph_output": false, - "consumer_count": 2, - "producer_operator_index": 35, - "producer_op_type": "ADD", - "assume_channel_last_layout": true, - "status": "rewritten", - "is_rewritten": true, - "rewrite_events": [ - { - "event_index": 90, - "kind": "replace_input", - "from": "523", - "to": "523_nhwc_bridge" - }, - { - "event_index": 98, - "kind": "rename_tensor", - "from": "523_nhwc_bridge", - "to": "523" - }, - { - "event_index": 226, - "kind": "replace_input", - "from": "523", - "to": "523_nhwc_bridge" - } - ], - "rewrite_name_chain": [ - "523", - "523_nhwc_bridge", - "523", - "523_nhwc_bridge" - ] - }, - { - "identifier": 30, - "onnx_op_type": "BatchNormalization", - "onnx_op_name": "BatchNormalization_29", - "onnx_output_index": 0, - "onnx_output_name": "524", - "resolved_tflite_tensor_name": "Conv_30_input_nhwc", - "exists_in_final_model": true, - "is_graph_output": false, - "consumer_count": 1, - "producer_operator_index": 37, - "producer_op_type": "ADD", - "assume_channel_last_layout": true, - "status": "rewritten", - "is_rewritten": true, - "rewrite_events": [ - { - "event_index": 81, - "kind": "rename_tensor", - "from": "524", - "to": "Conv_30_input_nhwc" - } - ], - "rewrite_name_chain": [ - "524", - "Conv_30_input_nhwc" - ] - }, - { - "identifier": 31, - "onnx_op_type": "Conv", - "onnx_op_name": "Conv_30", - "onnx_output_index": 0, - "onnx_output_name": "723", - "resolved_tflite_tensor_name": "Conv_30_output_nhwc", - "exists_in_final_model": true, - "is_graph_output": false, - "consumer_count": 1, - "producer_operator_index": 38, - "producer_op_type": "CONV_2D", - "assume_channel_last_layout": true, - "status": "rewritten", - "is_rewritten": true, - "rewrite_events": [ - { - "event_index": 15, - "kind": "replace_input", - "from": "723", - "to": "Conv_30_output_nhwc" - } - ], - "rewrite_name_chain": [ - "723", - "Conv_30_output_nhwc" - ] - }, - { - "identifier": 32, - "onnx_op_type": "PRelu", - "onnx_op_name": "PRelu_31", - "onnx_output_index": 0, - "onnx_output_name": "528", - "resolved_tflite_tensor_name": "Conv_32_input_nhwc", - "exists_in_final_model": true, - "is_graph_output": false, - "consumer_count": 1, - "producer_operator_index": 39, - "producer_op_type": "PRELU", - "assume_channel_last_layout": true, - "status": "rewritten", - "is_rewritten": true, - "rewrite_events": [ - { - "event_index": 16, - "kind": "rename_tensor", - "from": "528", - "to": "Conv_32_input_nhwc" - } - ], - "rewrite_name_chain": [ - "528", - "Conv_32_input_nhwc" - ] - }, - { - "identifier": 33, - "onnx_op_type": "Conv", - "onnx_op_name": "Conv_32", - "onnx_output_index": 0, - "onnx_output_name": "726", - "resolved_tflite_tensor_name": "Conv_32_output_nhwc", - "exists_in_final_model": true, - "is_graph_output": false, - "consumer_count": 1, - "producer_operator_index": 40, - "producer_op_type": "CONV_2D", - "assume_channel_last_layout": true, - "status": "rewritten", - "is_rewritten": true, - "rewrite_events": [ - { - "event_index": 89, - "kind": "replace_input", - "from": "726", - "to": "Conv_32_output_nhwc" - } - ], - "rewrite_name_chain": [ - "726", - "Conv_32_output_nhwc" - ] - }, - { - "identifier": 34, - "onnx_op_type": "Add", - "onnx_op_name": "Add_33", - "onnx_output_index": 0, - "onnx_output_name": "531", - "resolved_tflite_tensor_name": "531_nhwc_bridge", - "exists_in_final_model": true, - "is_graph_output": false, - "consumer_count": 2, - "producer_operator_index": 41, - "producer_op_type": "ADD", - "assume_channel_last_layout": true, - "status": "rewritten", - "is_rewritten": true, - "rewrite_events": [ - { - "event_index": 85, - "kind": "replace_input", - "from": "531", - "to": "531_nhwc_bridge" - }, - { - "event_index": 93, - "kind": "rename_tensor", - "from": "531_nhwc_bridge", - "to": "531" - }, - { - "event_index": 229, - "kind": "replace_input", - "from": "531", - "to": "531_nhwc_bridge" - } - ], - "rewrite_name_chain": [ - "531", - "531_nhwc_bridge", - "531", - "531_nhwc_bridge" - ] - }, - { - "identifier": 35, - "onnx_op_type": "BatchNormalization", - "onnx_op_name": "BatchNormalization_34", - "onnx_output_index": 0, - "onnx_output_name": "532", - "resolved_tflite_tensor_name": "Conv_35_input_nhwc", - "exists_in_final_model": true, - "is_graph_output": false, - "consumer_count": 1, - "producer_operator_index": 43, - "producer_op_type": "ADD", - "assume_channel_last_layout": true, - "status": "rewritten", - "is_rewritten": true, - "rewrite_events": [ - { - "event_index": 83, - "kind": "rename_tensor", - "from": "532", - "to": "Conv_35_input_nhwc" - } - ], - "rewrite_name_chain": [ - "532", - "Conv_35_input_nhwc" - ] - }, - { - "identifier": 36, - "onnx_op_type": "Conv", - "onnx_op_name": "Conv_35", - "onnx_output_index": 0, - "onnx_output_name": "729", - "resolved_tflite_tensor_name": "Conv_35_output_nhwc", - "exists_in_final_model": true, - "is_graph_output": false, - "consumer_count": 1, - "producer_operator_index": 44, - "producer_op_type": "CONV_2D", - "assume_channel_last_layout": true, - "status": "rewritten", - "is_rewritten": true, - "rewrite_events": [ - { - "event_index": 17, - "kind": "replace_input", - "from": "729", - "to": "Conv_35_output_nhwc" - } - ], - "rewrite_name_chain": [ - "729", - "Conv_35_output_nhwc" - ] - }, - { - "identifier": 37, - "onnx_op_type": "PRelu", - "onnx_op_name": "PRelu_36", - "onnx_output_index": 0, - "onnx_output_name": "536", - "resolved_tflite_tensor_name": "Conv_37_input_nhwc", - "exists_in_final_model": true, - "is_graph_output": false, - "consumer_count": 1, - "producer_operator_index": 45, - "producer_op_type": "PRELU", - "assume_channel_last_layout": true, - "status": "rewritten", - "is_rewritten": true, - "rewrite_events": [ - { - "event_index": 18, - "kind": "rename_tensor", - "from": "536", - "to": "Conv_37_input_nhwc" - } - ], - "rewrite_name_chain": [ - "536", - "Conv_37_input_nhwc" - ] - }, - { - "identifier": 38, - "onnx_op_type": "Conv", - "onnx_op_name": "Conv_37", - "onnx_output_index": 0, - "onnx_output_name": "732", - "resolved_tflite_tensor_name": "Conv_37_output_nhwc", - "exists_in_final_model": true, - "is_graph_output": false, - "consumer_count": 1, - "producer_operator_index": 46, - "producer_op_type": "CONV_2D", - "assume_channel_last_layout": true, - "status": "rewritten", - "is_rewritten": true, - "rewrite_events": [ - { - "event_index": 84, - "kind": "replace_input", - "from": "732", - "to": "Conv_37_output_nhwc" - } - ], - "rewrite_name_chain": [ - "732", - "Conv_37_output_nhwc" - ] - }, - { - "identifier": 39, - "onnx_op_type": "Add", - "onnx_op_name": "Add_38", - "onnx_output_index": 0, - "onnx_output_name": "539", - "resolved_tflite_tensor_name": "Conv_43_input_nhwc", - "exists_in_final_model": true, - "is_graph_output": false, - "consumer_count": 2, - "producer_operator_index": 47, - "producer_op_type": "ADD", - "assume_channel_last_layout": true, - "status": "rewritten", - "is_rewritten": true, - "rewrite_events": [ - { - "event_index": 86, - "kind": "rename_tensor", - "from": "539", - "to": "Conv_43_input_nhwc" - }, - { - "event_index": 88, - "kind": "rename_tensor", - "from": "Conv_43_input_nhwc", - "to": "539" - }, - { - "event_index": 104, - "kind": "replace_input", - "from": "539", - "to": "Conv_43_input_nhwc" - } - ], - "rewrite_name_chain": [ - "539", - "Conv_43_input_nhwc", - "539", - "Conv_43_input_nhwc" - ] - }, - { - "identifier": 40, - "onnx_op_type": "BatchNormalization", - "onnx_op_name": "BatchNormalization_39", - "onnx_output_index": 0, - "onnx_output_name": "540", - "resolved_tflite_tensor_name": "Conv_40_input_nhwc", - "exists_in_final_model": true, - "is_graph_output": false, - "consumer_count": 1, - "producer_operator_index": 49, - "producer_op_type": "ADD", - "assume_channel_last_layout": true, - "status": "rewritten", - "is_rewritten": true, - "rewrite_events": [ - { - "event_index": 105, - "kind": "rename_tensor", - "from": "540", - "to": "Conv_40_input_nhwc" - } - ], - "rewrite_name_chain": [ - "540", - "Conv_40_input_nhwc" - ] - }, - { - "identifier": 41, - "onnx_op_type": "Conv", - "onnx_op_name": "Conv_43", - "onnx_output_index": 0, - "onnx_output_name": "741", - "resolved_tflite_tensor_name": "Conv_43_output_nhwc", - "exists_in_final_model": true, - "is_graph_output": false, - "consumer_count": 1, - "producer_operator_index": 50, - "producer_op_type": "CONV_2D", - "assume_channel_last_layout": true, - "status": "rewritten", - "is_rewritten": true, - "rewrite_events": [ - { - "event_index": 198, - "kind": "replace_input", - "from": "741", - "to": "Conv_43_output_nhwc" - } - ], - "rewrite_name_chain": [ - "741", - "Conv_43_output_nhwc" - ] - }, - { - "identifier": 42, - "onnx_op_type": "Conv", - "onnx_op_name": "Conv_40", - "onnx_output_index": 0, - "onnx_output_name": "735", - "resolved_tflite_tensor_name": "Conv_40_output_nhwc", - "exists_in_final_model": true, - "is_graph_output": false, - "consumer_count": 1, - "producer_operator_index": 51, - "producer_op_type": "CONV_2D", - "assume_channel_last_layout": true, - "status": "rewritten", - "is_rewritten": true, - "rewrite_events": [ - { - "event_index": 19, - "kind": "replace_input", - "from": "735", - "to": "Conv_40_output_nhwc" - } - ], - "rewrite_name_chain": [ - "735", - "Conv_40_output_nhwc" - ] - }, - { - "identifier": 43, - "onnx_op_type": "PRelu", - "onnx_op_name": "PRelu_41", - "onnx_output_index": 0, - "onnx_output_name": "544", - "resolved_tflite_tensor_name": "Conv_42_input_nhwc", - "exists_in_final_model": true, - "is_graph_output": false, - "consumer_count": 1, - "producer_operator_index": 52, - "producer_op_type": "PRELU", - "assume_channel_last_layout": true, - "status": "rewritten", - "is_rewritten": true, - "rewrite_events": [ - { - "event_index": 20, - "kind": "rename_tensor", - "from": "544", - "to": "Conv_42_input_nhwc" - } - ], - "rewrite_name_chain": [ - "544", - "Conv_42_input_nhwc" - ] - }, - { - "identifier": 44, - "onnx_op_type": "Conv", - "onnx_op_name": "Conv_42", - "onnx_output_index": 0, - "onnx_output_name": "738", - "resolved_tflite_tensor_name": "Conv_42_output_nhwc", - "exists_in_final_model": true, - "is_graph_output": false, - "consumer_count": 1, - "producer_operator_index": 54, - "producer_op_type": "CONV_2D", - "assume_channel_last_layout": true, - "status": "rewritten", - "is_rewritten": true, - "rewrite_events": [ - { - "event_index": 197, - "kind": "replace_input", - "from": "738", - "to": "Conv_42_output_nhwc" - } - ], - "rewrite_name_chain": [ - "738", - "Conv_42_output_nhwc" - ] - }, - { - "identifier": 45, - "onnx_op_type": "Add", - "onnx_op_name": "Add_44", - "onnx_output_index": 0, - "onnx_output_name": "549", - "resolved_tflite_tensor_name": "549_nhwc_bridge", - "exists_in_final_model": true, - "is_graph_output": false, - "consumer_count": 2, - "producer_operator_index": 55, - "producer_op_type": "ADD", - "assume_channel_last_layout": true, - "status": "rewritten", - "is_rewritten": true, - "rewrite_events": [ - { - "event_index": 193, - "kind": "replace_input", - "from": "549", - "to": "549_nhwc_bridge" - }, - { - "event_index": 201, - "kind": "rename_tensor", - "from": "549_nhwc_bridge", - "to": "549" - }, - { - "event_index": 232, - "kind": "replace_input", - "from": "549", - "to": "549_nhwc_bridge" - } - ], - "rewrite_name_chain": [ - "549", - "549_nhwc_bridge", - "549", - "549_nhwc_bridge" - ] - }, - { - "identifier": 46, - "onnx_op_type": "BatchNormalization", - "onnx_op_name": "BatchNormalization_45", - "onnx_output_index": 0, - "onnx_output_name": "550", - "resolved_tflite_tensor_name": "Conv_46_input_nhwc", - "exists_in_final_model": true, - "is_graph_output": false, - "consumer_count": 1, - "producer_operator_index": 57, - "producer_op_type": "ADD", - "assume_channel_last_layout": true, - "status": "rewritten", - "is_rewritten": true, - "rewrite_events": [ - { - "event_index": 107, - "kind": "rename_tensor", - "from": "550", - "to": "Conv_46_input_nhwc" - } - ], - "rewrite_name_chain": [ - "550", - "Conv_46_input_nhwc" - ] - }, - { - "identifier": 47, - "onnx_op_type": "Conv", - "onnx_op_name": "Conv_46", - "onnx_output_index": 0, - "onnx_output_name": "744", - "resolved_tflite_tensor_name": "Conv_46_output_nhwc", - "exists_in_final_model": true, - "is_graph_output": false, - "consumer_count": 1, - "producer_operator_index": 58, - "producer_op_type": "CONV_2D", - "assume_channel_last_layout": true, - "status": "rewritten", - "is_rewritten": true, - "rewrite_events": [ - { - "event_index": 21, - "kind": "replace_input", - "from": "744", - "to": "Conv_46_output_nhwc" - } - ], - "rewrite_name_chain": [ - "744", - "Conv_46_output_nhwc" - ] - }, - { - "identifier": 48, - "onnx_op_type": "PRelu", - "onnx_op_name": "PRelu_47", - "onnx_output_index": 0, - "onnx_output_name": "554", - "resolved_tflite_tensor_name": "Conv_48_input_nhwc", - "exists_in_final_model": true, - "is_graph_output": false, - "consumer_count": 1, - "producer_operator_index": 59, - "producer_op_type": "PRELU", - "assume_channel_last_layout": true, - "status": "rewritten", - "is_rewritten": true, - "rewrite_events": [ - { - "event_index": 22, - "kind": "rename_tensor", - "from": "554", - "to": "Conv_48_input_nhwc" - } - ], - "rewrite_name_chain": [ - "554", - "Conv_48_input_nhwc" - ] - }, - { - "identifier": 49, - "onnx_op_type": "Conv", - "onnx_op_name": "Conv_48", - "onnx_output_index": 0, - "onnx_output_name": "747", - "resolved_tflite_tensor_name": "Conv_48_output_nhwc", - "exists_in_final_model": true, - "is_graph_output": false, - "consumer_count": 1, - "producer_operator_index": 60, - "producer_op_type": "CONV_2D", - "assume_channel_last_layout": true, - "status": "rewritten", - "is_rewritten": true, - "rewrite_events": [ - { - "event_index": 192, - "kind": "replace_input", - "from": "747", - "to": "Conv_48_output_nhwc" - } - ], - "rewrite_name_chain": [ - "747", - "Conv_48_output_nhwc" - ] - }, - { - "identifier": 50, - "onnx_op_type": "Add", - "onnx_op_name": "Add_49", - "onnx_output_index": 0, - "onnx_output_name": "557", - "resolved_tflite_tensor_name": "557_nhwc_bridge", - "exists_in_final_model": true, - "is_graph_output": false, - "consumer_count": 2, - "producer_operator_index": 61, - "producer_op_type": "ADD", - "assume_channel_last_layout": true, - "status": "rewritten", - "is_rewritten": true, - "rewrite_events": [ - { - "event_index": 188, - "kind": "replace_input", - "from": "557", - "to": "557_nhwc_bridge" - }, - { - "event_index": 196, - "kind": "rename_tensor", - "from": "557_nhwc_bridge", - "to": "557" - }, - { - "event_index": 235, - "kind": "replace_input", - "from": "557", - "to": "557_nhwc_bridge" - } - ], - "rewrite_name_chain": [ - "557", - "557_nhwc_bridge", - "557", - "557_nhwc_bridge" - ] - }, - { - "identifier": 51, - "onnx_op_type": "BatchNormalization", - "onnx_op_name": "BatchNormalization_50", - "onnx_output_index": 0, - "onnx_output_name": "558", - "resolved_tflite_tensor_name": "Conv_51_input_nhwc", - "exists_in_final_model": true, - "is_graph_output": false, - "consumer_count": 1, - "producer_operator_index": 63, - "producer_op_type": "ADD", - "assume_channel_last_layout": true, - "status": "rewritten", - "is_rewritten": true, - "rewrite_events": [ - { - "event_index": 109, - "kind": "rename_tensor", - "from": "558", - "to": "Conv_51_input_nhwc" - } - ], - "rewrite_name_chain": [ - "558", - "Conv_51_input_nhwc" - ] - }, - { - "identifier": 52, - "onnx_op_type": "Conv", - "onnx_op_name": "Conv_51", - "onnx_output_index": 0, - "onnx_output_name": "750", - "resolved_tflite_tensor_name": "Conv_51_output_nhwc", - "exists_in_final_model": true, - "is_graph_output": false, - "consumer_count": 1, - "producer_operator_index": 64, - "producer_op_type": "CONV_2D", - "assume_channel_last_layout": true, - "status": "rewritten", - "is_rewritten": true, - "rewrite_events": [ - { - "event_index": 23, - "kind": "replace_input", - "from": "750", - "to": "Conv_51_output_nhwc" - } - ], - "rewrite_name_chain": [ - "750", - "Conv_51_output_nhwc" - ] - }, - { - "identifier": 53, - "onnx_op_type": "PRelu", - "onnx_op_name": "PRelu_52", - "onnx_output_index": 0, - "onnx_output_name": "562", - "resolved_tflite_tensor_name": "Conv_53_input_nhwc", - "exists_in_final_model": true, - "is_graph_output": false, - "consumer_count": 1, - "producer_operator_index": 65, - "producer_op_type": "PRELU", - "assume_channel_last_layout": true, - "status": "rewritten", - "is_rewritten": true, - "rewrite_events": [ - { - "event_index": 24, - "kind": "rename_tensor", - "from": "562", - "to": "Conv_53_input_nhwc" - } - ], - "rewrite_name_chain": [ - "562", - "Conv_53_input_nhwc" - ] - }, - { - "identifier": 54, - "onnx_op_type": "Conv", - "onnx_op_name": "Conv_53", - "onnx_output_index": 0, - "onnx_output_name": "753", - "resolved_tflite_tensor_name": "Conv_53_output_nhwc", - "exists_in_final_model": true, - "is_graph_output": false, - "consumer_count": 1, - "producer_operator_index": 66, - "producer_op_type": "CONV_2D", - "assume_channel_last_layout": true, - "status": "rewritten", - "is_rewritten": true, - "rewrite_events": [ - { - "event_index": 187, - "kind": "replace_input", - "from": "753", - "to": "Conv_53_output_nhwc" - } - ], - "rewrite_name_chain": [ - "753", - "Conv_53_output_nhwc" - ] - }, - { - "identifier": 55, - "onnx_op_type": "Add", - "onnx_op_name": "Add_54", - "onnx_output_index": 0, - "onnx_output_name": "565", - "resolved_tflite_tensor_name": "565_nhwc_bridge", - "exists_in_final_model": true, - "is_graph_output": false, - "consumer_count": 2, - "producer_operator_index": 67, - "producer_op_type": "ADD", - "assume_channel_last_layout": true, - "status": "rewritten", - "is_rewritten": true, - "rewrite_events": [ - { - "event_index": 183, - "kind": "replace_input", - "from": "565", - "to": "565_nhwc_bridge" - }, - { - "event_index": 191, - "kind": "rename_tensor", - "from": "565_nhwc_bridge", - "to": "565" - }, - { - "event_index": 238, - "kind": "replace_input", - "from": "565", - "to": "565_nhwc_bridge" - } - ], - "rewrite_name_chain": [ - "565", - "565_nhwc_bridge", - "565", - "565_nhwc_bridge" - ] - }, - { - "identifier": 56, - "onnx_op_type": "BatchNormalization", - "onnx_op_name": "BatchNormalization_55", - "onnx_output_index": 0, - "onnx_output_name": "566", - "resolved_tflite_tensor_name": "Conv_56_input_nhwc", - "exists_in_final_model": true, - "is_graph_output": false, - "consumer_count": 1, - "producer_operator_index": 69, - "producer_op_type": "ADD", - "assume_channel_last_layout": true, - "status": "rewritten", - "is_rewritten": true, - "rewrite_events": [ - { - "event_index": 111, - "kind": "rename_tensor", - "from": "566", - "to": "Conv_56_input_nhwc" - } - ], - "rewrite_name_chain": [ - "566", - "Conv_56_input_nhwc" - ] - }, - { - "identifier": 57, - "onnx_op_type": "Conv", - "onnx_op_name": "Conv_56", - "onnx_output_index": 0, - "onnx_output_name": "756", - "resolved_tflite_tensor_name": "Conv_56_output_nhwc", - "exists_in_final_model": true, - "is_graph_output": false, - "consumer_count": 1, - "producer_operator_index": 70, - "producer_op_type": "CONV_2D", - "assume_channel_last_layout": true, - "status": "rewritten", - "is_rewritten": true, - "rewrite_events": [ - { - "event_index": 25, - "kind": "replace_input", - "from": "756", - "to": "Conv_56_output_nhwc" - } - ], - "rewrite_name_chain": [ - "756", - "Conv_56_output_nhwc" - ] - }, - { - "identifier": 58, - "onnx_op_type": "PRelu", - "onnx_op_name": "PRelu_57", - "onnx_output_index": 0, - "onnx_output_name": "570", - "resolved_tflite_tensor_name": "Conv_58_input_nhwc", - "exists_in_final_model": true, - "is_graph_output": false, - "consumer_count": 1, - "producer_operator_index": 71, - "producer_op_type": "PRELU", - "assume_channel_last_layout": true, - "status": "rewritten", - "is_rewritten": true, - "rewrite_events": [ - { - "event_index": 26, - "kind": "rename_tensor", - "from": "570", - "to": "Conv_58_input_nhwc" - } - ], - "rewrite_name_chain": [ - "570", - "Conv_58_input_nhwc" - ] - }, - { - "identifier": 59, - "onnx_op_type": "Conv", - "onnx_op_name": "Conv_58", - "onnx_output_index": 0, - "onnx_output_name": "759", - "resolved_tflite_tensor_name": "Conv_58_output_nhwc", - "exists_in_final_model": true, - "is_graph_output": false, - "consumer_count": 1, - "producer_operator_index": 72, - "producer_op_type": "CONV_2D", - "assume_channel_last_layout": true, - "status": "rewritten", - "is_rewritten": true, - "rewrite_events": [ - { - "event_index": 182, - "kind": "replace_input", - "from": "759", - "to": "Conv_58_output_nhwc" - } - ], - "rewrite_name_chain": [ - "759", - "Conv_58_output_nhwc" - ] - }, - { - "identifier": 60, - "onnx_op_type": "Add", - "onnx_op_name": "Add_59", - "onnx_output_index": 0, - "onnx_output_name": "573", - "resolved_tflite_tensor_name": "573_nhwc_bridge", - "exists_in_final_model": true, - "is_graph_output": false, - "consumer_count": 2, - "producer_operator_index": 73, - "producer_op_type": "ADD", - "assume_channel_last_layout": true, - "status": "rewritten", - "is_rewritten": true, - "rewrite_events": [ - { - "event_index": 178, - "kind": "replace_input", - "from": "573", - "to": "573_nhwc_bridge" - }, - { - "event_index": 186, - "kind": "rename_tensor", - "from": "573_nhwc_bridge", - "to": "573" - }, - { - "event_index": 241, - "kind": "replace_input", - "from": "573", - "to": "573_nhwc_bridge" - } - ], - "rewrite_name_chain": [ - "573", - "573_nhwc_bridge", - "573", - "573_nhwc_bridge" - ] - }, - { - "identifier": 61, - "onnx_op_type": "BatchNormalization", - "onnx_op_name": "BatchNormalization_60", - "onnx_output_index": 0, - "onnx_output_name": "574", - "resolved_tflite_tensor_name": "Conv_61_input_nhwc", - "exists_in_final_model": true, - "is_graph_output": false, - "consumer_count": 1, - "producer_operator_index": 75, - "producer_op_type": "ADD", - "assume_channel_last_layout": true, - "status": "rewritten", - "is_rewritten": true, - "rewrite_events": [ - { - "event_index": 113, - "kind": "rename_tensor", - "from": "574", - "to": "Conv_61_input_nhwc" - } - ], - "rewrite_name_chain": [ - "574", - "Conv_61_input_nhwc" - ] - }, - { - "identifier": 62, - "onnx_op_type": "Conv", - "onnx_op_name": "Conv_61", - "onnx_output_index": 0, - "onnx_output_name": "762", - "resolved_tflite_tensor_name": "Conv_61_output_nhwc", - "exists_in_final_model": true, - "is_graph_output": false, - "consumer_count": 1, - "producer_operator_index": 76, - "producer_op_type": "CONV_2D", - "assume_channel_last_layout": true, - "status": "rewritten", - "is_rewritten": true, - "rewrite_events": [ - { - "event_index": 27, - "kind": "replace_input", - "from": "762", - "to": "Conv_61_output_nhwc" - } - ], - "rewrite_name_chain": [ - "762", - "Conv_61_output_nhwc" - ] - }, - { - "identifier": 63, - "onnx_op_type": "PRelu", - "onnx_op_name": "PRelu_62", - "onnx_output_index": 0, - "onnx_output_name": "578", - "resolved_tflite_tensor_name": "Conv_63_input_nhwc", - "exists_in_final_model": true, - "is_graph_output": false, - "consumer_count": 1, - "producer_operator_index": 77, - "producer_op_type": "PRELU", - "assume_channel_last_layout": true, - "status": "rewritten", - "is_rewritten": true, - "rewrite_events": [ - { - "event_index": 28, - "kind": "rename_tensor", - "from": "578", - "to": "Conv_63_input_nhwc" - } - ], - "rewrite_name_chain": [ - "578", - "Conv_63_input_nhwc" - ] - }, - { - "identifier": 64, - "onnx_op_type": "Conv", - "onnx_op_name": "Conv_63", - "onnx_output_index": 0, - "onnx_output_name": "765", - "resolved_tflite_tensor_name": "Conv_63_output_nhwc", - "exists_in_final_model": true, - "is_graph_output": false, - "consumer_count": 1, - "producer_operator_index": 78, - "producer_op_type": "CONV_2D", - "assume_channel_last_layout": true, - "status": "rewritten", - "is_rewritten": true, - "rewrite_events": [ - { - "event_index": 177, - "kind": "replace_input", - "from": "765", - "to": "Conv_63_output_nhwc" - } - ], - "rewrite_name_chain": [ - "765", - "Conv_63_output_nhwc" - ] - }, - { - "identifier": 65, - "onnx_op_type": "Add", - "onnx_op_name": "Add_64", - "onnx_output_index": 0, - "onnx_output_name": "581", - "resolved_tflite_tensor_name": "581_nhwc_bridge", - "exists_in_final_model": true, - "is_graph_output": false, - "consumer_count": 2, - "producer_operator_index": 79, - "producer_op_type": "ADD", - "assume_channel_last_layout": true, - "status": "rewritten", - "is_rewritten": true, - "rewrite_events": [ - { - "event_index": 173, - "kind": "replace_input", - "from": "581", - "to": "581_nhwc_bridge" - }, - { - "event_index": 181, - "kind": "rename_tensor", - "from": "581_nhwc_bridge", - "to": "581" - }, - { - "event_index": 244, - "kind": "replace_input", - "from": "581", - "to": "581_nhwc_bridge" - } - ], - "rewrite_name_chain": [ - "581", - "581_nhwc_bridge", - "581", - "581_nhwc_bridge" - ] - }, - { - "identifier": 66, - "onnx_op_type": "BatchNormalization", - "onnx_op_name": "BatchNormalization_65", - "onnx_output_index": 0, - "onnx_output_name": "582", - "resolved_tflite_tensor_name": "Conv_66_input_nhwc", - "exists_in_final_model": true, - "is_graph_output": false, - "consumer_count": 1, - "producer_operator_index": 81, - "producer_op_type": "ADD", - "assume_channel_last_layout": true, - "status": "rewritten", - "is_rewritten": true, - "rewrite_events": [ - { - "event_index": 115, - "kind": "rename_tensor", - "from": "582", - "to": "Conv_66_input_nhwc" - } - ], - "rewrite_name_chain": [ - "582", - "Conv_66_input_nhwc" - ] - }, - { - "identifier": 67, - "onnx_op_type": "Conv", - "onnx_op_name": "Conv_66", - "onnx_output_index": 0, - "onnx_output_name": "768", - "resolved_tflite_tensor_name": "Conv_66_output_nhwc", - "exists_in_final_model": true, - "is_graph_output": false, - "consumer_count": 1, - "producer_operator_index": 82, - "producer_op_type": "CONV_2D", - "assume_channel_last_layout": true, - "status": "rewritten", - "is_rewritten": true, - "rewrite_events": [ - { - "event_index": 29, - "kind": "replace_input", - "from": "768", - "to": "Conv_66_output_nhwc" - } - ], - "rewrite_name_chain": [ - "768", - "Conv_66_output_nhwc" - ] - }, - { - "identifier": 68, - "onnx_op_type": "PRelu", - "onnx_op_name": "PRelu_67", - "onnx_output_index": 0, - "onnx_output_name": "586", - "resolved_tflite_tensor_name": "Conv_68_input_nhwc", - "exists_in_final_model": true, - "is_graph_output": false, - "consumer_count": 1, - "producer_operator_index": 83, - "producer_op_type": "PRELU", - "assume_channel_last_layout": true, - "status": "rewritten", - "is_rewritten": true, - "rewrite_events": [ - { - "event_index": 30, - "kind": "rename_tensor", - "from": "586", - "to": "Conv_68_input_nhwc" - } - ], - "rewrite_name_chain": [ - "586", - "Conv_68_input_nhwc" - ] - }, - { - "identifier": 69, - "onnx_op_type": "Conv", - "onnx_op_name": "Conv_68", - "onnx_output_index": 0, - "onnx_output_name": "771", - "resolved_tflite_tensor_name": "Conv_68_output_nhwc", - "exists_in_final_model": true, - "is_graph_output": false, - "consumer_count": 1, - "producer_operator_index": 84, - "producer_op_type": "CONV_2D", - "assume_channel_last_layout": true, - "status": "rewritten", - "is_rewritten": true, - "rewrite_events": [ - { - "event_index": 172, - "kind": "replace_input", - "from": "771", - "to": "Conv_68_output_nhwc" - } - ], - "rewrite_name_chain": [ - "771", - "Conv_68_output_nhwc" - ] - }, - { - "identifier": 70, - "onnx_op_type": "Add", - "onnx_op_name": "Add_69", - "onnx_output_index": 0, - "onnx_output_name": "589", - "resolved_tflite_tensor_name": "589_nhwc_bridge", - "exists_in_final_model": true, - "is_graph_output": false, - "consumer_count": 2, - "producer_operator_index": 85, - "producer_op_type": "ADD", - "assume_channel_last_layout": true, - "status": "rewritten", - "is_rewritten": true, - "rewrite_events": [ - { - "event_index": 168, - "kind": "replace_input", - "from": "589", - "to": "589_nhwc_bridge" - }, - { - "event_index": 176, - "kind": "rename_tensor", - "from": "589_nhwc_bridge", - "to": "589" - }, - { - "event_index": 247, - "kind": "replace_input", - "from": "589", - "to": "589_nhwc_bridge" - } - ], - "rewrite_name_chain": [ - "589", - "589_nhwc_bridge", - "589", - "589_nhwc_bridge" - ] - }, - { - "identifier": 71, - "onnx_op_type": "BatchNormalization", - "onnx_op_name": "BatchNormalization_70", - "onnx_output_index": 0, - "onnx_output_name": "590", - "resolved_tflite_tensor_name": "Conv_71_input_nhwc", - "exists_in_final_model": true, - "is_graph_output": false, - "consumer_count": 1, - "producer_operator_index": 87, - "producer_op_type": "ADD", - "assume_channel_last_layout": true, - "status": "rewritten", - "is_rewritten": true, - "rewrite_events": [ - { - "event_index": 117, - "kind": "rename_tensor", - "from": "590", - "to": "Conv_71_input_nhwc" - } - ], - "rewrite_name_chain": [ - "590", - "Conv_71_input_nhwc" - ] - }, - { - "identifier": 72, - "onnx_op_type": "Conv", - "onnx_op_name": "Conv_71", - "onnx_output_index": 0, - "onnx_output_name": "774", - "resolved_tflite_tensor_name": "Conv_71_output_nhwc", - "exists_in_final_model": true, - "is_graph_output": false, - "consumer_count": 1, - "producer_operator_index": 88, - "producer_op_type": "CONV_2D", - "assume_channel_last_layout": true, - "status": "rewritten", - "is_rewritten": true, - "rewrite_events": [ - { - "event_index": 31, - "kind": "replace_input", - "from": "774", - "to": "Conv_71_output_nhwc" - } - ], - "rewrite_name_chain": [ - "774", - "Conv_71_output_nhwc" - ] - }, - { - "identifier": 73, - "onnx_op_type": "PRelu", - "onnx_op_name": "PRelu_72", - "onnx_output_index": 0, - "onnx_output_name": "594", - "resolved_tflite_tensor_name": "Conv_73_input_nhwc", - "exists_in_final_model": true, - "is_graph_output": false, - "consumer_count": 1, - "producer_operator_index": 89, - "producer_op_type": "PRELU", - "assume_channel_last_layout": true, - "status": "rewritten", - "is_rewritten": true, - "rewrite_events": [ - { - "event_index": 32, - "kind": "rename_tensor", - "from": "594", - "to": "Conv_73_input_nhwc" - } - ], - "rewrite_name_chain": [ - "594", - "Conv_73_input_nhwc" - ] - }, - { - "identifier": 74, - "onnx_op_type": "Conv", - "onnx_op_name": "Conv_73", - "onnx_output_index": 0, - "onnx_output_name": "777", - "resolved_tflite_tensor_name": "Conv_73_output_nhwc", - "exists_in_final_model": true, - "is_graph_output": false, - "consumer_count": 1, - "producer_operator_index": 90, - "producer_op_type": "CONV_2D", - "assume_channel_last_layout": true, - "status": "rewritten", - "is_rewritten": true, - "rewrite_events": [ - { - "event_index": 167, - "kind": "replace_input", - "from": "777", - "to": "Conv_73_output_nhwc" - } - ], - "rewrite_name_chain": [ - "777", - "Conv_73_output_nhwc" - ] - }, - { - "identifier": 75, - "onnx_op_type": "Add", - "onnx_op_name": "Add_74", - "onnx_output_index": 0, - "onnx_output_name": "597", - "resolved_tflite_tensor_name": "597_nhwc_bridge", - "exists_in_final_model": true, - "is_graph_output": false, - "consumer_count": 2, - "producer_operator_index": 91, - "producer_op_type": "ADD", - "assume_channel_last_layout": true, - "status": "rewritten", - "is_rewritten": true, - "rewrite_events": [ - { - "event_index": 163, - "kind": "replace_input", - "from": "597", - "to": "597_nhwc_bridge" - }, - { - "event_index": 171, - "kind": "rename_tensor", - "from": "597_nhwc_bridge", - "to": "597" - }, - { - "event_index": 250, - "kind": "replace_input", - "from": "597", - "to": "597_nhwc_bridge" - } - ], - "rewrite_name_chain": [ - "597", - "597_nhwc_bridge", - "597", - "597_nhwc_bridge" - ] - }, - { - "identifier": 76, - "onnx_op_type": "BatchNormalization", - "onnx_op_name": "BatchNormalization_75", - "onnx_output_index": 0, - "onnx_output_name": "598", - "resolved_tflite_tensor_name": "Conv_76_input_nhwc", - "exists_in_final_model": true, - "is_graph_output": false, - "consumer_count": 1, - "producer_operator_index": 93, - "producer_op_type": "ADD", - "assume_channel_last_layout": true, - "status": "rewritten", - "is_rewritten": true, - "rewrite_events": [ - { - "event_index": 119, - "kind": "rename_tensor", - "from": "598", - "to": "Conv_76_input_nhwc" - } - ], - "rewrite_name_chain": [ - "598", - "Conv_76_input_nhwc" - ] - }, - { - "identifier": 77, - "onnx_op_type": "Conv", - "onnx_op_name": "Conv_76", - "onnx_output_index": 0, - "onnx_output_name": "780", - "resolved_tflite_tensor_name": "Conv_76_output_nhwc", - "exists_in_final_model": true, - "is_graph_output": false, - "consumer_count": 1, - "producer_operator_index": 94, - "producer_op_type": "CONV_2D", - "assume_channel_last_layout": true, - "status": "rewritten", - "is_rewritten": true, - "rewrite_events": [ - { - "event_index": 33, - "kind": "replace_input", - "from": "780", - "to": "Conv_76_output_nhwc" - } - ], - "rewrite_name_chain": [ - "780", - "Conv_76_output_nhwc" - ] - }, - { - "identifier": 78, - "onnx_op_type": "PRelu", - "onnx_op_name": "PRelu_77", - "onnx_output_index": 0, - "onnx_output_name": "602", - "resolved_tflite_tensor_name": "Conv_78_input_nhwc", - "exists_in_final_model": true, - "is_graph_output": false, - "consumer_count": 1, - "producer_operator_index": 95, - "producer_op_type": "PRELU", - "assume_channel_last_layout": true, - "status": "rewritten", - "is_rewritten": true, - "rewrite_events": [ - { - "event_index": 34, - "kind": "rename_tensor", - "from": "602", - "to": "Conv_78_input_nhwc" - } - ], - "rewrite_name_chain": [ - "602", - "Conv_78_input_nhwc" - ] - }, - { - "identifier": 79, - "onnx_op_type": "Conv", - "onnx_op_name": "Conv_78", - "onnx_output_index": 0, - "onnx_output_name": "783", - "resolved_tflite_tensor_name": "Conv_78_output_nhwc", - "exists_in_final_model": true, - "is_graph_output": false, - "consumer_count": 1, - "producer_operator_index": 96, - "producer_op_type": "CONV_2D", - "assume_channel_last_layout": true, - "status": "rewritten", - "is_rewritten": true, - "rewrite_events": [ - { - "event_index": 162, - "kind": "replace_input", - "from": "783", - "to": "Conv_78_output_nhwc" - } - ], - "rewrite_name_chain": [ - "783", - "Conv_78_output_nhwc" - ] - }, - { - "identifier": 80, - "onnx_op_type": "Add", - "onnx_op_name": "Add_79", - "onnx_output_index": 0, - "onnx_output_name": "605", - "resolved_tflite_tensor_name": "605_nhwc_bridge", - "exists_in_final_model": true, - "is_graph_output": false, - "consumer_count": 2, - "producer_operator_index": 97, - "producer_op_type": "ADD", - "assume_channel_last_layout": true, - "status": "rewritten", - "is_rewritten": true, - "rewrite_events": [ - { - "event_index": 158, - "kind": "replace_input", - "from": "605", - "to": "605_nhwc_bridge" - }, - { - "event_index": 166, - "kind": "rename_tensor", - "from": "605_nhwc_bridge", - "to": "605" - }, - { - "event_index": 253, - "kind": "replace_input", - "from": "605", - "to": "605_nhwc_bridge" - } - ], - "rewrite_name_chain": [ - "605", - "605_nhwc_bridge", - "605", - "605_nhwc_bridge" - ] - }, - { - "identifier": 81, - "onnx_op_type": "BatchNormalization", - "onnx_op_name": "BatchNormalization_80", - "onnx_output_index": 0, - "onnx_output_name": "606", - "resolved_tflite_tensor_name": "Conv_81_input_nhwc", - "exists_in_final_model": true, - "is_graph_output": false, - "consumer_count": 1, - "producer_operator_index": 99, - "producer_op_type": "ADD", - "assume_channel_last_layout": true, - "status": "rewritten", - "is_rewritten": true, - "rewrite_events": [ - { - "event_index": 121, - "kind": "rename_tensor", - "from": "606", - "to": "Conv_81_input_nhwc" - } - ], - "rewrite_name_chain": [ - "606", - "Conv_81_input_nhwc" - ] - }, - { - "identifier": 82, - "onnx_op_type": "Conv", - "onnx_op_name": "Conv_81", - "onnx_output_index": 0, - "onnx_output_name": "786", - "resolved_tflite_tensor_name": "Conv_81_output_nhwc", - "exists_in_final_model": true, - "is_graph_output": false, - "consumer_count": 1, - "producer_operator_index": 100, - "producer_op_type": "CONV_2D", - "assume_channel_last_layout": true, - "status": "rewritten", - "is_rewritten": true, - "rewrite_events": [ - { - "event_index": 35, - "kind": "replace_input", - "from": "786", - "to": "Conv_81_output_nhwc" - } - ], - "rewrite_name_chain": [ - "786", - "Conv_81_output_nhwc" - ] - }, - { - "identifier": 83, - "onnx_op_type": "PRelu", - "onnx_op_name": "PRelu_82", - "onnx_output_index": 0, - "onnx_output_name": "610", - "resolved_tflite_tensor_name": "Conv_83_input_nhwc", - "exists_in_final_model": true, - "is_graph_output": false, - "consumer_count": 1, - "producer_operator_index": 101, - "producer_op_type": "PRELU", - "assume_channel_last_layout": true, - "status": "rewritten", - "is_rewritten": true, - "rewrite_events": [ - { - "event_index": 36, - "kind": "rename_tensor", - "from": "610", - "to": "Conv_83_input_nhwc" - } - ], - "rewrite_name_chain": [ - "610", - "Conv_83_input_nhwc" - ] - }, - { - "identifier": 84, - "onnx_op_type": "Conv", - "onnx_op_name": "Conv_83", - "onnx_output_index": 0, - "onnx_output_name": "789", - "resolved_tflite_tensor_name": "Conv_83_output_nhwc", - "exists_in_final_model": true, - "is_graph_output": false, - "consumer_count": 1, - "producer_operator_index": 102, - "producer_op_type": "CONV_2D", - "assume_channel_last_layout": true, - "status": "rewritten", - "is_rewritten": true, - "rewrite_events": [ - { - "event_index": 157, - "kind": "replace_input", - "from": "789", - "to": "Conv_83_output_nhwc" - } - ], - "rewrite_name_chain": [ - "789", - "Conv_83_output_nhwc" - ] - }, - { - "identifier": 85, - "onnx_op_type": "Add", - "onnx_op_name": "Add_84", - "onnx_output_index": 0, - "onnx_output_name": "613", - "resolved_tflite_tensor_name": "613_nhwc_bridge", - "exists_in_final_model": true, - "is_graph_output": false, - "consumer_count": 2, - "producer_operator_index": 103, - "producer_op_type": "ADD", - "assume_channel_last_layout": true, - "status": "rewritten", - "is_rewritten": true, - "rewrite_events": [ - { - "event_index": 153, - "kind": "replace_input", - "from": "613", - "to": "613_nhwc_bridge" - }, - { - "event_index": 161, - "kind": "rename_tensor", - "from": "613_nhwc_bridge", - "to": "613" - }, - { - "event_index": 256, - "kind": "replace_input", - "from": "613", - "to": "613_nhwc_bridge" - } - ], - "rewrite_name_chain": [ - "613", - "613_nhwc_bridge", - "613", - "613_nhwc_bridge" - ] - }, - { - "identifier": 86, - "onnx_op_type": "BatchNormalization", - "onnx_op_name": "BatchNormalization_85", - "onnx_output_index": 0, - "onnx_output_name": "614", - "resolved_tflite_tensor_name": "Conv_86_input_nhwc", - "exists_in_final_model": true, - "is_graph_output": false, - "consumer_count": 1, - "producer_operator_index": 105, - "producer_op_type": "ADD", - "assume_channel_last_layout": true, - "status": "rewritten", - "is_rewritten": true, - "rewrite_events": [ - { - "event_index": 123, - "kind": "rename_tensor", - "from": "614", - "to": "Conv_86_input_nhwc" - } - ], - "rewrite_name_chain": [ - "614", - "Conv_86_input_nhwc" - ] - }, - { - "identifier": 87, - "onnx_op_type": "Conv", - "onnx_op_name": "Conv_86", - "onnx_output_index": 0, - "onnx_output_name": "792", - "resolved_tflite_tensor_name": "Conv_86_output_nhwc", - "exists_in_final_model": true, - "is_graph_output": false, - "consumer_count": 1, - "producer_operator_index": 106, - "producer_op_type": "CONV_2D", - "assume_channel_last_layout": true, - "status": "rewritten", - "is_rewritten": true, - "rewrite_events": [ - { - "event_index": 37, - "kind": "replace_input", - "from": "792", - "to": "Conv_86_output_nhwc" - } - ], - "rewrite_name_chain": [ - "792", - "Conv_86_output_nhwc" - ] - }, - { - "identifier": 88, - "onnx_op_type": "PRelu", - "onnx_op_name": "PRelu_87", - "onnx_output_index": 0, - "onnx_output_name": "618", - "resolved_tflite_tensor_name": "Conv_88_input_nhwc", - "exists_in_final_model": true, - "is_graph_output": false, - "consumer_count": 1, - "producer_operator_index": 107, - "producer_op_type": "PRELU", - "assume_channel_last_layout": true, - "status": "rewritten", - "is_rewritten": true, - "rewrite_events": [ - { - "event_index": 38, - "kind": "rename_tensor", - "from": "618", - "to": "Conv_88_input_nhwc" - } - ], - "rewrite_name_chain": [ - "618", - "Conv_88_input_nhwc" - ] - }, - { - "identifier": 89, - "onnx_op_type": "Conv", - "onnx_op_name": "Conv_88", - "onnx_output_index": 0, - "onnx_output_name": "795", - "resolved_tflite_tensor_name": "Conv_88_output_nhwc", - "exists_in_final_model": true, - "is_graph_output": false, - "consumer_count": 1, - "producer_operator_index": 108, - "producer_op_type": "CONV_2D", - "assume_channel_last_layout": true, - "status": "rewritten", - "is_rewritten": true, - "rewrite_events": [ - { - "event_index": 152, - "kind": "replace_input", - "from": "795", - "to": "Conv_88_output_nhwc" - } - ], - "rewrite_name_chain": [ - "795", - "Conv_88_output_nhwc" - ] - }, - { - "identifier": 90, - "onnx_op_type": "Add", - "onnx_op_name": "Add_89", - "onnx_output_index": 0, - "onnx_output_name": "621", - "resolved_tflite_tensor_name": "621_nhwc_bridge", - "exists_in_final_model": true, - "is_graph_output": false, - "consumer_count": 2, - "producer_operator_index": 109, - "producer_op_type": "ADD", - "assume_channel_last_layout": true, - "status": "rewritten", - "is_rewritten": true, - "rewrite_events": [ - { - "event_index": 148, - "kind": "replace_input", - "from": "621", - "to": "621_nhwc_bridge" - }, - { - "event_index": 156, - "kind": "rename_tensor", - "from": "621_nhwc_bridge", - "to": "621" - }, - { - "event_index": 259, - "kind": "replace_input", - "from": "621", - "to": "621_nhwc_bridge" - } - ], - "rewrite_name_chain": [ - "621", - "621_nhwc_bridge", - "621", - "621_nhwc_bridge" - ] - }, - { - "identifier": 91, - "onnx_op_type": "BatchNormalization", - "onnx_op_name": "BatchNormalization_90", - "onnx_output_index": 0, - "onnx_output_name": "622", - "resolved_tflite_tensor_name": "Conv_91_input_nhwc", - "exists_in_final_model": true, - "is_graph_output": false, - "consumer_count": 1, - "producer_operator_index": 111, - "producer_op_type": "ADD", - "assume_channel_last_layout": true, - "status": "rewritten", - "is_rewritten": true, - "rewrite_events": [ - { - "event_index": 125, - "kind": "rename_tensor", - "from": "622", - "to": "Conv_91_input_nhwc" - } - ], - "rewrite_name_chain": [ - "622", - "Conv_91_input_nhwc" - ] - }, - { - "identifier": 92, - "onnx_op_type": "Conv", - "onnx_op_name": "Conv_91", - "onnx_output_index": 0, - "onnx_output_name": "798", - "resolved_tflite_tensor_name": "Conv_91_output_nhwc", - "exists_in_final_model": true, - "is_graph_output": false, - "consumer_count": 1, - "producer_operator_index": 112, - "producer_op_type": "CONV_2D", - "assume_channel_last_layout": true, - "status": "rewritten", - "is_rewritten": true, - "rewrite_events": [ - { - "event_index": 39, - "kind": "replace_input", - "from": "798", - "to": "Conv_91_output_nhwc" - } - ], - "rewrite_name_chain": [ - "798", - "Conv_91_output_nhwc" - ] - }, - { - "identifier": 93, - "onnx_op_type": "PRelu", - "onnx_op_name": "PRelu_92", - "onnx_output_index": 0, - "onnx_output_name": "626", - "resolved_tflite_tensor_name": "Conv_93_input_nhwc", - "exists_in_final_model": true, - "is_graph_output": false, - "consumer_count": 1, - "producer_operator_index": 113, - "producer_op_type": "PRELU", - "assume_channel_last_layout": true, - "status": "rewritten", - "is_rewritten": true, - "rewrite_events": [ - { - "event_index": 40, - "kind": "rename_tensor", - "from": "626", - "to": "Conv_93_input_nhwc" - } - ], - "rewrite_name_chain": [ - "626", - "Conv_93_input_nhwc" - ] - }, - { - "identifier": 94, - "onnx_op_type": "Conv", - "onnx_op_name": "Conv_93", - "onnx_output_index": 0, - "onnx_output_name": "801", - "resolved_tflite_tensor_name": "Conv_93_output_nhwc", - "exists_in_final_model": true, - "is_graph_output": false, - "consumer_count": 1, - "producer_operator_index": 114, - "producer_op_type": "CONV_2D", - "assume_channel_last_layout": true, - "status": "rewritten", - "is_rewritten": true, - "rewrite_events": [ - { - "event_index": 147, - "kind": "replace_input", - "from": "801", - "to": "Conv_93_output_nhwc" - } - ], - "rewrite_name_chain": [ - "801", - "Conv_93_output_nhwc" - ] - }, - { - "identifier": 95, - "onnx_op_type": "Add", - "onnx_op_name": "Add_94", - "onnx_output_index": 0, - "onnx_output_name": "629", - "resolved_tflite_tensor_name": "629_nhwc_bridge", - "exists_in_final_model": true, - "is_graph_output": false, - "consumer_count": 2, - "producer_operator_index": 115, - "producer_op_type": "ADD", - "assume_channel_last_layout": true, - "status": "rewritten", - "is_rewritten": true, - "rewrite_events": [ - { - "event_index": 143, - "kind": "replace_input", - "from": "629", - "to": "629_nhwc_bridge" - }, - { - "event_index": 151, - "kind": "rename_tensor", - "from": "629_nhwc_bridge", - "to": "629" - }, - { - "event_index": 262, - "kind": "replace_input", - "from": "629", - "to": "629_nhwc_bridge" - } - ], - "rewrite_name_chain": [ - "629", - "629_nhwc_bridge", - "629", - "629_nhwc_bridge" - ] - }, - { - "identifier": 96, - "onnx_op_type": "BatchNormalization", - "onnx_op_name": "BatchNormalization_95", - "onnx_output_index": 0, - "onnx_output_name": "630", - "resolved_tflite_tensor_name": "Conv_96_input_nhwc", - "exists_in_final_model": true, - "is_graph_output": false, - "consumer_count": 1, - "producer_operator_index": 117, - "producer_op_type": "ADD", - "assume_channel_last_layout": true, - "status": "rewritten", - "is_rewritten": true, - "rewrite_events": [ - { - "event_index": 127, - "kind": "rename_tensor", - "from": "630", - "to": "Conv_96_input_nhwc" - } - ], - "rewrite_name_chain": [ - "630", - "Conv_96_input_nhwc" - ] - }, - { - "identifier": 97, - "onnx_op_type": "Conv", - "onnx_op_name": "Conv_96", - "onnx_output_index": 0, - "onnx_output_name": "804", - "resolved_tflite_tensor_name": "Conv_96_output_nhwc", - "exists_in_final_model": true, - "is_graph_output": false, - "consumer_count": 1, - "producer_operator_index": 118, - "producer_op_type": "CONV_2D", - "assume_channel_last_layout": true, - "status": "rewritten", - "is_rewritten": true, - "rewrite_events": [ - { - "event_index": 41, - "kind": "replace_input", - "from": "804", - "to": "Conv_96_output_nhwc" - } - ], - "rewrite_name_chain": [ - "804", - "Conv_96_output_nhwc" - ] - }, - { - "identifier": 98, - "onnx_op_type": "PRelu", - "onnx_op_name": "PRelu_97", - "onnx_output_index": 0, - "onnx_output_name": "634", - "resolved_tflite_tensor_name": "Conv_98_input_nhwc", - "exists_in_final_model": true, - "is_graph_output": false, - "consumer_count": 1, - "producer_operator_index": 119, - "producer_op_type": "PRELU", - "assume_channel_last_layout": true, - "status": "rewritten", - "is_rewritten": true, - "rewrite_events": [ - { - "event_index": 42, - "kind": "rename_tensor", - "from": "634", - "to": "Conv_98_input_nhwc" - } - ], - "rewrite_name_chain": [ - "634", - "Conv_98_input_nhwc" - ] - }, - { - "identifier": 99, - "onnx_op_type": "Conv", - "onnx_op_name": "Conv_98", - "onnx_output_index": 0, - "onnx_output_name": "807", - "resolved_tflite_tensor_name": "Conv_98_output_nhwc", - "exists_in_final_model": true, - "is_graph_output": false, - "consumer_count": 1, - "producer_operator_index": 120, - "producer_op_type": "CONV_2D", - "assume_channel_last_layout": true, - "status": "rewritten", - "is_rewritten": true, - "rewrite_events": [ - { - "event_index": 142, - "kind": "replace_input", - "from": "807", - "to": "Conv_98_output_nhwc" - } - ], - "rewrite_name_chain": [ - "807", - "Conv_98_output_nhwc" - ] - }, - { - "identifier": 100, - "onnx_op_type": "Add", - "onnx_op_name": "Add_99", - "onnx_output_index": 0, - "onnx_output_name": "637", - "resolved_tflite_tensor_name": "637_nhwc_bridge", - "exists_in_final_model": true, - "is_graph_output": false, - "consumer_count": 2, - "producer_operator_index": 121, - "producer_op_type": "ADD", - "assume_channel_last_layout": true, - "status": "rewritten", - "is_rewritten": true, - "rewrite_events": [ - { - "event_index": 138, - "kind": "replace_input", - "from": "637", - "to": "637_nhwc_bridge" - }, - { - "event_index": 146, - "kind": "rename_tensor", - "from": "637_nhwc_bridge", - "to": "637" - }, - { - "event_index": 265, - "kind": "replace_input", - "from": "637", - "to": "637_nhwc_bridge" - } - ], - "rewrite_name_chain": [ - "637", - "637_nhwc_bridge", - "637", - "637_nhwc_bridge" - ] - }, - { - "identifier": 101, - "onnx_op_type": "BatchNormalization", - "onnx_op_name": "BatchNormalization_100", - "onnx_output_index": 0, - "onnx_output_name": "638", - "resolved_tflite_tensor_name": "Conv_101_input_nhwc", - "exists_in_final_model": true, - "is_graph_output": false, - "consumer_count": 1, - "producer_operator_index": 123, - "producer_op_type": "ADD", - "assume_channel_last_layout": true, - "status": "rewritten", - "is_rewritten": true, - "rewrite_events": [ - { - "event_index": 129, - "kind": "rename_tensor", - "from": "638", - "to": "Conv_101_input_nhwc" - } - ], - "rewrite_name_chain": [ - "638", - "Conv_101_input_nhwc" - ] - }, - { - "identifier": 102, - "onnx_op_type": "Conv", - "onnx_op_name": "Conv_101", - "onnx_output_index": 0, - "onnx_output_name": "810", - "resolved_tflite_tensor_name": "Conv_101_output_nhwc", - "exists_in_final_model": true, - "is_graph_output": false, - "consumer_count": 1, - "producer_operator_index": 124, - "producer_op_type": "CONV_2D", - "assume_channel_last_layout": true, - "status": "rewritten", - "is_rewritten": true, - "rewrite_events": [ - { - "event_index": 43, - "kind": "replace_input", - "from": "810", - "to": "Conv_101_output_nhwc" - } - ], - "rewrite_name_chain": [ - "810", - "Conv_101_output_nhwc" - ] - }, - { - "identifier": 103, - "onnx_op_type": "PRelu", - "onnx_op_name": "PRelu_102", - "onnx_output_index": 0, - "onnx_output_name": "642", - "resolved_tflite_tensor_name": "Conv_103_input_nhwc", - "exists_in_final_model": true, - "is_graph_output": false, - "consumer_count": 1, - "producer_operator_index": 125, - "producer_op_type": "PRELU", - "assume_channel_last_layout": true, - "status": "rewritten", - "is_rewritten": true, - "rewrite_events": [ - { - "event_index": 44, - "kind": "rename_tensor", - "from": "642", - "to": "Conv_103_input_nhwc" - } - ], - "rewrite_name_chain": [ - "642", - "Conv_103_input_nhwc" - ] - }, - { - "identifier": 104, - "onnx_op_type": "Conv", - "onnx_op_name": "Conv_103", - "onnx_output_index": 0, - "onnx_output_name": "813", - "resolved_tflite_tensor_name": "Conv_103_output_nhwc", - "exists_in_final_model": true, - "is_graph_output": false, - "consumer_count": 1, - "producer_operator_index": 126, - "producer_op_type": "CONV_2D", - "assume_channel_last_layout": true, - "status": "rewritten", - "is_rewritten": true, - "rewrite_events": [ - { - "event_index": 137, - "kind": "replace_input", - "from": "813", - "to": "Conv_103_output_nhwc" - } - ], - "rewrite_name_chain": [ - "813", - "Conv_103_output_nhwc" - ] - }, - { - "identifier": 105, - "onnx_op_type": "Add", - "onnx_op_name": "Add_104", - "onnx_output_index": 0, - "onnx_output_name": "645", - "resolved_tflite_tensor_name": "645_nhwc_bridge", - "exists_in_final_model": true, - "is_graph_output": false, - "consumer_count": 2, - "producer_operator_index": 127, - "producer_op_type": "ADD", - "assume_channel_last_layout": true, - "status": "rewritten", - "is_rewritten": true, - "rewrite_events": [ - { - "event_index": 133, - "kind": "replace_input", - "from": "645", - "to": "645_nhwc_bridge" - }, - { - "event_index": 141, - "kind": "rename_tensor", - "from": "645_nhwc_bridge", - "to": "645" - }, - { - "event_index": 268, - "kind": "replace_input", - "from": "645", - "to": "645_nhwc_bridge" - } - ], - "rewrite_name_chain": [ - "645", - "645_nhwc_bridge", - "645", - "645_nhwc_bridge" - ] - }, - { - "identifier": 106, - "onnx_op_type": "BatchNormalization", - "onnx_op_name": "BatchNormalization_105", - "onnx_output_index": 0, - "onnx_output_name": "646", - "resolved_tflite_tensor_name": "Conv_106_input_nhwc", - "exists_in_final_model": true, - "is_graph_output": false, - "consumer_count": 1, - "producer_operator_index": 129, - "producer_op_type": "ADD", - "assume_channel_last_layout": true, - "status": "rewritten", - "is_rewritten": true, - "rewrite_events": [ - { - "event_index": 131, - "kind": "rename_tensor", - "from": "646", - "to": "Conv_106_input_nhwc" - } - ], - "rewrite_name_chain": [ - "646", - "Conv_106_input_nhwc" - ] - }, - { - "identifier": 107, - "onnx_op_type": "Conv", - "onnx_op_name": "Conv_106", - "onnx_output_index": 0, - "onnx_output_name": "816", - "resolved_tflite_tensor_name": "Conv_106_output_nhwc", - "exists_in_final_model": true, - "is_graph_output": false, - "consumer_count": 1, - "producer_operator_index": 130, - "producer_op_type": "CONV_2D", - "assume_channel_last_layout": true, - "status": "rewritten", - "is_rewritten": true, - "rewrite_events": [ - { - "event_index": 45, - "kind": "replace_input", - "from": "816", - "to": "Conv_106_output_nhwc" - } - ], - "rewrite_name_chain": [ - "816", - "Conv_106_output_nhwc" - ] - }, - { - "identifier": 108, - "onnx_op_type": "PRelu", - "onnx_op_name": "PRelu_107", - "onnx_output_index": 0, - "onnx_output_name": "650", - "resolved_tflite_tensor_name": "Conv_108_input_nhwc", - "exists_in_final_model": true, - "is_graph_output": false, - "consumer_count": 1, - "producer_operator_index": 131, - "producer_op_type": "PRELU", - "assume_channel_last_layout": true, - "status": "rewritten", - "is_rewritten": true, - "rewrite_events": [ - { - "event_index": 46, - "kind": "rename_tensor", - "from": "650", - "to": "Conv_108_input_nhwc" - } - ], - "rewrite_name_chain": [ - "650", - "Conv_108_input_nhwc" - ] - }, - { - "identifier": 109, - "onnx_op_type": "Conv", - "onnx_op_name": "Conv_108", - "onnx_output_index": 0, - "onnx_output_name": "819", - "resolved_tflite_tensor_name": "Conv_108_output_nhwc", - "exists_in_final_model": true, - "is_graph_output": false, - "consumer_count": 1, - "producer_operator_index": 132, - "producer_op_type": "CONV_2D", - "assume_channel_last_layout": true, - "status": "rewritten", - "is_rewritten": true, - "rewrite_events": [ - { - "event_index": 132, - "kind": "replace_input", - "from": "819", - "to": "Conv_108_output_nhwc" - } - ], - "rewrite_name_chain": [ - "819", - "Conv_108_output_nhwc" - ] - }, - { - "identifier": 110, - "onnx_op_type": "Add", - "onnx_op_name": "Add_109", - "onnx_output_index": 0, - "onnx_output_name": "653", - "resolved_tflite_tensor_name": "Conv_114_input_nhwc", - "exists_in_final_model": true, - "is_graph_output": false, - "consumer_count": 2, - "producer_operator_index": 133, - "producer_op_type": "ADD", - "assume_channel_last_layout": true, - "status": "rewritten", - "is_rewritten": true, - "rewrite_events": [ - { - "event_index": 134, - "kind": "rename_tensor", - "from": "653", - "to": "Conv_114_input_nhwc" - }, - { - "event_index": 136, - "kind": "rename_tensor", - "from": "Conv_114_input_nhwc", - "to": "653" - }, - { - "event_index": 202, - "kind": "replace_input", - "from": "653", - "to": "Conv_114_input_nhwc" - } - ], - "rewrite_name_chain": [ - "653", - "Conv_114_input_nhwc", - "653", - "Conv_114_input_nhwc" - ] - }, - { - "identifier": 111, - "onnx_op_type": "BatchNormalization", - "onnx_op_name": "BatchNormalization_110", - "onnx_output_index": 0, - "onnx_output_name": "654", - "resolved_tflite_tensor_name": "Conv_111_input_nhwc", - "exists_in_final_model": true, - "is_graph_output": false, - "consumer_count": 1, - "producer_operator_index": 135, - "producer_op_type": "ADD", - "assume_channel_last_layout": true, - "status": "rewritten", - "is_rewritten": true, - "rewrite_events": [ - { - "event_index": 203, - "kind": "rename_tensor", - "from": "654", - "to": "Conv_111_input_nhwc" - } - ], - "rewrite_name_chain": [ - "654", - "Conv_111_input_nhwc" - ] - }, - { - "identifier": 112, - "onnx_op_type": "Conv", - "onnx_op_name": "Conv_114", - "onnx_output_index": 0, - "onnx_output_name": "828", - "resolved_tflite_tensor_name": "Conv_114_output_nhwc", - "exists_in_final_model": true, - "is_graph_output": false, - "consumer_count": 1, - "producer_operator_index": 136, - "producer_op_type": "CONV_2D", - "assume_channel_last_layout": true, - "status": "rewritten", - "is_rewritten": true, - "rewrite_events": [ - { - "event_index": 211, - "kind": "replace_input", - "from": "828", - "to": "Conv_114_output_nhwc" - } - ], - "rewrite_name_chain": [ - "828", - "Conv_114_output_nhwc" - ] - }, - { - "identifier": 113, - "onnx_op_type": "Conv", - "onnx_op_name": "Conv_111", - "onnx_output_index": 0, - "onnx_output_name": "822", - "resolved_tflite_tensor_name": "Conv_111_output_nhwc", - "exists_in_final_model": true, - "is_graph_output": false, - "consumer_count": 1, - "producer_operator_index": 137, - "producer_op_type": "CONV_2D", - "assume_channel_last_layout": true, - "status": "rewritten", - "is_rewritten": true, - "rewrite_events": [ - { - "event_index": 47, - "kind": "replace_input", - "from": "822", - "to": "Conv_111_output_nhwc" - } - ], - "rewrite_name_chain": [ - "822", - "Conv_111_output_nhwc" - ] - }, - { - "identifier": 114, - "onnx_op_type": "PRelu", - "onnx_op_name": "PRelu_112", - "onnx_output_index": 0, - "onnx_output_name": "658", - "resolved_tflite_tensor_name": "Conv_113_input_nhwc", - "exists_in_final_model": true, - "is_graph_output": false, - "consumer_count": 1, - "producer_operator_index": 138, - "producer_op_type": "PRELU", - "assume_channel_last_layout": true, - "status": "rewritten", - "is_rewritten": true, - "rewrite_events": [ - { - "event_index": 48, - "kind": "rename_tensor", - "from": "658", - "to": "Conv_113_input_nhwc" - } - ], - "rewrite_name_chain": [ - "658", - "Conv_113_input_nhwc" - ] - }, - { - "identifier": 115, - "onnx_op_type": "Conv", - "onnx_op_name": "Conv_113", - "onnx_output_index": 0, - "onnx_output_name": "825", - "resolved_tflite_tensor_name": "Conv_113_output_nhwc", - "exists_in_final_model": true, - "is_graph_output": false, - "consumer_count": 1, - "producer_operator_index": 140, - "producer_op_type": "CONV_2D", - "assume_channel_last_layout": true, - "status": "rewritten", - "is_rewritten": true, - "rewrite_events": [ - { - "event_index": 210, - "kind": "replace_input", - "from": "825", - "to": "Conv_113_output_nhwc" - } - ], - "rewrite_name_chain": [ - "825", - "Conv_113_output_nhwc" - ] - }, - { - "identifier": 116, - "onnx_op_type": "Add", - "onnx_op_name": "Add_115", - "onnx_output_index": 0, - "onnx_output_name": "663", - "resolved_tflite_tensor_name": "663__raw", - "exists_in_final_model": true, - "is_graph_output": false, - "consumer_count": 2, - "producer_operator_index": 141, - "producer_op_type": "ADD", - "assume_channel_last_layout": false, - "status": "rewritten", - "is_rewritten": true, - "rewrite_events": [ - { - "event_index": 212, - "kind": "rename_tensor", - "from": "663", - "to": "663__raw" - } - ], - "rewrite_name_chain": [ - "663", - "663__raw" - ] - }, - { - "identifier": 117, - "onnx_op_type": "BatchNormalization", - "onnx_op_name": "BatchNormalization_116", - "onnx_output_index": 0, - "onnx_output_name": "664", - "resolved_tflite_tensor_name": "Conv_117_input_nhwc", - "exists_in_final_model": true, - "is_graph_output": false, - "consumer_count": 1, - "producer_operator_index": 143, - "producer_op_type": "ADD", - "assume_channel_last_layout": true, - "status": "rewritten", - "is_rewritten": true, - "rewrite_events": [ - { - "event_index": 205, - "kind": "rename_tensor", - "from": "664", - "to": "Conv_117_input_nhwc" - } - ], - "rewrite_name_chain": [ - "664", - "Conv_117_input_nhwc" - ] - }, - { - "identifier": 118, - "onnx_op_type": "Conv", - "onnx_op_name": "Conv_117", - "onnx_output_index": 0, - "onnx_output_name": "831", - "resolved_tflite_tensor_name": "Conv_117_output_nhwc", - "exists_in_final_model": true, - "is_graph_output": false, - "consumer_count": 1, - "producer_operator_index": 144, - "producer_op_type": "CONV_2D", - "assume_channel_last_layout": true, - "status": "rewritten", - "is_rewritten": true, - "rewrite_events": [ - { - "event_index": 49, - "kind": "replace_input", - "from": "831", - "to": "Conv_117_output_nhwc" - } - ], - "rewrite_name_chain": [ - "831", - "Conv_117_output_nhwc" - ] - }, - { - "identifier": 119, - "onnx_op_type": "PRelu", - "onnx_op_name": "PRelu_118", - "onnx_output_index": 0, - "onnx_output_name": "668", - "resolved_tflite_tensor_name": "Conv_119_input_nhwc", - "exists_in_final_model": true, - "is_graph_output": false, - "consumer_count": 1, - "producer_operator_index": 145, - "producer_op_type": "PRELU", - "assume_channel_last_layout": true, - "status": "rewritten", - "is_rewritten": true, - "rewrite_events": [ - { - "event_index": 50, - "kind": "rename_tensor", - "from": "668", - "to": "Conv_119_input_nhwc" - } - ], - "rewrite_name_chain": [ - "668", - "Conv_119_input_nhwc" - ] - }, - { - "identifier": 120, - "onnx_op_type": "Conv", - "onnx_op_name": "Conv_119", - "onnx_output_index": 0, - "onnx_output_name": "834", - "resolved_tflite_tensor_name": "Conv_119_output_nhwc", - "exists_in_final_model": true, - "is_graph_output": false, - "consumer_count": 1, - "producer_operator_index": 146, - "producer_op_type": "CONV_2D", - "assume_channel_last_layout": true, - "status": "rewritten", - "is_rewritten": true, - "rewrite_events": [ - { - "event_index": 287, - "kind": "replace_input", - "from": "834", - "to": "Conv_119_output_nhwc" - } - ], - "rewrite_name_chain": [ - "834", - "Conv_119_output_nhwc" - ] - }, - { - "identifier": 121, - "onnx_op_type": "Add", - "onnx_op_name": "Add_120", - "onnx_output_index": 0, - "onnx_output_name": "671", - "resolved_tflite_tensor_name": "671", - "exists_in_final_model": true, - "is_graph_output": false, - "consumer_count": 2, - "producer_operator_index": 147, - "producer_op_type": "ADD", - "assume_channel_last_layout": false, - "status": "direct", - "is_rewritten": false, - "rewrite_events": [], - "rewrite_name_chain": [ - "671" - ] - }, - { - "identifier": 122, - "onnx_op_type": "BatchNormalization", - "onnx_op_name": "BatchNormalization_121", - "onnx_output_index": 0, - "onnx_output_name": "672", - "resolved_tflite_tensor_name": "Conv_122_input_nhwc", - "exists_in_final_model": true, - "is_graph_output": false, - "consumer_count": 1, - "producer_operator_index": 149, - "producer_op_type": "ADD", - "assume_channel_last_layout": true, - "status": "rewritten", - "is_rewritten": true, - "rewrite_events": [ - { - "event_index": 207, - "kind": "rename_tensor", - "from": "672", - "to": "Conv_122_input_nhwc" - } - ], - "rewrite_name_chain": [ - "672", - "Conv_122_input_nhwc" - ] - }, - { - "identifier": 123, - "onnx_op_type": "Conv", - "onnx_op_name": "Conv_122", - "onnx_output_index": 0, - "onnx_output_name": "837", - "resolved_tflite_tensor_name": "Conv_122_output_nhwc", - "exists_in_final_model": true, - "is_graph_output": false, - "consumer_count": 1, - "producer_operator_index": 150, - "producer_op_type": "CONV_2D", - "assume_channel_last_layout": true, - "status": "rewritten", - "is_rewritten": true, - "rewrite_events": [ - { - "event_index": 51, - "kind": "replace_input", - "from": "837", - "to": "Conv_122_output_nhwc" - } - ], - "rewrite_name_chain": [ - "837", - "Conv_122_output_nhwc" - ] - }, - { - "identifier": 124, - "onnx_op_type": "PRelu", - "onnx_op_name": "PRelu_123", - "onnx_output_index": 0, - "onnx_output_name": "676", - "resolved_tflite_tensor_name": "Conv_124_input_nhwc", - "exists_in_final_model": true, - "is_graph_output": false, - "consumer_count": 1, - "producer_operator_index": 151, - "producer_op_type": "PRELU", - "assume_channel_last_layout": true, - "status": "rewritten", - "is_rewritten": true, - "rewrite_events": [ - { - "event_index": 52, - "kind": "rename_tensor", - "from": "676", - "to": "Conv_124_input_nhwc" - } - ], - "rewrite_name_chain": [ - "676", - "Conv_124_input_nhwc" - ] - }, - { - "identifier": 125, - "onnx_op_type": "Conv", - "onnx_op_name": "Conv_124", - "onnx_output_index": 0, - "onnx_output_name": "840", - "resolved_tflite_tensor_name": "Conv_124_output_nhwc", - "exists_in_final_model": true, - "is_graph_output": false, - "consumer_count": 1, - "producer_operator_index": 152, - "producer_op_type": "CONV_2D", - "assume_channel_last_layout": true, - "status": "rewritten", - "is_rewritten": true, - "rewrite_events": [ - { - "event_index": 289, - "kind": "replace_input", - "from": "840", - "to": "840__to_nhwc" - }, - { - "event_index": 298, - "kind": "replace_input", - "from": "840__to_nhwc", - "to": "Conv_124_output_nhwc" - } - ], - "rewrite_name_chain": [ - "840", - "840__to_nhwc", - "Conv_124_output_nhwc" - ] - }, - { - "identifier": 126, - "onnx_op_type": "Add", - "onnx_op_name": "Add_125", - "onnx_output_index": 0, - "onnx_output_name": "679", - "resolved_tflite_tensor_name": "679", - "exists_in_final_model": true, - "is_graph_output": false, - "consumer_count": 1, - "producer_operator_index": 153, - "producer_op_type": "ADD", - "assume_channel_last_layout": false, - "status": "direct", - "is_rewritten": false, - "rewrite_events": [], - "rewrite_name_chain": [ - "679" - ] - }, - { - "identifier": 127, - "onnx_op_type": "BatchNormalization", - "onnx_op_name": "BatchNormalization_126", - "onnx_output_index": 0, - "onnx_output_name": "680", - "resolved_tflite_tensor_name": "680", - "exists_in_final_model": true, - "is_graph_output": false, - "consumer_count": 1, - "producer_operator_index": 156, - "producer_op_type": "TRANSPOSE", - "assume_channel_last_layout": false, - "status": "direct", - "is_rewritten": false, - "rewrite_events": [ - { - "event_index": 293, - "kind": "rename_tensor", - "from": "680", - "to": "680__to_nhwc" - }, - { - "event_index": 295, - "kind": "replace_input", - "from": "680__to_nhwc", - "to": "680" - } - ], - "rewrite_name_chain": [ - "680", - "680__to_nhwc", - "680" - ] - }, - { - "identifier": 128, - "onnx_op_type": "Flatten", - "onnx_op_name": "Flatten_127", - "onnx_output_index": 0, - "onnx_output_name": "681", - "resolved_tflite_tensor_name": "681", - "exists_in_final_model": true, - "is_graph_output": false, - "consumer_count": 1, - "producer_operator_index": 157, - "producer_op_type": "RESHAPE", - "assume_channel_last_layout": false, - "status": "direct", - "is_rewritten": false, - "rewrite_events": [], - "rewrite_name_chain": [ - "681" - ] - }, - { - "identifier": 129, - "onnx_op_type": "Gemm", - "onnx_op_name": "Gemm_128", - "onnx_output_index": 0, - "onnx_output_name": "682", - "resolved_tflite_tensor_name": "682", - "exists_in_final_model": true, - "is_graph_output": false, - "consumer_count": 1, - "producer_operator_index": 158, - "producer_op_type": "FULLY_CONNECTED", - "assume_channel_last_layout": false, - "status": "direct", - "is_rewritten": false, - "rewrite_events": [], - "rewrite_name_chain": [ - "682" - ] - }, - { - "identifier": 130, - "onnx_op_type": "BatchNormalization", - "onnx_op_name": "BatchNormalization_129", - "onnx_output_index": 0, - "onnx_output_name": "683", - "resolved_tflite_tensor_name": "683", - "exists_in_final_model": true, - "is_graph_output": true, - "consumer_count": 0, - "producer_operator_index": 160, - "producer_op_type": "ADD", - "assume_channel_last_layout": false, - "status": "direct", - "is_rewritten": false, - "rewrite_events": [], - "rewrite_name_chain": [ - "683" - ] - } - ] -} \ No newline at end of file diff --git a/app/src/main/java/com/example/studentfaceregistry/MainActivity.kt b/app/src/main/java/com/example/studentfaceregistry/MainActivity.kt index 1abb770..db7d082 100644 --- a/app/src/main/java/com/example/studentfaceregistry/MainActivity.kt +++ b/app/src/main/java/com/example/studentfaceregistry/MainActivity.kt @@ -4,6 +4,9 @@ import android.Manifest import android.content.pm.PackageManager import android.graphics.Typeface import android.os.Bundle +import android.os.SystemClock +import android.util.Size +import android.util.Log import android.view.Gravity import android.view.View import android.widget.Button @@ -21,12 +24,12 @@ import androidx.camera.lifecycle.ProcessCameraProvider import androidx.camera.view.PreviewView import androidx.core.content.ContextCompat import androidx.lifecycle.lifecycleScope -import com.example.studentfaceregistry.data.StudentRepository import com.example.studentfaceregistry.data.Student -import com.example.studentfaceregistry.face.FaceEmbedder +import com.example.studentfaceregistry.data.StudentRepository import com.example.studentfaceregistry.face.FaceMatcher import com.example.studentfaceregistry.face.FaceProcessor import com.example.studentfaceregistry.face.MatchType +import com.google.mlkit.vision.common.InputImage import com.example.studentfaceregistry.ui.DetectionUi import com.example.studentfaceregistry.ui.OverlayView import com.example.studentfaceregistry.upload.UploadServer @@ -37,38 +40,47 @@ import kotlinx.coroutines.withContext import java.util.concurrent.Executors class MainActivity : AppCompatActivity() { + private lateinit var countText: TextView private lateinit var previewView: PreviewView private lateinit var overlayView: OverlayView - private lateinit var statusText: TextView - private lateinit var countText: TextView + private lateinit var recognitionStatusText: TextView + private lateinit var uploadStatusText: TextView + private lateinit var uploadUrlText: TextView + private lateinit var pauseRecognitionButton: Button + private lateinit var homePanel: View + private lateinit var recognitionPanel: View + private lateinit var uploadPanel: View + + private var currentMode = AppMode.HOME private var processor: FaceProcessor? = null private var uploadServer: UploadServer? = null + private var analysisUseCase: ImageAnalysis? = null + private var cameraProvider: ProcessCameraProvider? = null private val repository by lazy { StudentRepository(this) } - // ArcFace 推荐阈值 private val matcher = FaceMatcher(euclideanThreshold = 1.0f, cosineThreshold = 0.6f) private val cameraExecutor = Executors.newSingleThreadExecutor() private var students: List = emptyList() private var recognitionEnabled = true private var analyzing = false + private var lastAnalysisAt = 0L private val permissionLauncher = registerForActivityResult( ActivityResultContracts.RequestMultiplePermissions() ) { grants -> - if (grants[Manifest.permission.CAMERA] == true) startCamera() - else toast("需要相机权限才能识别学生身份。") + if (grants[Manifest.permission.CAMERA] == true) { + if (currentMode == AppMode.RECOGNITION) { + startRecognitionSession() + } + } else if (currentMode == AppMode.RECOGNITION) { + recognitionStatusText.text = "需要相机权限才能识别学生身份。" + toast("需要相机权限才能识别学生身份。") + } } override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) setContentView(createContentView()) - processor = runCatching { FaceProcessor(this) } - .onFailure { - statusText.text = "缺少模型文件:app/src/main/assets/facenet.tflite" - toast("请先放入 facenet.tflite 模型。") - } - .getOrNull() - uploadServer = UploadServer(this, repository) { processor }.also { it.start() } lifecycleScope.launch { repository.students.collectLatest { list -> @@ -77,14 +89,13 @@ class MainActivity : AppCompatActivity() { } } - statusText.text = "电脑浏览器打开上传地址来批量导入头像" - if (hasCameraPermission()) startCamera() else permissionLauncher.launch(arrayOf(Manifest.permission.CAMERA)) + switchMode(AppMode.HOME) } override fun onDestroy() { super.onDestroy() - processor?.close() - uploadServer?.close() + stopRecognitionSession() + stopUploadSession() cameraExecutor.shutdown() } @@ -108,80 +119,299 @@ class MainActivity : AppCompatActivity() { textSize = 15f setTextColor(0xFF475569.toInt()) } - statusText = TextView(this).apply { - text = "点击上传地址,用电脑浏览器批量上传头像" - textSize = 22f - typeface = Typeface.DEFAULT_BOLD - setTextColor(0xFF0F172A.toInt()) - setPadding(0, 12, 0, 0) - } header.addView(countText) - header.addView(statusText) - val cameraFrame = FrameLayout(this).apply { - layoutParams = LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, 0, 1f) + val content = FrameLayout(this).apply { + layoutParams = LinearLayout.LayoutParams( + LinearLayout.LayoutParams.MATCH_PARENT, + 0, + 1f + ) } - previewView = PreviewView(this).apply { - scaleType = PreviewView.ScaleType.FILL_CENTER - } - overlayView = OverlayView(this) - cameraFrame.addView(previewView, FrameLayout.LayoutParams(-1, -1)) - cameraFrame.addView(overlayView, FrameLayout.LayoutParams(-1, -1)) - val controls = LinearLayout(this).apply { - gravity = Gravity.CENTER - orientation = LinearLayout.HORIZONTAL - setPadding(20, 20, 20, 28) - } - controls.addView(Button(this).apply { - text = "上传地址" - setOnClickListener { - statusText.text = uploadServer?.accessUrl() ?: "上传服务未启动" - } - }) - controls.addView(Button(this).apply { - text = "暂停识别" - setOnClickListener { - recognitionEnabled = !recognitionEnabled - text = if (recognitionEnabled) "暂停识别" else "开始识别" - statusText.text = if (recognitionEnabled) "正在识别" else "识别已暂停" - } - }) + homePanel = createHomePanel() + recognitionPanel = createRecognitionPanel() + uploadPanel = createUploadPanel() + homePanel.visibility = View.VISIBLE + recognitionPanel.visibility = View.GONE + uploadPanel.visibility = View.GONE + + content.addView(homePanel, FrameLayout.LayoutParams(-1, -1)) + content.addView(recognitionPanel, FrameLayout.LayoutParams(-1, -1)) + content.addView(uploadPanel, FrameLayout.LayoutParams(-1, -1)) + root.addView(header) - root.addView(cameraFrame) - root.addView(controls) + root.addView(content) return root } - private fun startCamera() { + private fun createHomePanel(): View { + return LinearLayout(this).apply { + orientation = LinearLayout.VERTICAL + gravity = Gravity.CENTER + setPadding(40, 40, 40, 40) + + addView(TextView(this@MainActivity).apply { + text = "请选择要进入的功能" + textSize = 26f + typeface = Typeface.DEFAULT_BOLD + setTextColor(0xFF0F172A.toInt()) + gravity = Gravity.CENTER + }) + + addView(TextView(this@MainActivity).apply { + text = "识别和注册上传分开运行,减少同时占用相机、模型和本地服务带来的卡顿。" + textSize = 16f + setTextColor(0xFF475569.toInt()) + gravity = Gravity.CENTER + setPadding(0, 20, 0, 36) + }) + + addView(Button(this@MainActivity).apply { + text = "进入识别" + textSize = 20f + setPadding(36, 24, 36, 24) + setOnClickListener { switchMode(AppMode.RECOGNITION) } + }) + + addView(Button(this@MainActivity).apply { + text = "进入注册上传" + textSize = 20f + setPadding(36, 24, 36, 24) + setOnClickListener { switchMode(AppMode.UPLOAD) } + }) + } + } + + private fun createRecognitionPanel(): View { + return LinearLayout(this).apply { + orientation = LinearLayout.VERTICAL + setPadding(24, 16, 24, 24) + + recognitionStatusText = TextView(this@MainActivity).apply { + text = "准备进入识别模式" + textSize = 22f + typeface = Typeface.DEFAULT_BOLD + setTextColor(0xFF0F172A.toInt()) + setPadding(8, 8, 8, 20) + } + addView(recognitionStatusText) + + val cameraFrame = FrameLayout(this@MainActivity).apply { + layoutParams = LinearLayout.LayoutParams( + LinearLayout.LayoutParams.MATCH_PARENT, + 0, + 1f + ) + } + previewView = PreviewView(this@MainActivity).apply { + scaleType = PreviewView.ScaleType.FILL_CENTER + } + overlayView = OverlayView(this@MainActivity) + cameraFrame.addView(previewView, FrameLayout.LayoutParams(-1, -1)) + cameraFrame.addView(overlayView, FrameLayout.LayoutParams(-1, -1)) + addView(cameraFrame) + + addView(LinearLayout(this@MainActivity).apply { + gravity = Gravity.CENTER + orientation = LinearLayout.HORIZONTAL + setPadding(12, 20, 12, 8) + + addView(Button(this@MainActivity).apply { + text = "返回首页" + setOnClickListener { switchMode(AppMode.HOME) } + }) + + pauseRecognitionButton = Button(this@MainActivity).apply { + text = "暂停识别" + setOnClickListener { + recognitionEnabled = !recognitionEnabled + text = if (recognitionEnabled) "暂停识别" else "继续识别" + recognitionStatusText.text = if (recognitionEnabled) "正在识别" else "识别已暂停" + if (!recognitionEnabled) { + overlayView.update(emptyList(), 1, 1) + } + updateAnalyzerState() + } + } + addView(pauseRecognitionButton) + }) + } + } + + private fun createUploadPanel(): View { + return LinearLayout(this).apply { + orientation = LinearLayout.VERTICAL + gravity = Gravity.CENTER_HORIZONTAL + setPadding(40, 48, 40, 48) + + uploadStatusText = TextView(this@MainActivity).apply { + text = "准备进入注册上传模式" + textSize = 24f + typeface = Typeface.DEFAULT_BOLD + setTextColor(0xFF0F172A.toInt()) + gravity = Gravity.CENTER + } + addView(uploadStatusText) + + addView(TextView(this@MainActivity).apply { + text = "在同一 Wi-Fi 下,用电脑浏览器打开下面的地址,就可以上传学生图片或视频。" + textSize = 16f + setTextColor(0xFF475569.toInt()) + gravity = Gravity.CENTER + setPadding(0, 16, 0, 20) + }) + + uploadUrlText = TextView(this@MainActivity).apply { + text = "-" + textSize = 20f + typeface = Typeface.MONOSPACE + setTextColor(0xFF0F172A.toInt()) + gravity = Gravity.CENTER + setPadding(24, 20, 24, 20) + setTextIsSelectable(true) + setBackgroundColor(0xFFE2E8F0.toInt()) + } + addView(uploadUrlText) + + addView(LinearLayout(this@MainActivity).apply { + gravity = Gravity.CENTER + orientation = LinearLayout.HORIZONTAL + setPadding(12, 28, 12, 8) + + addView(Button(this@MainActivity).apply { + text = "刷新地址" + setOnClickListener { startUploadSession() } + }) + + addView(Button(this@MainActivity).apply { + text = "返回首页" + setOnClickListener { switchMode(AppMode.HOME) } + }) + }) + } + } + + private fun switchMode(mode: AppMode) { + if (currentMode == mode) return + + val previousMode = currentMode + currentMode = mode + homePanel.visibility = if (mode == AppMode.HOME) View.VISIBLE else View.GONE + recognitionPanel.visibility = if (mode == AppMode.RECOGNITION) View.VISIBLE else View.GONE + uploadPanel.visibility = if (mode == AppMode.UPLOAD) View.VISIBLE else View.GONE + + when (previousMode) { + AppMode.RECOGNITION -> stopRecognitionSession() + AppMode.UPLOAD -> stopUploadSession() + AppMode.HOME -> Unit + } + + when (mode) { + AppMode.HOME -> Unit + AppMode.RECOGNITION -> enterRecognitionMode() + AppMode.UPLOAD -> enterUploadMode() + } + } + + private fun enterRecognitionMode() { + recognitionEnabled = true + analyzing = false + lastAnalysisAt = 0L + pauseRecognitionButton.text = "暂停识别" + recognitionStatusText.text = "正在准备识别服务..." + overlayView.update(emptyList(), 1, 1) + + if (hasCameraPermission()) { + startRecognitionSession() + } else { + permissionLauncher.launch(arrayOf(Manifest.permission.CAMERA)) + } + } + + private fun startRecognitionSession() { + if (currentMode != AppMode.RECOGNITION) return + + val faceProcessor = ensureProcessor() ?: return val providerFuture = ProcessCameraProvider.getInstance(this) providerFuture.addListener({ - val cameraProvider = providerFuture.get() + val provider = providerFuture.get() + cameraProvider = provider + if (currentMode != AppMode.RECOGNITION) { + provider.unbindAll() + return@addListener + } + val preview = Preview.Builder().build().also { it.setSurfaceProvider(previewView.surfaceProvider) } val analysis = ImageAnalysis.Builder() + .setTargetResolution(ANALYSIS_SIZE) .setBackpressureStrategy(ImageAnalysis.STRATEGY_KEEP_ONLY_LATEST) .build() - .also { it.setAnalyzer(cameraExecutor) { image -> analyze(image) } } - cameraProvider.unbindAll() - cameraProvider.bindToLifecycle(this, CameraSelector.DEFAULT_BACK_CAMERA, preview, analysis) + + provider.unbindAll() + provider.bindToLifecycle(this, CameraSelector.DEFAULT_BACK_CAMERA, preview, analysis) + analysisUseCase = analysis + recognitionStatusText.text = if (faceProcessor === processor) "正在识别" else "识别服务已启动" + updateAnalyzerState() }, ContextCompat.getMainExecutor(this)) } + private fun stopRecognitionSession() { + recognitionEnabled = false + analyzing = false + analysisUseCase?.clearAnalyzer() + analysisUseCase = null + cameraProvider?.unbindAll() + cameraProvider = null + overlayView.update(emptyList(), 1, 1) + processor?.close() + processor = null + } + + private fun updateAnalyzerState() { + val analysis = analysisUseCase ?: return + if (currentMode == AppMode.RECOGNITION && recognitionEnabled && processor != null) { + analysis.setAnalyzer(cameraExecutor) { image -> analyze(image) } + } else { + analysis.clearAnalyzer() + } + } + private fun analyze(image: ImageProxy) { val faceProcessor = processor - if (!recognitionEnabled || analyzing || faceProcessor == null) { + val now = SystemClock.elapsedRealtime() + if ( + currentMode != AppMode.RECOGNITION || + !recognitionEnabled || + analyzing || + faceProcessor == null || + now - lastAnalysisAt < ANALYSIS_INTERVAL_MS + ) { image.close() return } - analyzing = true - lifecycleScope.launch { - try { - val bitmap = withContext(Dispatchers.Default) { ImageUtils.imageProxyToBitmap(image) } - val faces = faceProcessor.detectFaces(bitmap) - // 同时识别所有人脸 + analyzing = true + lastAnalysisAt = now + lifecycleScope.launch(Dispatchers.Default) { + try { + val mediaImage = image.image ?: return@launch + val inputImage = InputImage.fromMediaImage(mediaImage, image.imageInfo.rotationDegrees) + val faces = faceProcessor.detectFaces(inputImage) + + if (faces.isEmpty()) { + withContext(Dispatchers.Main) { + if (currentMode == AppMode.RECOGNITION) { + overlayView.update(emptyList(), 1, 1) + updateRecognitionStatus(emptyList()) + } + } + return@launch + } + + val bitmap = ImageUtils.imageProxyToBitmap(image) val detections = faces.map { face -> val embedding = faceProcessor.embedFace(bitmap, face) val result = matcher.findNearest(embedding, students) @@ -192,12 +422,19 @@ class MainActivity : AppCompatActivity() { ) } - overlayView.update(detections, bitmap.width, bitmap.height) - - // 显示所有识别结果 - updateStatusText(detections) - } catch (_: Exception) { - statusText.text = "识别暂不可用,请确认模型文件和相机画面。" + withContext(Dispatchers.Main) { + if (currentMode == AppMode.RECOGNITION) { + overlayView.update(detections, bitmap.width, bitmap.height) + updateRecognitionStatus(detections) + } + } + } catch (e: Exception) { + Log.e("MainActivity", "Recognition failed", e) + withContext(Dispatchers.Main) { + if (currentMode == AppMode.RECOGNITION) { + recognitionStatusText.text = "识别失败:${e.message ?: e.javaClass.simpleName}" + } + } } finally { analyzing = false image.close() @@ -205,40 +442,80 @@ class MainActivity : AppCompatActivity() { } } - private fun updateStatusText(detections: List) { + private fun updateRecognitionStatus(detections: List) { if (detections.isEmpty()) { - statusText.text = "未检测到人脸" + recognitionStatusText.text = "未检测到人脸" return } - // 统计识别结果 val matched = detections.filter { it.result.isMatched } val unsure = detections.filter { it.result.matchType == MatchType.UNSURE } - val unmatched = detections.filter { !it.result.isMatched && it.result.matchType != MatchType.UNSURE } - val total = detections.size - val matchedCount = matched.size - if (matchedCount > 0) { - if (matchedCount == 1 && total == 1) { + if (matched.isNotEmpty()) { + if (matched.size == 1 && total == 1) { val student = matched[0].result.student!! val confidence = (matched[0].confidence!! * 100).toInt() - statusText.text = "识别到:${student.name}(${student.studentNo})置信度${confidence}%" + recognitionStatusText.text = "识别到:${student.name}(${student.studentNo})置信度${confidence}%" } else { val names = matched.joinToString(", ") { - val s = it.result.student!! - val c = (it.confidence!! * 100).toInt() - "${s.name}(${c}%)" + val student = it.result.student!! + val confidence = (it.confidence!! * 100).toInt() + "${student.name}(${confidence}%)" } - statusText.text = "识别到 $matchedCount/$total 人:$names" + recognitionStatusText.text = "识别到 ${matched.size}/$total 人:$names" } } else if (unsure.isNotEmpty()) { - statusText.text = "疑似检测到 ${unsure.size} 人(不确定)" + recognitionStatusText.text = "疑似检测到 ${unsure.size} 人(不确定)" } else { - statusText.text = "检测到 $total 张未入库人脸" + recognitionStatusText.text = "检测到 $total 张未入库人脸" } } + private fun enterUploadMode() { + uploadStatusText.text = "正在准备注册上传服务..." + startUploadSession() + } + + private fun startUploadSession() { + if (currentMode != AppMode.UPLOAD) return + + val server = uploadServer ?: UploadServer(this, repository).also { + uploadServer = it + } + runCatching { + server.start() + uploadStatusText.text = "请在电脑浏览器打开以下地址" + uploadUrlText.text = server.accessUrl() + }.onFailure { + val message = it.message ?: "unknown error" + uploadStatusText.text = "上传服务启动失败:$message" + uploadUrlText.text = "-" + } + } + + private fun stopUploadSession() { + uploadServer?.close() + uploadServer = null + uploadStatusText.text = "注册上传服务已停止" + uploadUrlText.text = "-" + } + + private fun ensureProcessor(): FaceProcessor? { + val current = processor + if (current != null) return current + + val created = runCatching { FaceProcessor(this) } + .onFailure { + val message = it.message ?: "unknown error" + recognitionStatusText.text = "模型初始化失败:$message" + toast("模型初始化失败:$message") + } + .getOrNull() + processor = created + return created + } + private fun hasCameraPermission(): Boolean { return ContextCompat.checkSelfPermission(this, Manifest.permission.CAMERA) == PackageManager.PERMISSION_GRANTED } @@ -246,4 +523,15 @@ class MainActivity : AppCompatActivity() { private fun toast(message: String) { Toast.makeText(this, message, Toast.LENGTH_SHORT).show() } + + companion object { + private const val ANALYSIS_INTERVAL_MS = 250L + private val ANALYSIS_SIZE = Size(640, 480) + } +} + +private enum class AppMode { + HOME, + RECOGNITION, + UPLOAD } diff --git a/app/src/main/java/com/example/studentfaceregistry/face/FaceEmbedder.kt b/app/src/main/java/com/example/studentfaceregistry/face/FaceEmbedder.kt index 6150858..643ede9 100644 --- a/app/src/main/java/com/example/studentfaceregistry/face/FaceEmbedder.kt +++ b/app/src/main/java/com/example/studentfaceregistry/face/FaceEmbedder.kt @@ -2,9 +2,9 @@ package com.example.studentfaceregistry.face import android.content.Context import android.graphics.Bitmap -import org.tensorflow.lite.Interpreter -import java.nio.ByteBuffer -import java.nio.ByteOrder +import com.google.ai.edge.litert.Accelerator +import com.google.ai.edge.litert.CompiledModel +import com.google.ai.edge.litert.TensorBuffer import kotlin.math.sqrt /** @@ -21,7 +21,9 @@ class FaceEmbedder(context: Context, private val modelType: ModelType = ModelTyp ARCFACE // 归一化:pixel / 255.0,然后 (x - mean) / std } - private val interpreter: Interpreter + private val model: CompiledModel + private val inputBuffer: TensorBuffer + private val outputBuffer: TensorBuffer private val inputSize: Int private val outputSize: Int @@ -30,31 +32,16 @@ class FaceEmbedder(context: Context, private val modelType: ModelType = ModelTyp private val std = floatArrayOf(127.5f, 127.5f, 127.5f) init { - val modelBytes = context.assets.open("facenet.tflite").use { input -> - input.readBytes() - } - - val options = Interpreter.Options().apply { - setNumThreads(4) - // 如果设备支持,可以启用 GPU delegate - // val gpuDelegate = GpuDelegate() - // addDelegate(gpuDelegate) - } - - interpreter = Interpreter( - ByteBuffer.allocateDirect(modelBytes.size).apply { - order(ByteOrder.nativeOrder()) - put(modelBytes) - rewind() - }, - options + model = CompiledModel.create( + context.assets, + MODEL_ASSET_NAME, + CompiledModel.Options(setOf(Accelerator.CPU)) ) - - val inputShape = interpreter.getInputTensor(0).shape() - inputSize = inputShape[1] // 通常是 112 或 160 - - val outputShape = interpreter.getOutputTensor(0).shape() - outputSize = outputShape.last() + inputBuffer = model.createInputBuffers().first() + outputBuffer = model.createOutputBuffers().first() + val inputElements = inputBuffer.readFloat().size + inputSize = inferInputSize(inputElements) + outputSize = outputBuffer.readFloat().size } /** @@ -67,13 +54,11 @@ class FaceEmbedder(context: Context, private val modelType: ModelType = ModelTyp val resized = Bitmap.createScaledBitmap(face, inputSize, inputSize, true) // 准备输入数据 - val input = ByteBuffer - .allocateDirect(inputSize * inputSize * 3 * Float.SIZE_BYTES) - .order(ByteOrder.nativeOrder()) - + val input = FloatArray(inputSize * inputSize * 3) val pixels = IntArray(inputSize * inputSize) resized.getPixels(pixels, 0, inputSize, 0, 0, inputSize, inputSize) + var index = 0 for (color in pixels) { val r = ((color shr 16) and 0xFF).toFloat() val g = ((color shr 8) and 0xFF).toFloat() @@ -82,32 +67,30 @@ class FaceEmbedder(context: Context, private val modelType: ModelType = ModelTyp when (modelType) { ModelType.FACENET -> { // FaceNet 归一化:(pixel - 127.5) / 127.5 - input.putFloat((r - 127.5f) / 127.5f) - input.putFloat((g - 127.5f) / 127.5f) - input.putFloat((b - 127.5f) / 127.5f) + input[index++] = (r - 127.5f) / 127.5f + input[index++] = (g - 127.5f) / 127.5f + input[index++] = (b - 127.5f) / 127.5f } ModelType.ARCFACE -> { // ArcFace 归一化:(pixel - mean) / std // 等价于 (pixel - 127.5) / 127.5,但语义更清晰 - input.putFloat((r - mean[0]) / std[0]) - input.putFloat((g - mean[1]) / std[1]) - input.putFloat((b - mean[2]) / std[2]) + input[index++] = (r - mean[0]) / std[0] + input[index++] = (g - mean[1]) / std[1] + input[index++] = (b - mean[2]) / std[2] } } } - input.rewind() - // 执行推理 - val output = Array(1) { FloatArray(outputSize) } - interpreter.run(input, output) + inputBuffer.writeFloat(input) + model.run(listOf(inputBuffer), listOf(outputBuffer)) // L2 归一化输出特征 - return l2Normalize(output[0]) + return l2Normalize(outputBuffer.readFloat()) } override fun close() { - interpreter.close() + model.close() } /** @@ -130,4 +113,17 @@ class FaceEmbedder(context: Context, private val modelType: ModelType = ModelTyp * 获取特征向量维度 */ fun getOutputSize(): Int = outputSize + + companion object { + const val MODEL_ASSET_NAME = "facenet.tflite" + } + + private fun inferInputSize(floatCount: Int): Int { + val pixelCount = floatCount / 3 + val size = kotlin.math.sqrt(pixelCount.toDouble()).toInt() + require(size > 0 && size * size * 3 == floatCount) { + "Unexpected face model input size: $floatCount floats" + } + return size + } } diff --git a/app/src/main/java/com/example/studentfaceregistry/face/FaceMatcher.kt b/app/src/main/java/com/example/studentfaceregistry/face/FaceMatcher.kt index d2324c7..3af9c9c 100644 --- a/app/src/main/java/com/example/studentfaceregistry/face/FaceMatcher.kt +++ b/app/src/main/java/com/example/studentfaceregistry/face/FaceMatcher.kt @@ -28,8 +28,8 @@ class FaceMatcher( var secondNearestEuclidean = Float.MAX_VALUE for (student in students) { - val euclideanDist = euclideanDistance(embedding, student.embedding) val cosineSim = cosineSimilarity(embedding, student.embedding) + val euclideanDist = euclideanDistanceFromCosine(cosineSim) if (euclideanDist < nearestEuclidean) { secondNearestEuclidean = nearestEuclidean @@ -60,10 +60,11 @@ class FaceMatcher( topK: Int = 3 ): List { val candidates = students.map { student -> + val cosineSim = cosineSimilarity(embedding, student.embedding) MatchCandidate( student = student, - euclideanDistance = euclideanDistance(embedding, student.embedding), - cosineSimilarity = cosineSimilarity(embedding, student.embedding) + euclideanDistance = euclideanDistanceFromCosine(cosineSim), + cosineSimilarity = cosineSim ) } @@ -83,6 +84,13 @@ class FaceMatcher( return sqrt(sum) } + /** + * 对已 L2 归一化向量,通过余弦相似度推导欧氏距离,避免重复遍历 + */ + private fun euclideanDistanceFromCosine(cosineSimilarity: Float): Float { + return sqrt((2f - 2f * cosineSimilarity).coerceAtLeast(0f)) + } + /** * 计算余弦相似度 * 对于已 L2 归一化的向量,余弦相似度等于点积 diff --git a/app/src/main/java/com/example/studentfaceregistry/face/FaceProcessor.kt b/app/src/main/java/com/example/studentfaceregistry/face/FaceProcessor.kt index 1a66cb7..d7f3cd6 100644 --- a/app/src/main/java/com/example/studentfaceregistry/face/FaceProcessor.kt +++ b/app/src/main/java/com/example/studentfaceregistry/face/FaceProcessor.kt @@ -102,8 +102,15 @@ class FaceProcessor(context: Context) : AutoCloseable { /** * 实时检测人脸(用于摄像头预览) */ + suspend fun detectFaces(image: InputImage): List { + return realtimeDetector.process(image).await() + } + + /** + * 实时检测人脸(bitmap 版本) + */ suspend fun detectFaces(bitmap: Bitmap): List { - return realtimeDetector.process(InputImage.fromBitmap(bitmap, 0)).await() + return detectFaces(InputImage.fromBitmap(bitmap, 0)) } /** diff --git a/app/src/main/java/com/example/studentfaceregistry/face/SmartEnrollment.kt b/app/src/main/java/com/example/studentfaceregistry/face/SmartEnrollment.kt index 151a231..3136af6 100644 --- a/app/src/main/java/com/example/studentfaceregistry/face/SmartEnrollment.kt +++ b/app/src/main/java/com/example/studentfaceregistry/face/SmartEnrollment.kt @@ -469,7 +469,31 @@ sealed class EnrollmentResult { val frameCount: Int = 1, val yawRange: Float = 0f, val pitchRange: Float = 0f - ) : EnrollmentResult() + ) : EnrollmentResult() { + override fun equals(other: Any?): Boolean { + if (this === other) return true + if (javaClass != other?.javaClass) return false + + other as Success + + if (frameCount != other.frameCount) return false + if (yawRange != other.yawRange) return false + if (pitchRange != other.pitchRange) return false + if (!embedding.contentEquals(other.embedding)) return false + if (sourceType != other.sourceType) return false + + return true + } + + override fun hashCode(): Int { + var result = frameCount + result = 31 * result + yawRange.hashCode() + result = 31 * result + pitchRange.hashCode() + result = 31 * result + embedding.contentHashCode() + result = 31 * result + sourceType.hashCode() + return result + } + } data class Failure(val reason: String) : EnrollmentResult() } diff --git a/app/src/main/java/com/example/studentfaceregistry/upload/UploadServer.kt b/app/src/main/java/com/example/studentfaceregistry/upload/UploadServer.kt index cc00500..5a7e0bc 100644 --- a/app/src/main/java/com/example/studentfaceregistry/upload/UploadServer.kt +++ b/app/src/main/java/com/example/studentfaceregistry/upload/UploadServer.kt @@ -4,7 +4,6 @@ import android.content.Context import android.util.Base64 import com.example.studentfaceregistry.data.Student import com.example.studentfaceregistry.data.StudentRepository -import com.example.studentfaceregistry.face.FaceProcessor import com.example.studentfaceregistry.face.SmartEnrollment import kotlinx.coroutines.runBlocking import org.json.JSONObject @@ -20,18 +19,17 @@ import kotlin.concurrent.thread class UploadServer( private val context: Context, - private val repository: StudentRepository, - private val processorProvider: () -> FaceProcessor? + private val repository: StudentRepository ) : AutoCloseable { private var serverSocket: ServerSocket? = null @Volatile private var running = false - private lateinit var smartEnrollment: SmartEnrollment + private var smartEnrollment: SmartEnrollment? = null fun start() { if (running) return + val socket = ServerSocket(8080) + serverSocket = socket running = true - smartEnrollment = SmartEnrollment(context) - serverSocket = ServerSocket(8080) thread(name = "upload-server", isDaemon = true) { while (running) { val socket = try { @@ -52,7 +50,9 @@ class UploadServer( override fun close() { running = false runCatching { serverSocket?.close() } - runCatching { smartEnrollment.close() } + serverSocket = null + runCatching { smartEnrollment?.close() } + smartEnrollment = null } private fun handle(socket: Socket) { @@ -71,8 +71,9 @@ class UploadServer( } private fun handleUpload(request: HttpRequest, output: OutputStream) { - if (processorProvider() == null) { - respondText(output, 503, "Missing facenet.tflite model", "text/plain; charset=utf-8") + val enrollment = getOrCreateEnrollment() + if (enrollment == null) { + respondText(output, 503, "Face model unavailable", "text/plain; charset=utf-8") return } val bodyText = String(request.body, StandardCharsets.UTF_8) @@ -85,7 +86,7 @@ class UploadServer( // 单文件或文件列表上传(支持图片和视频) val items = parseUploadItems(payload) items.forEachIndexed { index, item -> - processUploadItem(item.fileName.ifBlank { "student_$index" }, item.base64, item.mimeType) { ok, name, error -> + processUploadItem(item.fileName.ifBlank { "student_$index" }, item.base64, item.mimeType, enrollment) { ok, name, error -> if (ok) { accepted += 1 notices += "OK $name" @@ -190,19 +191,31 @@ class UploadServer( } } - private fun processUploadItem(fileName: String, base64: String, mimeType: String, report: (ok: Boolean, name: String, error: String?) -> Unit) { + private fun processUploadItem( + fileName: String, + base64: String, + mimeType: String, + enrollment: SmartEnrollment, + report: (ok: Boolean, name: String, error: String?) -> Unit + ) { runCatching { val data = Base64.decode(base64, Base64.DEFAULT) - processBytes(fileName, data, mimeType, report) + processBytes(fileName, data, mimeType, enrollment, report) }.onFailure { report(false, fileName, it.message) } } - private fun processBytes(fileName: String, data: ByteArray, mimeType: String, report: (ok: Boolean, name: String, error: String?) -> Unit) { + private fun processBytes( + fileName: String, + data: ByteArray, + mimeType: String, + enrollment: SmartEnrollment, + report: (ok: Boolean, name: String, error: String?) -> Unit + ) { runCatching { val result = runBlocking { - smartEnrollment.enroll(data, mimeType, fileName) + enrollment.enroll(data, mimeType, fileName) } when (result) { @@ -230,6 +243,16 @@ class UploadServer( } } + @Synchronized + private fun getOrCreateEnrollment(): SmartEnrollment? { + val current = smartEnrollment + if (current != null) return current + + val created = runCatching { SmartEnrollment(context) }.getOrNull() + smartEnrollment = created + return created + } + private fun parseStudent(filename: String): Pair { val base = filename.substringBeforeLast(".") val parts = base.split(Regex("[_\\-\\s]+"), limit = 2).map { it.trim() }