Skip to content

Commit

Permalink
update: display_Imagesでラベルを指定できるように更新
Browse files Browse the repository at this point in the history
  • Loading branch information
dyoshyy committed Feb 28, 2024
1 parent 6e5bb1b commit 676404b
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
8 changes: 6 additions & 2 deletions app/mains/functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,11 +65,15 @@ def scale_to_0_255(data):


def display_images(
data, layer_number, embedding_method: str, dataset_name: str, suptitle: str
data, label, layer_number, embedding_method: str, dataset_name: str, suptitle: str
):
num_data = 3
label = np.argmax(label, axis=1)
indices = [np.where(label == i)[0][0] for i in [1, 2, 3]] # 1,2,3のラベルを持つデータの最初のインデックスを取得

img_idx = 1
for n in range(3):
for n in indices:
print(n)
data_to_display = data[n]
# data_to_display = scale_to_0_255(data_to_display)
if data_to_display.shape[2] == 6:
Expand Down
1 change: 1 addition & 0 deletions app/mains/layers.py
Original file line number Diff line number Diff line change
Expand Up @@ -544,6 +544,7 @@ def fit(self, X, Y):
)
display_images(
X,
Y,
n + 2,
layer.embedding,
self.data_set_name,
Expand Down
2 changes: 1 addition & 1 deletion app/mains/main_LeNet.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ def main_LeNet(
train_X, train_Y, test_X, test_Y, channel, image_size = select_datasets(
num_train, num_test, datasets
)
display_images(train_X, 1, "LeNet_train", datasets, f"Input Layer1")
# LeNet-5 model definition
activation = "relu"
# activation = 'tanh'
Expand Down Expand Up @@ -174,6 +173,7 @@ def main_LeNet(
)
display_images(
block_outputs[0],
train_Y,
2,
"LeNet",
datasets,
Expand Down

0 comments on commit 676404b

Please sign in to comment.