!11309 Add Hierarchical Occlusion Counterfactual

From: @ngtony
Reviewed-by: 
Signed-off-by:
pull/11309/MERGE
mindspore-ci-bot 4 years ago committed by Gitee
commit 910772cea8

@ -1,5 +1,5 @@
/**
* Copyright 2019 Huawei Technologies Co., Ltd
* Copyright 2019-2021 Huawei Technologies Co., Ltd
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -121,7 +121,7 @@ message Explain {
optional string explain_method = 1;
optional int32 label = 2;
optional string heatmap_path = 3;
}
}
message Benchmark{
optional string benchmark_method = 1;
@ -131,10 +131,21 @@ message Explain {
}
message Metadata{
repeated string label = 1;
repeated string explain_method = 2;
repeated string benchmark_method = 3;
}
repeated string label = 1;
repeated string explain_method = 2;
repeated string benchmark_method = 3;
}
message HocLayer {
optional float prob = 1;
repeated int32 box = 2; // List of repeated x, y, w, h
}
message Hoc {
optional int32 label = 1;
optional string mask = 2;
repeated HocLayer layer = 3;
}
optional int32 sample_id = 1;
optional string image_path = 2; // The Metadata and image path must have one fill in
@ -146,4 +157,6 @@ message Explain {
optional Metadata metadata = 7;
optional string status = 8; // enum value: run, end
repeated Hoc hoc = 9; // hierarchical occlusion counterfactual
}

File diff suppressed because it is too large Load Diff

@ -0,0 +1,15 @@
# Copyright 2021 Huawei Technologies Co., Ltd
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ============================================================================
"""Counterfactual modules."""

@ -1,4 +1,4 @@
# Copyright 2020 Huawei Technologies Co., Ltd
# Copyright 2020-2021 Huawei Technologies Co., Ltd
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@ -84,7 +84,7 @@ class UncertaintyEvaluation:
def __init__(self, model, train_dataset, task_type, num_classes=None, epochs=1,
epi_uncer_model_path=None, ale_uncer_model_path=None, save_model=False):
self.epi_model = model
self.epi_model = deepcopy(model)
self.ale_model = deepcopy(model)
self.epi_train_dataset = train_dataset
self.ale_train_dataset = train_dataset

Loading…
Cancel
Save