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

Add support for Ubuntu 24.04 #123

Merged
merged 5 commits into from
Nov 23, 2024
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
20 changes: 9 additions & 11 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -7,23 +7,21 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-22.04, ubuntu-20.04, windows-latest]
os: [ubuntu-24.04, ubuntu-22.04, windows-latest]
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4

- name: Install Poetry
run: pipx install poetry

- name: Set up Python
uses: actions/setup-python@v1
uses: actions/setup-python@v4
with:
python-version: 3.8

- name: Upgrade pip
run: python3 -m pip install --upgrade pip

- name: Install Poetry
run: pip3 install poetry --user
python-version: 3.x
cache: "poetry"

- name: Install Dependencies
run: poetry install
run: poetry install --with dev

# Prints the help pages of all scripts to see if the imports etc. work
- name: Test the help pages
2,367 changes: 1,208 additions & 1,159 deletions poetry.lock

Large diffs are not rendered by default.

22 changes: 11 additions & 11 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
[tool.poetry]
name = "YOEO"
version = "1.5.0"
version = "1.6.0"
description = "A hybrid CNN for object detection and semantic segmentation"
authors = ["Florian Vahl <git@flova.de>", "Jan Gutsche <git@jagut.de>"]

[tool.poetry.dependencies]
python = ">=3.8,<4.0"
numpy = "^1.21.1"
torch = ">=1.10.1, <1.13.0"
torchvision = ">=0.8.2"
python = ">=3.10,<4.0"
matplotlib = "^3.3.3"
tensorboard = "^2.12.2"
terminaltables = "^3.1.10"
Pillow = "^9.1.0"
tqdm = "^4.64.1"
imgaug = "^0.4.0"
numpy = "^1.26"
torch = "^2.5.1"
torchvision = "^0.20.1"
pillow = "^11.0.0"
torchsummary = "^1.5.1"
PyYAML = "^6.0"
opencv-python = "^4.5.2"
tqdm = "^4.67.0"
opencv-python = "^4.10.0.84"
pyyaml = "^6.0.2"
tensorboard = "^2.18.0"

[tool.poetry.dev-dependencies]
[tool.poetry.group.dev.dependencies]
onnxruntime = "^1.14.0"
profilehooks = "^1.12.0"
onnx = "^1.9.0"

Unchanged files with check annotations Beta

return metrics_output, seg_class_ious, secondary_metric
def print_eval_stats(metrics_output: Optional[Tuple[np.ndarray]],

Check warning on line 70 in yoeo/test.py

GitHub Actions / linter

trailing whitespace
seg_class_ious: List[np.float64],

Check warning on line 71 in yoeo/test.py

GitHub Actions / linter

trailing whitespace
secondary_metric: Optional[Metric],

Check warning on line 72 in yoeo/test.py

GitHub Actions / linter

trailing whitespace
class_config: ClassConfig,

Check warning on line 73 in yoeo/test.py

GitHub Actions / linter

trailing whitespace
verbose: bool
):
# Print detection statistics
if verbose:
classes = class_config.get_group_class_names()
mbACC_per_class = [secondary_metric.bACC(i) for i in range(len(classes))]

Check warning on line 98 in yoeo/test.py

GitHub Actions / linter

blank line contains whitespace
sec_table = [["Index", "Class", "bACC"]]
for i, c in enumerate(classes):
sec_table += [[i, c, "%.5f" % mbACC_per_class[i]]]
# Extract labels
labels += bb_targets[:, 1].tolist()
# If a subset of the detection classes should be grouped into one class for non-maximum suppression and the

Check warning on line 160 in yoeo/test.py

GitHub Actions / linter

trailing whitespace
# subsequent AP-computation, we need to group those class labels here.
if class_config.classes_should_be_grouped():
labels = class_config.group(labels)
)
sample_stat, secondary_stat = get_batch_statistics(
yolo_outputs,

Check warning on line 183 in yoeo/test.py

GitHub Actions / linter

trailing whitespace
bb_targets,

Check warning on line 184 in yoeo/test.py

GitHub Actions / linter

trailing whitespace
iou_threshold=iou_thres,

Check warning on line 185 in yoeo/test.py

GitHub Actions / linter

trailing whitespace
group_config=class_config.get_group_config()
)
# Concatenate sample statistics
true_positives, pred_scores, pred_labels = [
np.concatenate(x, 0) for x in list(zip(*sample_metrics))]

Check warning on line 205 in yoeo/test.py

GitHub Actions / linter

blank line contains whitespace
yolo_metrics_output = ap_per_class(
true_positives, pred_scores, pred_labels, labels)
:param group_config: GroupConfiguration for this model (optional, defaults to None)
:type group_config: Optional[GroupConfig]
: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 96 in yoeo/detect.py

GitHub Actions / linter

line too long (179 > 150 characters)
:rtype: nd.array, nd.array
"""
model.eval() # Set model to evaluation mode
conf_thres: float = 0.5,
nms_thres: float = 0.5,
group_config: Optional[GroupConfig] = None
):

Check failure on line 132 in yoeo/detect.py

GitHub Actions / linter

closing bracket does not match visual indentation
"""Inferences images with model.
:param model: Model for inference
"""
# Create plot
img = cv2.imread(image_path)
img = cv2.cvtColor(img,cv2.COLOR_BGR2RGB)

Check failure on line 226 in yoeo/detect.py

GitHub Actions / linter

missing whitespace after ','
plt.figure()
fig, ax = plt.subplots(1)
# Get segmentation
pad_y = max(img.shape[1] - img.shape[0], 0) * (img_size / max(img.shape[:2])) // 2
seg_map = seg[

Check failure on line 238 in yoeo/detect.py

GitHub Actions / linter

too many blank lines (2)

Check failure on line 238 in yoeo/detect.py

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 239 in yoeo/detect.py

GitHub Actions / linter

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

Check failure on line 240 in yoeo/detect.py

GitHub Actions / linter

whitespace before ':'
] * 255
ax.imshow(

Check failure on line 244 in yoeo/detect.py

GitHub Actions / linter

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

Check failure on line 247 in yoeo/detect.py

GitHub Actions / linter

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

Check failure on line 248 in yoeo/detect.py

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])