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

Dataset Recognition #79

Merged
merged 25 commits into from
Mar 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
d88fd0d
added directory structure to docs
kozlov721 Feb 22, 2024
92c58af
split parsers into separate files, added validation
kozlov721 Feb 25, 2024
3402377
improved import guard
kozlov721 Feb 25, 2024
39b3294
dataset recognition
kozlov721 Feb 28, 2024
cb2e877
updated notebook example
kozlov721 Feb 28, 2024
f439b6d
improved coco parser
kozlov721 Feb 28, 2024
7fd5ee4
cleaned parsers
kozlov721 Feb 29, 2024
9245ab0
remove prints
kozlov721 Feb 29, 2024
34702e9
added save dir option
kozlov721 Feb 29, 2024
fc25417
changed single file download
kozlov721 Feb 29, 2024
481e2b6
parser test cases
kozlov721 Feb 29, 2024
b4c540a
docs
kozlov721 Feb 29, 2024
ee70368
removed dataset deleting
kozlov721 Feb 29, 2024
e72dd54
requirements
kozlov721 Feb 29, 2024
f369161
added logging to the end
kozlov721 Feb 29, 2024
dfffead
Update create_ml_parser.py
kozlov721 Mar 1, 2024
568cebf
added gcloud authentication
kozlov721 Mar 1, 2024
6f6da02
Merge branch 'feature/dataset-recognition' of github.com:luxonis/luxo…
kozlov721 Mar 1, 2024
0ff2d24
pre-commit formatting
kozlov721 Mar 1, 2024
11bdce4
[Automated] Updated coverage badge
actions-user Mar 1, 2024
7b6b94f
Merge branch 'dev' into feature/dataset-recognition
kozlov721 Mar 2, 2024
43a4b80
updated for latest LuxonisFileSystem
kozlov721 Mar 2, 2024
acaf022
changed test parsers save path
kozlov721 Mar 2, 2024
9e14995
Merge branch 'feature/dataset-recognition' of github.com:luxonis/luxo…
kozlov721 Mar 2, 2024
00e959c
[Automated] Updated coverage badge
actions-user Mar 2, 2024
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
42 changes: 12 additions & 30 deletions examples/Data_Parser_Example.ipynb
Copy link
Collaborator

Choose a reason for hiding this comment

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

Not sure if it's an issue with my local environment but when I run the last cell with the loader I get

KeyError: <LabelType.BOUNDINGBOX: 'boxes'>

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

You might need to first delete the data directory if it already exists. I changed some things, but it won't re-download if the zip exists.

Original file line number Diff line number Diff line change
Expand Up @@ -17,29 +17,15 @@
"source": [
"import os\n",
"import zipfile\n",
"from pathlib import Path\n",
"\n",
"import cv2\n",
"import gdown\n",
"import matplotlib.pyplot as plt\n",
"import numpy as np\n",
"\n",
"from luxonis_ml.data import LuxonisDataset, LuxonisLoader, LuxonisParser\n",
"from luxonis_ml.enums import DatasetType, LabelType"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "e5a3a45c-7152-41a8-9ebf-db54cb84edcc",
"metadata": {},
"outputs": [],
"source": [
"# Delete dataset if exists\n",
"\n",
"dataset_name = \"coco_test\"\n",
"if LuxonisDataset.exists(dataset_name):\n",
" dataset = LuxonisDataset(dataset_name)\n",
" dataset.delete_dataset()"
"from luxonis_ml.data import LuxonisLoader, LuxonisParser\n",
"from luxonis_ml.enums import LabelType"
]
},
{
Expand All @@ -61,20 +47,20 @@
"source": [
"url = \"https://drive.google.com/uc?id=1XlvFK7aRmt8op6-hHkWVKIJQeDtOwoRT\"\n",
"output_zip = \"../data/COCO_people_subset.zip\"\n",
"output_folder = \"../data/\"\n",
"dataset_dir = \"../data/coco_test\"\n",
"\n",
"if not os.path.exists(output_folder):\n",
" os.mkdir(output_folder)\n",
"if not os.path.exists(dataset_dir):\n",
" Path(dataset_dir).mkdir(parents=True)\n",
"# Check if the data already exists\n",
"if not os.path.exists(output_zip) and not os.path.exists(\n",
" os.path.join(output_folder, \"COCO_people_subset\")\n",
" os.path.join(dataset_dir, \"COCO_people_subset\")\n",
"):\n",
" # Download the file\n",
" gdown.download(url, output_zip, quiet=False)\n",
"\n",
" # Unzip the file\n",
" with zipfile.ZipFile(output_zip, \"r\") as zip_ref:\n",
" zip_ref.extractall(output_folder)\n",
" zip_ref.extractall(dataset_dir)\n",
"else:\n",
" print(\"Data already exists. Exiting.\")"
]
Expand Down Expand Up @@ -102,13 +88,9 @@
"metadata": {},
"outputs": [],
"source": [
"parser = LuxonisParser(dataset_name=dataset_name)\n",
"dataset = parser.parse_raw_dir(\n",
" DatasetType.COCO,\n",
" random_split=True,\n",
" image_dir=os.path.join(output_folder, \"person_val2017_subset\"),\n",
" annotation_path=os.path.join(output_folder, \"person_keypoints_val2017.json\"),\n",
")"
"dataset_name = \"coco_test\"\n",
"parser = LuxonisParser(dataset_dir, dataset_name=dataset_name, delete_existing=True)\n",
"dataset = parser.parse(random_split=True)"
]
},
{
Expand Down Expand Up @@ -174,7 +156,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.10.13"
"version": "3.8.18"
}
},
"nbformat": 4,
Expand Down
Loading