Skip to content

Commit

Permalink
improved descriptions
Browse files Browse the repository at this point in the history
  • Loading branch information
max-unfinity committed Jul 1, 2024
1 parent 4afef6b commit 6073ddd
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 7 deletions.
1 change: 0 additions & 1 deletion .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
"8000",
"--ws",
"websockets",
"--reload"
],
"jinja": true,
"justMyCode": false,
Expand Down
10 changes: 5 additions & 5 deletions src/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ def update_globals(new_dataset_ids):
input_expand_wh_f = Field(
input_expand_wh,
"Expand crops (px)",
"Expand rectangles of the cropped objects by a few pixels on both XY sides. Use it to give the model a little context on the boundary of objects.",
"Expand bounding boxes by the given number of pixels on all sides (both X and Y axes). This helps provide the model with some context around the boundaries of the objects.",
)
content = Container([select_instance_mode_f, input_expand_wh_f])
card_preprocessing_settings = Card(title="Preprocessing settings", content=content, collapsable=True)
Expand Down Expand Up @@ -344,7 +344,7 @@ def run():
api.file.download(team_id, "/" + save_paths["projections"], save_paths["projections"])
projections = torch.load(save_paths["projections"])
else:
info_run.description += "calculating projections...<br>"
info_run.description += "Calculating projections...<br>"
print("calculating projections...")
if len(embeddings) <= 1:
info_run.description += f"the count of embeddings (n={len(embeddings)}) must be > 1<br>"
Expand All @@ -353,7 +353,7 @@ def run():
projections = run_utils.calculate_projections(embeddings, all_info_list, projection_method, metric=metric)
except RuntimeError:
info_run.description += (
f"the count of embeddings is {len(embeddings)}, it is too small to project with UMAP, trying PCA...<br>"
f"the count of embeddings is {len(embeddings)}, not enough to use UMAP. Trying PCA instead...<br>"
)
projection_method = "PCA"
projections = run_utils.calculate_projections(embeddings, all_info_list, projection_method, metric=metric)
Expand All @@ -368,7 +368,7 @@ def run():
url = sly.utils.abs_url(f"files/{file_id}")
else:
url = f"/files/{file_id}"
info_run.description += f"all was saved to team_files: <a href={url}>{save_paths['embeddings']}</a><br>"
info_run.description += f"Embeddings were saved to Team Files: <a href={url}>{save_paths['embeddings']}</a><br>"

# 6. Show chart
obj_classes = list(set(all_info["object_cls"]))
Expand All @@ -379,7 +379,7 @@ def run():
chart.set_series(series, send_changes=True)
card_embeddings_chart.show()
update_table()
info_run.description += "done!<br>"
info_run.description += "Done!<br>"


def get_or_create_tag_meta(project_id, tag_meta):
Expand Down
2 changes: 1 addition & 1 deletion src/run_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ def calculate_projections(embeddings, all_info_list, projection_method, metric="
raise ValueError(f"unexpexted projection_method {projection_method}")
except Exception as e:
print(e)
raise RuntimeError(f"count of embeddings = {len(embeddings)}, it may too small to project")
raise RuntimeError(f"count of embeddings = {len(embeddings)}, not enough to calculate projections.")
return projections


Expand Down

0 comments on commit 6073ddd

Please sign in to comment.