Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

minor format fixes #95

Merged
merged 3 commits into from
Jun 15, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/data_gradients/config/detection.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ report_sections:
- DetectionBoundingBoxArea
- DetectionBoundingBoxPerImageCount
- DetectionBoundingBoxSize
- DetectionClassesCount
- DetectionObjectsPerClass
- DetectionClassesPerImageCount
- DetectionBoundingBoxIoU:
num_bins: 10
4 changes: 2 additions & 2 deletions src/data_gradients/feature_extractors/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
DetectionBoundingBoxArea,
DetectionBoundingBoxPerImageCount,
DetectionBoundingBoxSize,
DetectionClassesCount,
DetectionObjectsPerClass,
DetectionClassHeatmap,
DetectionClassesPerImageCount,
DetectionSampleVisualization,
Expand All @@ -43,7 +43,7 @@
"DetectionBoundingBoxArea",
"DetectionBoundingBoxPerImageCount",
"DetectionBoundingBoxSize",
"DetectionClassesCount",
"DetectionObjectsPerClass",
"DetectionClassHeatmap",
"DetectionClassesPerImageCount",
"DetectionSampleVisualization",
Expand Down
2 changes: 1 addition & 1 deletion src/data_gradients/feature_extractors/common/summary.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ def aggregate(self) -> Feature:
index_of_med = np.argsort(areas)[len(areas) // 2]
basic_stats.med_image_resolution = self.format_resolution(basic_stats.images_resolutions[index_of_med][0])

basic_stats.annotations_per_image = basic_stats.annotation_count / basic_stats.image_count
basic_stats.annotations_per_image = f"{basic_stats.annotation_count / basic_stats.image_count:.2f}"
basic_stats.image_count = f"{basic_stats.image_count:,}"
basic_stats.annotation_count = f"{basic_stats.annotation_count:,}"

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from .bounding_boxes_area import DetectionBoundingBoxArea
from .bounding_boxes_per_image_count import DetectionBoundingBoxPerImageCount
from .bounding_boxes_resolution import DetectionBoundingBoxSize
from .classes_count import DetectionClassesCount
from .classes_count import DetectionObjectsPerClass
from .classes_heatmap_per_class import DetectionClassHeatmap
from .classes_per_image_count import DetectionClassesPerImageCount
from .sample_visualization import DetectionSampleVisualization
Expand All @@ -11,7 +11,7 @@
"DetectionBoundingBoxArea",
"DetectionBoundingBoxPerImageCount",
"DetectionBoundingBoxSize",
"DetectionClassesCount",
"DetectionObjectsPerClass",
"DetectionClassHeatmap",
"DetectionClassesPerImageCount",
"DetectionSampleVisualization",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@


@register_feature_extractor()
class DetectionClassesCount(AbstractFeatureExtractor):
class DetectionObjectsPerClass(AbstractFeatureExtractor):
"""Feature Extractor to count the number of instance of each class."""

def __init__(self):
Expand All @@ -33,7 +33,7 @@ def aggregate(self) -> Feature:

plot_options = BarPlotOptions(
x_label_key="n_appearance",
x_label_name="Number of Appearance",
x_label_name="Objects per class",
y_label_key="class_name",
y_label_name="Class Names",
order_key="class_id",
Expand All @@ -57,7 +57,7 @@ def aggregate(self) -> Feature:

@property
def title(self) -> str:
return "Number of classes."
return "Objects Per Class"

@property
def description(self) -> str:
Expand Down
10 changes: 5 additions & 5 deletions src/data_gradients/managers/abstract_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from itertools import zip_longest
from logging import getLogger
from datetime import datetime
import tqdm
from tqdm import tqdm

from data_gradients.feature_extractors import AbstractFeatureExtractor
from data_gradients.batch_processors.base import BatchProcessor
Expand Down Expand Up @@ -104,7 +104,7 @@ def execute(self):
f" - feature extractor list: {self.grouped_feature_extractors}"
)

datasets_tqdm = tqdm.tqdm(
datasets_tqdm = tqdm(
zip_longest(self.train_iter, self.val_iter, fillvalue=None),
desc="Analyzing... ",
total=self.n_batches,
Expand Down Expand Up @@ -149,7 +149,7 @@ def post_process(self, interrupted=False):
images_created = []

summary = ResultsContainer()
for section_name, feature_extractors in self.grouped_feature_extractors.items():
for section_name, feature_extractors in tqdm(self.grouped_feature_extractors.items(), desc="Summing... "):
section = Section(section_name)
for feature_extractor in feature_extractors:
try:
Expand All @@ -166,9 +166,9 @@ def post_process(self, interrupted=False):
)

if f is not None:
image_name = feature_extractor.__class__.__name__ + ".svg"
image_name = feature_extractor.__class__.__name__ + ".png"
image_path = os.path.join(self.archive_dir, image_name)
f.savefig(image_path, dpi=1200)
f.savefig(image_path, dpi=300)
images_created.append(image_path)
else:
image_path = None
Expand Down
4 changes: 2 additions & 2 deletions tests/manual_tests/detection_super_gradients_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from data_gradients.feature_extractors.common.image_color_distribution import ImageColorDistribution
from data_gradients.feature_extractors.object_detection.bounding_boxes_area import DetectionBoundingBoxArea
from data_gradients.feature_extractors.object_detection.bounding_boxes_resolution import DetectionBoundingBoxSize
from data_gradients.feature_extractors.object_detection.classes_count import DetectionClassesCount
from data_gradients.feature_extractors.object_detection.classes_count import DetectionObjectsPerClass
from data_gradients.feature_extractors.object_detection.classes_per_image_count import DetectionClassesPerImageCount
from data_gradients.feature_extractors.object_detection.bounding_boxes_per_image_count import DetectionBoundingBoxPerImageCount

Expand Down Expand Up @@ -66,7 +66,7 @@ def __call__(self, sample):
DetectionBoundingBoxPerImageCount(),
DetectionBoundingBoxArea(),
DetectionBoundingBoxSize(),
DetectionClassesCount(),
DetectionObjectsPerClass(),
DetectionClassesPerImageCount(),
]

Expand Down