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

set memory_optimize=False, can't dectect anything #9

Closed
LudovicoYIN opened this issue May 30, 2024 · 3 comments
Closed

set memory_optimize=False, can't dectect anything #9

LudovicoYIN opened this issue May 30, 2024 · 3 comments
Labels
question Further information is requested

Comments

@LudovicoYIN
Copy link

When i set memory_optimize=False, i can't dectect anything

@Koldim2001
Copy link
Owner

Koldim2001 commented May 30, 2024

@LudovicoYIN
When using the memory_optimize=False mode, the results of masks will be stored as an array of binary masks result.filtered_masks for each object (insted of list of plygons as in memory_optimize=True example).

img=result.image
confidences=result.filtered_confidences
boxes=result.filtered_boxes
masks=result.filtered_masks
classes_ids=result.filtered_classes_id
classes_names=result.filtered_classes_names

Here's an example of how to visualize the results in such case:

element_crops = MakeCropsDetectThem(
    image=img,
    model_path="yolov9e-seg.pt",
    segment=True,
    show_crops=True,
    shape_x=350,
    shape_y=250,
    overlap_x=50,
    overlap_y=50,
    conf=0.5,
    iou=0.7,
    imgsz=416,
    classes_list=[0, 1, 2, 3, 5, 7],
    resize_initial_size=True,
    memory_optimize=False
)
result = CombineDetections(element_crops, nms_threshold=0.5, match_metric='IOS')

print('YOLO-Patch-Based-Inference:')
visualize_results(
    img=result.image,
    confidences=result.filtered_confidences,
    boxes=result.filtered_boxes,
    masks=result.filtered_masks,
    classes_ids=result.filtered_classes_id,
    classes_names=result.filtered_classes_names,
    segment=True,
    thickness=6,
    font_scale=1.1,
    fill_mask=True,
    show_boxes=False,
    delta_colors=3,
    show_class=False,
    axis_off=False
)

More exaples - Colab

@Koldim2001 Koldim2001 added the question Further information is requested label May 30, 2024
@Koldim2001
Copy link
Owner

@LudovicoYIN How are your results? Did using filtered_masks instead of filtered_polygons help you solve the problem?

@LudovicoYIN
Copy link
Author

Thank you so much Sir, i forget add masks=result.filtered_masks, i still use filtered_polygons

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants