Skip to content

Commit

Permalink
Update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
GokulNC committed Oct 9, 2021
1 parent 00d09b9 commit fc4599d
Show file tree
Hide file tree
Showing 18 changed files with 160 additions and 54 deletions.
12 changes: 12 additions & 0 deletions .readthedocs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
version: 2

build:
image: latest

sphinx:
configuration: docs/conf.py

python:
version: 3.6
install:
- requirements: docs/requirements.txt
16 changes: 8 additions & 8 deletions docs/_static/datasets.csv
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
Dataset,Sign Language,Pose Dataset
:class:`~openhands.datasets.isolated.AUTSLDataset`,`Turkish <https://chalearnlap.cvc.uab.cat/dataset/40/description/>`_,`Download <https://raw.github.com>`_
:class:`~openhands.datasets.isolated.CSLDataset`,`Chinese <http://home.ustc.edu.cn/~pjh/openresources/cslr-dataset-2015/index.html>`_,`Download <https://raw.github.com>`_
:class:`~openhands.datasets.isolated.DeviSignDataset`,`Chinese <http://vipl.ict.ac.cn/homepage/ksl/data.html>`_,`Download <https://raw.github.com>`_
:class:`~openhands.datasets.isolated.GSLDataset`,`Greek <https://vcl.iti.gr/dataset/gsl/>`_,`Download <https://raw.github.com>`_
:class:`~openhands.datasets.isolated.INCLUDEDataset`,`Indian <https://sign-language.ai4bharat.org/#/INCLUDE>`_,`Download <https://raw.github.com>`_
:class:`~openhands.datasets.isolated.LSA64Dataset`,`Argentinian <http://facundoq.github.io/datasets/lsa64/>`_,`Download <https://raw.github.com>`_
:class:`~openhands.datasets.isolated.WLASLDataset`,`American <https://dxli94.github.io/WLASL/>`_,`Download <https://raw.github.com>`_
Dataset,Sign Language,Download Size
:class:`~openhands.datasets.isolated.AUTSLDataset`,`Turkish <https://chalearnlap.cvc.uab.cat/dataset/40/description/>`_,`2.1GB <https://raw.github.com>`_
:class:`~openhands.datasets.isolated.CSLDataset`,`Chinese <http://home.ustc.edu.cn/~pjh/openresources/cslr-dataset-2015/index.html>`_,`11GB <https://raw.github.com>`_
:class:`~openhands.datasets.isolated.DeviSignDataset`,`Chinese <http://vipl.ict.ac.cn/homepage/ksl/data.html>`_,`2.3GB <https://raw.github.com>`_
:class:`~openhands.datasets.isolated.GSLDataset`,`Greek <https://vcl.iti.gr/dataset/gsl/>`_,`0.7GB <https://raw.github.com>`_
:class:`~openhands.datasets.isolated.INCLUDEDataset`,`Indian <https://sign-language.ai4bharat.org/#/INCLUDE>`_,`0.6GB <https://raw.github.com>`_
:class:`~openhands.datasets.isolated.LSA64Dataset`,`Argentinian <http://facundoq.github.io/datasets/lsa64/>`_,`0.2GB <https://raw.github.com>`_
:class:`~openhands.datasets.isolated.WLASLDataset`,`American <https://dxli94.github.io/WLASL/>`_,`1GB <https://raw.github.com>`_
14 changes: 6 additions & 8 deletions docs/_static/raw_datasets.csv
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
Dataset Link,Source,Size (hours)
pose_no_sub_one_min_splits.h5,ISH News
pose_sub_based_splits.h5,ISH News
pose_videos_chunked_1_min.h5,MBM Vadodara
pose_for_splitted.h5,NIOS Videos
newshook_dataset.h5,NewsHook
sign_library_1_min_splits.h5,Sign Library
sign_library_sub_based.h5,Sign Library
Source,Total Hours,Download Size
`ISH News <https://www.youtube.com/c/ISHNews>`_,145,`15GB <>`_
`MBM Vadodara <https://www.youtube.com/channel/UCptUQkgBpyrvDK31d16lPmA>`_,225,`23GB <>`_
`National Institute of Open Schooling (NIOS) <https://www.youtube.com/channel/UCXBn5q8Zv4Bz-LZXWWD7Jxw>`_,115,`11GB <>`_
`NewzHook <https://www.youtube.com/c/NewzHookNewsforDisabledinIndia>`_,615,`58GB <>`_
`SIGN LIBRARY <https://www.youtube.com/channel/UCaTMaFNkTiwgsSQ7FYaiaTQ/>`_,29,`2.9GB <>`_
47 changes: 47 additions & 0 deletions docs/api.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
API Documentation
=================

Tasks
-----

.. automodule:: openhands.apis
:members:

Models
------

Encoders
^^^^^^^^

.. automodule:: openhands.models.encoder
:members:

Decoders
^^^^^^^^

.. automodule:: openhands.models.decoder
:members:

Datasets
--------

Augmentations
^^^^^^^^^^^^^

.. automodule:: openhands.datasets.pose_transforms
:members:

ISLR Datasets
^^^^^^^^^^^^^^^^^^^^^^^

Base class
++++++++++

.. automodule:: openhands.datasets.isolated.base
:members:

Labelled datasets
+++++++++++++++++

.. automodule:: openhands.datasets.isolated
:members:
28 changes: 8 additions & 20 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,35 +6,23 @@
Welcome to 👐OpenHands's documentation!
=======================================

**👐OpenHands** is an open source toolkit to democratize sign language research by making pose-based Sign Language Recognition (SLR) more accessible to everyone.

Features
--------

- Easily train pose-based isolated sign language recognizers (ISLR)
- Currently supports 4 different models
- Support for many run-time augmentations for pose keypoints
- Check for complete list of pose transforms
- Support for efficient inference
- Check for more details:
- Easily pre-train models using monolingual SL data
- And fine-tune on any small ISLR dataset
- All Training and Inference is completely config-based
- No-code required
- Check for example configs:
- Supports 6 sign languages out-of-the-box
- Check for supported datasets:

For detailed explanation, please check out our paper: `👐OpenHands: Making ... <https://arxiv.org>`_
**👐OpenHands** is an `open source <https://github.com/AI4Bharat/OpenHands>`_ toolkit to democratize sign language research by making pose-based Sign Language Recognition (SLR) more accessible to everyone.

.. toctree::
:maxdepth: 2
:caption: Getting Started

instructions/features
instructions/installation
instructions/datasets
instructions/models
instructions/training
instructions/self_supervised
instructions/inference
instructions/support

.. toctree::
:maxdepth: 2
:caption: Code Documentation

api
19 changes: 18 additions & 1 deletion docs/instructions/datasets.rst
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,22 @@ You can now directly proceed to train!
Custom Datasets
---------------

To add support for your own dataset, follow the steps below:
To add support for your own dataset, create a class of the following structure:

.. code:: python
from .base import BaseIsolatedDataset
class MyDatasetDataset(BaseIsolatedDataset):
def read_glosses(self):
self.glosses = ... # Populate the list of all glosses
def read_original_dataset(self):
self.data = ... # Populate the list of all video files and gloss IDs as tuples
def read_video_data(self, index):
# Read the following ...
return imgs, label, video_name
- For implementation examples, check `this folder in the source code <https://github.com/AI4Bharat/OpenHands/tree/main/openhands/datasets/isolated>`_
- This class can now be referenced in your config file appropriately, and used for training or inference.
29 changes: 29 additions & 0 deletions docs/instructions/features.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
Features
========

For detailed explanation, please check out our paper: `👐OpenHands: Making ... <https://arxiv.org>`_

Currently supported
-------------------

- Easily train pose-based isolated sign language recognizers (ISLR)
- Currently supports 4 different models
- Support for many run-time augmentations for pose keypoints
- Check for complete list of pose transforms
- Support for efficient inference
- Check for more details:
- Easily pre-train models using monolingual SL data
- And fine-tune on any small ISLR dataset
- All Training and Inference is completely config-based
- No-code required
- Check for example configs:
- Supports 6 sign languages out-of-the-box
- Check for supported datasets:

Future Plan
-----------

- [ ] Add more sign langauges
- [ ] Explore more SoTA models
- [ ] Support for sign language detection
- [ ] Support for continuous sign langauge recognition (CSLR)
6 changes: 3 additions & 3 deletions docs/instructions/self_supervised.rst
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Self-supervised Learning
Self-Supervised Learning
========================

This section is dedicated to explaining how to perform pre-training and fine-tuning using any required datasets for ISLR.
Expand All @@ -18,8 +18,8 @@ HDF5 format
Generating HDF5 datasets
^^^^^^^^^^^^^^^^^^^^^^^^

- See `this script <https://github.com/AI4Bharat/OpenHands/blob/main/scripts/mediapipe_extract.py>`_ to extract pose for all the given videos using MediaPipe Holistic
- See `this script <https://github.com/AI4Bharat/OpenHands/blob/main/scripts/pkl_to_h5.py>`_ to convert all the above individual pose files (in ``.pkl``) to HDF5 format.
- `See this script <https://github.com/AI4Bharat/OpenHands/blob/main/scripts/mediapipe_extract.py>`_ to extract pose for all the given videos using MediaPipe Holistic
- Use `this script <https://github.com/AI4Bharat/OpenHands/blob/main/scripts/pkl_to_h5.py>`_ to convert all the above individual pose files (in ``.pkl``) to HDF5 format.

Download datasets
^^^^^^^^^^^^^^^^^
Expand Down
12 changes: 4 additions & 8 deletions docs/instructions/support.rst
Original file line number Diff line number Diff line change
@@ -1,14 +1,10 @@
Support
=======

👐OpenHands is developed by AI4Bharat, an non-profit organization based out of IIT-Madras.
👐OpenHands is developed by AI4Bharat, a non-profit organization based out of IIT-Madras in India.

For contributions, feedback or bug reports, please create an issue here: `GitHub Issues <https://github.com/AI4Bharat/OpenHands/issues>`_.

Future Plan
-----------

- [ ] Add more sign langauges
- [ ] Explore more SoTA models
- [ ] Support for sign language detection
- [ ] Support for continuous sign langauge recognition (CSLR)
- Primary developers:
- Gokul NC (gokulnc at ai4bharat dot org)
- Prem Kumar SelvaRaj (prem at ai4bharat dot org)
3 changes: 3 additions & 0 deletions docs/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
sphinx
myst-parser
sphinx_rtd_theme
4 changes: 4 additions & 0 deletions openhands/apis/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1,5 @@
from .classification_model import ClassificationModel
from .dpc import PretrainingModelDPC
from .inference import InferenceModel

__all__ = ["ClassificationModel", "PretrainingModelDPC", "InferenceModel"]
4 changes: 2 additions & 2 deletions openhands/apis/classification_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
import torch.nn.functional as F
import torchmetrics
from ..models.loader import get_model
from .losses import CrossEntropyLoss, SmoothedCrossEntropyLoss
from .data import DataModule
from ..core.losses import CrossEntropyLoss, SmoothedCrossEntropyLoss
from ..core.data import DataModule
from .inference import InferenceModel

class ClassificationModel(InferenceModel):
Expand Down
2 changes: 1 addition & 1 deletion openhands/apis/inference.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from tqdm import tqdm
import time

from .data import DataModule
from ..core.data import DataModule
from ..models.loader import get_model

class InferenceModel(pl.LightningModule):
Expand Down
4 changes: 2 additions & 2 deletions openhands/core/exp_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ def experiment_manager(trainer, cfg=None):
if cfg is None:
return

trainer._default_root_dir = os.getcwd()
# trainer._default_root_dir = cfg.output_path if cfg.output_path else os.getcwd()
if cfg.create_tensorboard_logger or cfg.create_wandb_logger:
configure_loggers(
trainer,
Expand Down Expand Up @@ -66,7 +66,7 @@ def configure_checkpointing(trainer, cfg):
"""
Creates ModelCheckpoint callback and and attach it to the trainer.
"""
checkpoint_callback = ModelCheckpoint(**cfg, dirpath=trainer._default_root_dir)
checkpoint_callback = ModelCheckpoint(**cfg)#, dirpath=trainer._default_root_dir)
trainer.callbacks.append(checkpoint_callback)


Expand Down
2 changes: 2 additions & 0 deletions openhands/datasets/isolated/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,5 @@
from .include import INCLUDEDataset
from .lsa64 import LSA64Dataset
from .wlasl import WLASLDataset

__all__ = ["AUTSLDataset", "CSLDataset", "DeviSignDataset", "GSLDataset", "INCLUDEDataset", "LSA64Dataset", "WLASLDataset"]
5 changes: 5 additions & 0 deletions openhands/models/decoder/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
from .fc import FC as FullyConnectedClassifier
from .rnn import RNNClassifier
from .bert_hf import BERT

__all__ = ["FullyConnectedClassifier", "RNNClassifier", "BERT"]
5 changes: 5 additions & 0 deletions openhands/models/encoder/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
from .graph.pose_flattener import PoseFlattener
from .graph.decoupled_gcn import DecoupledGCN
from .graph.st_gcn import STGCN

__all__ = ["PoseFlattener", "DecoupledGCN", "STGCN"]
2 changes: 1 addition & 1 deletion openhands/models/loader.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ def load_ssl_backbone(cfg, in_channels, num_class):
raise ValueError(f"SSL Type '{cfg.type}' not supported.")

def get_model(config, in_channels, num_class):
if config.pretrained:
if "pretrained" in config:
# Load self-supervised backbone
return load_ssl_backbone(config.pretrained, in_channels, num_class)

Expand Down

0 comments on commit fc4599d

Please sign in to comment.