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 OCR Decoding support - WIP #39

Draft
wants to merge 28 commits into
base: main
Choose a base branch
from
Draft

add OCR Decoding support - WIP #39

wants to merge 28 commits into from

Conversation

N950
Copy link

@N950 N950 commented Jun 10, 2024

Adding Nodes/Loss/Metric for OCR recognition/decoding
Conformity to contribution guidelines will be fixed before closing

DrejcPesjak and others added 27 commits February 20, 2024 03:44
* Added ResNet variants

* ResNet50 example

* Simplified example

* fixed resnet config

* [Automated] Updated coverage badge

---------

Co-authored-by: Martin Kozlovsky <martin.kozlovsky@luxonis.com>
Co-authored-by: GitHub Actions <actions@github.com>
* fixed incorrect class property call

* fixed exporter uploading

* uploadCheckpoint uploads on every checkpoint epoch

* fix temp files names

* updated callback readme

* pre-commit run
* option to source custom code in CLI

* removed empty dicts

* [Automated] Updated coverage badge

---------

Co-authored-by: GitHub Actions <actions@github.com>
* option to source custom code in CLI

* removed empty dicts

* fixed issue with removed tensor metadata in match case statements
* forbid extra fields in config

* fixed configs
* automatic inference of attach index based on type signature

* added inference for input and x names
* fixed link in docs

* fixed repvgg backbone

* fixed efficientnet
* upload logs to mlflow

* added mlflwo instance

* multithread log upload

* fixed upload logs

* fixed log file path

* removed exceptions

* logging exceptions

* fixed typo

* reverted exception

* moved line

* replaced warning with error log

* Update trainer.py
* add archiver CLI

* add archiver callback

* add max_det parameter to EfficientBBoxHead

* add enum to categorize tasks for the implemented heads

* add archiver tests

* adjust Archiver to new nn archive format

* pre-comit formatting

* add LDF creation and adjust to new nn archive format

* update requirements.txt

* add opencv-python to requirements.txt

* add support for ImplicitKeypointBBoxHead

* remove support for ObjectDetectionSSD

* Update requirements.txt

* Added mlflow and removed opencv

* [Automated] Updated coverage badge

* add support for SegmentationHead and BiSeNetHead

* base archiver tests on model from luxonis-train instead of torchvision

* adjust head parameters to changes in NN Archive

* adjust keypoint detection head parameters to changes in NN Archive

* bugfix - make sure self.max_det is used in nms

* add max_det parameter to ImplicitKeypointBBoxHead

* adjust task categorization for ImplicitKeypointBBoxHead

* fixing  Windows PermissionError occuring on file deletion

* fixing Windows PermissionError occuring on file deletion due to unreleased logging handlers

* add method to remove file handlers keeping the log file open

* add a logging statement at the end of archiving

* add optuna_integration to requirements.txt

* add hard-coded solution to determining is_softmax parameter

* added help

---------

Co-authored-by: Martin Kozlovský <martin.kozlovsky@luxonis.com>
Co-authored-by: GitHub Actions <actions@github.com>
* extend NN Archive generation test coverage to cover all implemented heads

* [Automated] Updated coverage badge

---------

Co-authored-by: GitHub Actions <actions@github.com>
* uploading all checkpoints

* fix names

* removed comment
* handling SIGTERM signal

* resume argument takes path
* handling SIGTERM signal

* resume argument takes path

* basic task group labels support

* updated requirements

* fixed tests

* fixed loader test

* Update luxonis_train/models/luxonis_model.py

Co-authored-by: conorsim <60359299+conorsim@users.noreply.github.com>

---------

Co-authored-by: conorsim <60359299+conorsim@users.noreply.github.com>
* option to set torch matmul precision for tensor cores

* updated readme
* fixed reset not being called

* added metric resets

* removed inheritance

* proper oks reset

* removed unnecessary resets

* added annotations
* Added seed to config for reproducibility

* fixed seg drawing when using torch deterministic backend

* added deterministic order of creating nodes

* removed seed from example config

* added reproducability to inspect

* formatting

---------

Co-authored-by: DrejcPesjak <dp8949@student.uni-lj.si>
Co-authored-by: Martin Kozlovský <martin.kozlovsky@luxonis.com>
* support for custom loaders and datasets

* updated configs

* custom loaders in inspect command

* updated inspect for multi-task labels

* removed custom loader from test config

* deleted comment

* deleted comment

* removed custom dataset

* removed comment

* skipping archiver test untill fixed in luxonis-ml

* [Automated] Updated coverage badge

---------

Co-authored-by: GitHub Actions <actions@github.com>
Co-authored-by: GitHub Actions <actions@github.com>
Co-authored-by: GitHub Actions <actions@github.com>
Co-authored-by: GitHub Actions <actions@github.com>
Copy link

☂️ Python Coverage

current status: ✅

Overall Coverage

Lines Covered Coverage Threshold Status
4978 3753 75% 0% 🟢

New Files

File Coverage Status
luxonis_train/attached_modules/losses/ocr_decoding_loss.py 29% 🟢
luxonis_train/attached_modules/metrics/ocr_accuracy.py 27% 🟢
luxonis_train/nodes/ocr_decoder.py 32% 🟢
TOTAL 29% 🟢

Modified Files

File Coverage Status
luxonis_train/attached_modules/losses/init.py 100% 🟢
luxonis_train/attached_modules/metrics/init.py 100% 🟢
luxonis_train/nodes/init.py 100% 🟢
TOTAL 100% 🟢

updated for commit: da0106e by action🐍

from .base_loss import BaseLoss


class FocalCTC(BaseLoss[Tensor, Tensor]):
Copy link
Collaborator

@kozlov721 kozlov721 Sep 10, 2024

Choose a reason for hiding this comment

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

Add class attribute supported_labels = [LabelType.TEXT] to all the losses and metrics

Copy link
Collaborator

Choose a reason for hiding this comment

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

Also the metrics and losses will probably require custom prepare method that takes the packed output of the head and labels and prepares argument to be passed to forward or update.

from luxonis_train.utils.types import LabelType


class ResBlock(nn.Module):
Copy link
Collaborator

@kozlov721 kozlov721 Sep 10, 2024

Choose a reason for hiding this comment

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

I believe both ResBlock nad DownSample should already be implemented in luxonis_train.nodes.blocks or in one of the backbones

return out


class OCRDecoderBackbone(BaseNode):
Copy link
Collaborator

Choose a reason for hiding this comment

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

Instead of _task_type argument, add a class attribute tasks: list[LabelType] = [LabelType.TEXT]

@kozlov721 kozlov721 deleted the branch main October 9, 2024 10:35
@kozlov721 kozlov721 closed this Oct 9, 2024
@kozlov721 kozlov721 reopened this Oct 9, 2024
@kozlov721 kozlov721 changed the base branch from dev to main October 9, 2024 10:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants