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

Light refactoring #86

Merged
merged 7 commits into from
Nov 20, 2023
Merged
Show file tree
Hide file tree
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
5 changes: 3 additions & 2 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
include LICENSE
include README.md

recursive-include crabs *.md
recursive-include crabs *.sh
recursive-include guides *.md
recursive-include bash_scripts *.sh
recursive-include opencv_notebooks *.py

exclude .pre-commit-config.yaml

Expand Down
20 changes: 7 additions & 13 deletions crabs/bboxes_labelling/annotations_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,11 +137,12 @@ def combine_multiple_via_jsons(
return str(json_out_fullpath)


DEFAULT_CRAB_CATEGORY = {"id": 1, "name": "crab", "supercategory": "animal"}


def convert_via_json_to_coco(
json_file_path: str,
coco_category_ID: int = 1,
coco_category_name: str = "crab",
coco_supercategory_name: str = "animal",
coco_category: dict = DEFAULT_CRAB_CATEGORY,
coco_out_filename: Optional[str] = None,
coco_out_dir: Optional[str] = None,
) -> str:
Expand Down Expand Up @@ -183,18 +184,11 @@ def convert_via_json_to_coco(
with open(json_file_path) as json_file:
annotation_data = json.load(json_file)

# Create data structure for COCO format
coco_categories = [
{
"id": coco_category_ID,
"name": coco_category_name,
"supercategory": coco_supercategory_name,
},
]
# Create data structure for COCO
coco_data: dict[str, Any] = {
"info": {},
"licenses": [],
"categories": coco_categories,
"categories": [coco_category],
"images": [],
"annotations": [],
}
Expand Down Expand Up @@ -222,7 +216,7 @@ def convert_via_json_to_coco(
annotation_data = {
"id": annotation_id,
"image_id": image_id,
"category_id": coco_category_ID,
"category_id": coco_category["id"],
"bbox": [x, y, width, height],
"area": width * height,
"iscrowd": 0,
Expand Down
2 changes: 1 addition & 1 deletion crabs/bboxes_labelling/combine_and_format_annotations.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from pathlib import Path

from annotations_utils import (
from crabs.bboxes_labelling.annotations_utils import (
combine_multiple_via_jsons,
convert_via_json_to_coco,
)
Expand Down
226 changes: 0 additions & 226 deletions crabs/dense_optical _flow/estimate_optical_flow_on_video.py
samcunliffe marked this conversation as resolved.
Show resolved Hide resolved

This file was deleted.

Loading