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 warning at startup due to uninitilized memory #114

Merged
merged 1 commit into from
Oct 28, 2023
Merged
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
4 changes: 2 additions & 2 deletions yoeo/detect.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,18 +86,18 @@
:type nms_thres: float, optional
:param robot_class_ids: List of class IDs of robot classes if multiple robot classes exist.
:type robot_class_ids: List[int], optional
:return: Detections on image with each detection in the format: [x1, y1, x2, y2, confidence, class], Segmentation as 2d numpy array with the coresponding class id in each cell

Check failure on line 89 in yoeo/detect.py

View workflow job for this annotation

GitHub Actions / linter

line too long (179 > 150 characters)
:rtype: nd.array, nd.array
"""
model.eval() # Set model to evaluation mode

Check warning on line 93 in yoeo/detect.py

View workflow job for this annotation

GitHub Actions / linter

blank line contains whitespace
# Configure input
input_img = transforms.Compose([
DEFAULT_TRANSFORMS,
Resize(img_size)])((
image,
np.empty((1, 5)),
np.empty((img_size, img_size), dtype=np.uint8)))[0].unsqueeze(0)
np.zeros((1, 5)),
np.zeros((img_size, img_size), dtype=np.uint8)))[0].unsqueeze(0)

if torch.cuda.is_available():
input_img = input_img.to("cuda")
Expand Down Expand Up @@ -199,7 +199,7 @@
"""
# Create plot
img = cv2.imread(image_path)
img = cv2.cvtColor(img,cv2.COLOR_BGR2RGB)

Check failure on line 202 in yoeo/detect.py

View workflow job for this annotation

GitHub Actions / linter

missing whitespace after ','
plt.figure()
fig, ax = plt.subplots(1)
# Get segmentation
Expand All @@ -211,22 +211,22 @@
pad_y = max(img.shape[1] - img.shape[0], 0) * (img_size / max(img.shape[:2])) // 2


seg_map = seg[

Check failure on line 214 in yoeo/detect.py

View workflow job for this annotation

GitHub Actions / linter

too many blank lines (2)

Check failure on line 214 in yoeo/detect.py

View workflow job for this annotation

GitHub Actions / linter

local variable 'seg_map' is assigned to but never used
int(pad_y) : int(img_size - pad_y),

Check failure on line 215 in yoeo/detect.py

View workflow job for this annotation

GitHub Actions / linter

whitespace before ':'
int(pad_x) : int(img_size - pad_x),

Check failure on line 216 in yoeo/detect.py

View workflow job for this annotation

GitHub Actions / linter

whitespace before ':'
] * 255


ax.imshow(

Check failure on line 220 in yoeo/detect.py

View workflow job for this annotation

GitHub Actions / linter

too many blank lines (2)
SegmentationMapsOnImage(
seg[
int(pad_y) : int(img_size - pad_y),

Check failure on line 223 in yoeo/detect.py

View workflow job for this annotation

GitHub Actions / linter

whitespace before ':'
int(pad_x) : int(img_size - pad_x),

Check failure on line 224 in yoeo/detect.py

View workflow job for this annotation

GitHub Actions / linter

whitespace before ':'
], shape=img.shape).draw_on_image(img)[0])
# Rescale boxes to original image
detections = rescale_boxes(detections, img_size, img.shape[:2])
unique_labels = detections[:, -1].cpu().unique()
n_cls_preds = len(unique_labels)

Check failure on line 229 in yoeo/detect.py

View workflow job for this annotation

GitHub Actions / linter

local variable 'n_cls_preds' is assigned to but never used
# Bounding-box colors
cmap = plt.get_cmap("tab20b")
colors = [cmap(i) for i in np.linspace(0, 1, len(classes))]
Expand Down
Loading