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

Fix #143 #144

Open
wants to merge 2 commits into
base: dev
Choose a base branch
from
Open
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
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,5 @@ road_sign_data.yaml
BCCD_Dataset/
model_training/
__pycache__
samples
samples
build/
7 changes: 4 additions & 3 deletions pylabel/analyze.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ def move_column_inplace(df, col, pos):
df.insert(pos, col.name, col)

df_value_counts = pd.DataFrame(
ds.df["cat_name"].value_counts(normalize=normalize), columns=["cat_name"]
ds.df["cat_name"].value_counts(normalize=normalize)
)

df_value_counts.index.name = "cat_name"
Expand All @@ -150,12 +150,13 @@ def move_column_inplace(df, col, pos):
group_df = pd.DataFrame(group)
df_split_value_counts = pd.DataFrame(
group_df["cat_name"].value_counts(normalize=normalize),
columns=["cat_name"],
)
df_split_value_counts.index.name = "cat_name"
df_split_value_counts.columns = [name]
df_value_counts = pd.merge(
df_value_counts, df_split_value_counts, how="left", on=["cat_name"]
df_value_counts, df_split_value_counts,
how="left",
left_index=True, right_index=True
)

# Move 'train' to the left of the table since that is the usual convention.
Expand Down
2 changes: 2 additions & 0 deletions pylabel/importer.py
Original file line number Diff line number Diff line change
Expand Up @@ -300,6 +300,8 @@ def ImportYoloV5(

def GetCatNameFromId(cat_id, cat_names):
cat_id = int(cat_id)
if not cat_names:
return str(cat_id)
if len(cat_names) > int(cat_id):
return cat_names[cat_id]

Expand Down