diff --git a/dan/datasets/analyze/statistics.py b/dan/datasets/analyze/statistics.py index 880eb1d35974828ca6a929e60f0695008d768b0c..c5f62664bc6d53aa330f70efd0cea6e73a7dad8d 100644 --- a/dan/datasets/analyze/statistics.py +++ b/dan/datasets/analyze/statistics.py @@ -1,6 +1,5 @@ # -*- coding: utf-8 -*- from collections import Counter, defaultdict -from operator import itemgetter from pathlib import Path from typing import Dict, List, Optional @@ -156,8 +155,7 @@ class Statistics: # Path to the images are the key of the dict self.create_image_statistics(images=split_data.keys()) - # The text is actually under the "text" key of the values - labels = list(map(itemgetter("text"), split_data.values())) + labels = list(split_data.values()) # Text statistics self.create_label_statistics(labels=labels) diff --git a/tests/data/training/training_dataset/labels.json b/tests/data/training/training_dataset/labels.json index ebd62c6abb07159a09b53a4a99d20510f7c27991..da3b3df76ef9b53773aebc1a23305510494e57db 100644 --- a/tests/data/training/training_dataset/labels.json +++ b/tests/data/training/training_dataset/labels.json @@ -1,26 +1,14 @@ { "train": { - "tests/data/training/training_dataset/images/0a34e13a-4ab0-4a91-8d7c-b1d8fee32628.png": { - "text": "The latter do not regard" - }, - "tests/data/training/training_dataset/images/0a70e14f-feda-4607-989c-36cf581ddff5.png": { - "text": "At the beginning of" - } + "tests/data/training/training_dataset/images/0a34e13a-4ab0-4a91-8d7c-b1d8fee32628.png": "The latter do not regard", + "tests/data/training/training_dataset/images/0a70e14f-feda-4607-989c-36cf581ddff5.png": "At the beginning of" }, "val": { - "tests/data/training/training_dataset/images/0a576062-303c-4893-a729-c09c92865d31.png": { - "text": "One can remember with" - }, - "tests/data/training/training_dataset/images/0b2457c8-81f1-4600-84d9-f8bf2822a991.png": { - "text": "The play was no more" - } + "tests/data/training/training_dataset/images/0a576062-303c-4893-a729-c09c92865d31.png": "One can remember with", + "tests/data/training/training_dataset/images/0b2457c8-81f1-4600-84d9-f8bf2822a991.png": "The play was no more" }, "test": { - "tests/data/training/training_dataset/images/fb3edb59-3678-49f8-8e16-8e32e3b0f051.png": { - "text": "Both her wrists bore" - }, - "tests/data/training/training_dataset/images/fe498de2-ece4-4fbe-8b53-edfce1b820f0.png": { - "text": "SOME years ago a contemporary" - } + "tests/data/training/training_dataset/images/fb3edb59-3678-49f8-8e16-8e32e3b0f051.png": "Both her wrists bore", + "tests/data/training/training_dataset/images/fe498de2-ece4-4fbe-8b53-edfce1b820f0.png": "SOME years ago a contemporary" } }