Skip to content

Commit

Permalink
Light refactoring (#86)
Browse files Browse the repository at this point in the history
* fix path to module

* add dict for COCO category definition

* remove space in dense_optical_flow

* move guides to separate dir

* move bash scripts to separate dir

* remove dense optical flow

* move notebooks to a separate directory
  • Loading branch information
sfmig authored Nov 20, 2023
1 parent 969dfee commit ce80381
Show file tree
Hide file tree
Showing 23 changed files with 11 additions and 628 deletions.
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
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
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

This file was deleted.

Loading

0 comments on commit ce80381

Please sign in to comment.