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 detect target image not showing #255

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

arpanroy18
Copy link

No description provided.

Copy link
Collaborator

@Xierumeng Xierumeng left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed.

@@ -132,6 +137,11 @@ def run(
self.__counter += 1

if self.__show_annotations:
cv2.imshow("Annotated", image_annotated) # type: ignore
if image_annotated is not None:
# Display the annotated image in a named window
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove comment.

if image_annotated is not None:
# Display the annotated image in a named window
cv2.imshow("Annotated", image_annotated)
cv2.waitKey(1) # Short delay to process GUI events
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay to leave comment.

@arpanroy18 arpanroy18 force-pushed the fix-detect-target-annotation branch from 5f0f8ec to cf7e72f Compare March 11, 2025 00:13
@arpanroy18 arpanroy18 force-pushed the fix-detect-target-annotation branch from cf7e72f to 58ef535 Compare March 11, 2025 00:15
Copy link
Collaborator

@Xierumeng Xierumeng left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed.

@@ -30,7 +30,10 @@ def create_detect_target(
local_logger: logger.Logger,
) -> tuple[bool, base_detect_target.BaseDetectTarget | None]:
"""
Construct detect target class at runtime.
Factory function to create a detection target object.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

a detect target object.

@@ -55,13 +58,19 @@ def __init__(
show_annotations: Display annotated images.
save_name: filename prefix for logging detections and annotated images.
"""
self.__local_logger = local_logger
self.__device = config.device
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add empty line above this line.

):
self.__local_logger.warning("CUDA not available. Falling back to CPU.")
self.__device = DetectTargetUltralyticsConfig.CPU_DEVICE
self.__enable_half_precision = self.__device != DetectTargetUltralyticsConfig.CPU_DEVICE
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add empty line above this line.

Comment on lines 71 to 72
if config.override_full:
self.__enable_half_precision = False
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Move this closer to the enable half precision declaration.

@@ -127,11 +136,16 @@ def run(
filename = self.__filename_prefix + str(self.__counter)

# Annotated image
cv2.imwrite(filename + ".png", image_annotated) # type: ignore
cv2.imwrite(filename + ".png", image_annotated)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Save the image using the logger.


self.__counter += 1

if self.__show_annotations:
cv2.imshow("Annotated", image_annotated) # type: ignore
if image_annotated is not None:
# Display the annotated image in a named window
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove this line.

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

Successfully merging this pull request may close these issues.

2 participants