-
Notifications
You must be signed in to change notification settings - Fork 13
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
Model analysis in Object Detection #312
Conversation
… - can draw conf_mat"
waffle_hub/hub/hub.py
Outdated
) | ||
|
||
else: | ||
pass |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i think it is better to print a Warning or Info message instead of pass.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll change it to display a warning message using 'warnings'.
waffle_hub/temp_utils/image/io.py
Outdated
@@ -21,6 +21,18 @@ def save_image(output_path: Union[str, Path], image: Mat, create_directory: bool | |||
with open(str(output_path), mode="w+b") as f: | |||
img_arr.tofile(f) | |||
|
|||
def save_images(output_path: Union[str, Path], images: list[Mat], create_directory: bool = False) -> None: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it seems better to change the function name. Functionally, it appears to merge multiple images into one and save them as a single image. However, based on the function name alone, it looks like it saves each image individually into separate directories.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would consider naming it batch_save_images
. Thank you for participating in the review!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think..
I'm also confused about batch_save_images
naming.
How about naming it save_concat_image
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For now, waffle_hub
will not approve any PR. But, this PR will be reused when rebuilding sprint be done.
Don't need to make changes about my review.
waffle_hub/hub/hub.py
Outdated
import matplotlib.pyplot as plt | ||
import numpy as np | ||
import pandas as pd | ||
import seaborn as sn |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove unused modules
waffle_hub/hub/hub.py
Outdated
@@ -1364,23 +1391,86 @@ def evaluating( | |||
metrics = evaluate_function( | |||
preds, labels, self.task, len(self.categories), image_size=cfg.image_size | |||
) | |||
# TODO: Confusion matrix visualization functions other than 'OBJECT_DETECTION' and 'CLASSIFICATION' are required. | |||
if self.task == "OBJECT_DETECTION" or self.task == "CLASSIFICATION": |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use TaskType instead
waffle_hub/hub/hub.py
Outdated
if value == None: | ||
continue | ||
elif isinstance(value, list): | ||
if len(self.get_category_names()) == len(value) - 1: | ||
"""for object detection confusion matrix""" | ||
values = [ | ||
{ | ||
"class_name": cat, | ||
"value": cat_value, | ||
} | ||
for cat, cat_value in zip(self.get_category_names(), value) | ||
] | ||
values.append({"class_name": "background", "value": value[-1]}) | ||
else: | ||
values = [ | ||
{ | ||
"class_name": cat, | ||
"value": cat_value, | ||
} | ||
for cat, cat_value in zip(self.get_category_names(), value) | ||
] | ||
elif isinstance(value, set): | ||
"""It can load the misprediction image info.""" | ||
values = [] | ||
pred_list = list(value) | ||
set_file = io.load_json(getattr(dataset, f"{cfg.set_name}_set_file")) | ||
for pred in pred_list: | ||
image_info = dataset.image_dict[set_file[pred]] | ||
values.append({pred: image_info.file_name}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
these if-elif
condition looks ambiguous
@ZeroAct |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should also save the Evaluate dataset information. (such as name, root_dir etc..)
tpfpfn_table: list[float] = None | ||
fp_images_set: set = None | ||
fn_images_set: set = None |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it necessary for evaluation.json? In particular, I seems that images set
is not needed or saved as separate files.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the same. I think it would be better to separate it into files according to the image index...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think getf1
, getConfusionMatric
can be confused with classification.
You divided the folder structure for object detection
, but isn't it necessary in common?
I'll think about this part at the same time as I verify it.
When evaluate in Object Detection task
draw
option. To analyze mispredictions, You can compare the prediction and label through images. Left: Pred / Right: LabelWhen evaluate in Classification task,
Add hub cached properties :
confusionmatrix_file
,mis_predict_dir
,fp_dir
andfn_dir
.Add
save_images
function, in utils.image.io.Ref : https://www.notion.so/snuailab/0a2a29ce014f42fb84520057a2eb5500