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

fixed link in pdf #154

Merged
merged 1 commit into from
Jul 12, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
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/assets/html/doc_template.html
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,7 @@
{% endfor %}
<div class="alert-box notice">
<span><img src="{{assets.image.info}}" width="40pt" height="25pt">Notice: </span>
To better understand how to tackle the data issues highlighted in this report, explore our comprehensive <a href="https://deci.ai/course/profiling-computer-vision-datasets-overview/">course</a> on analyzing computer vision datasets."
To better understand how to tackle the data issues highlighted in this report, explore our comprehensive <a href="https://deci.ai/course/profiling-computer-vision-datasets-overview/?utm_campaign[…]=DG-PDF-report&utm_medium=DG-repo&utm_content=DG-Report-to-course">course</a> on analyzing computer vision datasets.
</div>
</body>
</html>
8 changes: 1 addition & 7 deletions src/data_gradients/config/data/questions.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,7 @@
from dataclasses import dataclass
from typing import Dict, Any, Optional, List


def text_to_blue(text: str) -> str:
return f"\033[34;1m{text}\033[0m"


def text_to_yellow(text: str):
return f"\033[33;1m{text}\033[0m"
from data_gradients.utils.utils import text_to_blue, text_to_yellow


@dataclass
Expand Down
4 changes: 4 additions & 0 deletions src/data_gradients/managers/abstract_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
from data_gradients.feature_extractors import AbstractFeatureExtractor
from data_gradients.batch_processors.base import BatchProcessor
from data_gradients.feature_extractors.common import SummaryStats
from data_gradients.utils.utils import print_in_box
from data_gradients.visualize.seaborn_renderer import SeabornRenderer
from data_gradients.utils.pdf_writer import ResultsContainer, Section, FeatureSummary
from data_gradients.utils.summary_writer import SummaryWriter
Expand Down Expand Up @@ -98,6 +99,9 @@ def execute(self):
f" - feature extractor list: {self.grouped_feature_extractors}"
)

print_in_box("To better understand how to tackle the data issues highlighted in this report, explore our comprehensive course on analyzing "
"computer vision datasets. click here: https://hubs.ly/Q01XpHBT0")

datasets_tqdm = tqdm(
zip_longest(self.train_iter, self.val_iter, fillvalue=None),
desc="Analyzing... ",
Expand Down
53 changes: 53 additions & 0 deletions src/data_gradients/utils/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,3 +77,56 @@ def safe_json_load(path: str) -> Dict:
return json.load(f)
except json.decoder.JSONDecodeError:
return {}


def text_to_blue(text: str) -> str:
return f"\033[34;1m{text}\033[0m"


def text_to_yellow(text: str):
return f"\033[33;1m{text}\033[0m"


def break_text(text: str, line_length: int):
lines = []
words = text.split()
current_line = []
current_length = 0

for word in words:
word_length = len(word)

if current_length + len(current_line) + word_length <= line_length:
current_line.append(word)
current_length += word_length
else:
lines.append(' '.join(current_line))
current_line = [word]
current_length = word_length

if current_line:
lines.append(' '.join(current_line))

# Add spaces to the end of each line to make them equal in length
for i in range(len(lines)):
spaces_needed = line_length - len(lines[i])
lines[i] += ' ' * spaces_needed

return lines


def print_in_box(text_lines: str, box_size: int = 70):
left = text_to_blue("║ ")
right = text_to_blue(" ║")
bottom_left = text_to_blue("╚")
top_bottom = text_to_blue("═")
top_left = text_to_blue("╔")
top_right = text_to_blue("╗")
bottom_right = text_to_blue("╝")

lines = break_text(text_lines, box_size)
top_bottom = top_bottom * (box_size + 4)
print(top_left + top_bottom + top_right)
for text in lines:
print(left + text + right)
print(bottom_left + top_bottom +bottom_right)