torchmetrics-ext


Nametorchmetrics-ext JSON
Version 0.2.1 PyPI version JSON
download
home_pagehttps://github.com/eamonn-zh/torchmetrics_ext
SummaryAn extension of torchmetrics package.
upload_time2024-10-17 22:06:03
maintainerNone
docs_urlNone
authorYiming Zhang
requires_python>=3.8
licenseNone
keywords deep learning machine learning pytorch metrics
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # TorchMetrics Extension
[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/torchmetrics)](https://pypi.org/project/torchmetrics-ext/)
[![PyPI version](https://badge.fury.io/py/torchmetrics-ext.svg)](https://badge.fury.io/py/torchmetrics-ext)
[![license](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://github.com/eamonn-zh/torchmetrics_ext/blob/master/LICENSE)

## Installation
Simple installation from PyPI
```bash
pip install torchmetrics-ext
```

## What is TorchMetrics Extension
It is an extension of [torchmetrics](https://lightning.ai/docs/torchmetrics/) containing more metrics for machine learning tasks. Currently, it offers metrics for:
- 3D Visual Grounding
  - [ScanRefer](https://daveredrum.github.io/ScanRefer/)
  - [ReferIt3D](https://referit3d.github.io/)

## Using TorchMetrics Extension
Here are examples for using the metrics in TorchMetrics Extension:

### ScanRefer
It measures the thresholded accuracy Acc@kIoU, where the positive predictions have higher intersection over union (IoU) with the ground truths than the thresholds. The metric is based on the [ScanRefer](https://daveredrum.github.io/ScanRefer/).
```python
import torch
from torchmetrics_ext.visual_grounding import ScanReferMetric
metric = ScanReferMetric()

# min max bounds of 3D axis-aligned bounding boxes (B, 2, 3)
pred_aabbs = torch.tensor([[[0., 0., 0.], [1., 1., 1.]], [[0., 0., 0.], [2., 2., 2.]]], dtype=torch.float32)
gt_aabbs = torch.tensor([[[0., 0., 0.], [1., 1., 1.]], [[0., 0., 0.], [1.5, 1.5, 1.5]]], dtype=torch.float32)

gt_eval_types = ("unique", "multiple")
results = metric(pred_aabbs, gt_aabbs, gt_eval_types)
```

### ReferIt3D
It measures the accuracy of selecting the target object from the candidates. The metric is based on the [ReferIt3D](https://referit3d.github.io/).
```python
import torch
from torchmetrics_ext.visual_grounding import ReferIt3DMetric
metric = ReferIt3DMetric()

# indices of predicted and ground truth objects (B, )
pred_indices = torch.tensor([5, 2, 0, 0], dtype=torch.uint8)
gt_indices = torch.tensor([5, 5, 1, 0], dtype=torch.uint8)

gt_eval_types = (("easy", "view_dep"), ("easy", "view_indep"), ("hard", "view_dep"), ("hard", "view_dep"))
results = metric(pred_indices, gt_indices, gt_eval_types)
```

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/eamonn-zh/torchmetrics_ext",
    "name": "torchmetrics-ext",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": null,
    "keywords": "deep learning, machine learning, pytorch, metrics",
    "author": "Yiming Zhang",
    "author_email": null,
    "download_url": "https://files.pythonhosted.org/packages/90/d5/7f2bcecd4a4bcbfa36ef93ed13c419442de4836ab36c4c257fa68cbb77dc/torchmetrics_ext-0.2.1.tar.gz",
    "platform": null,
    "description": "# TorchMetrics Extension\n[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/torchmetrics)](https://pypi.org/project/torchmetrics-ext/)\n[![PyPI version](https://badge.fury.io/py/torchmetrics-ext.svg)](https://badge.fury.io/py/torchmetrics-ext)\n[![license](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://github.com/eamonn-zh/torchmetrics_ext/blob/master/LICENSE)\n\n## Installation\nSimple installation from PyPI\n```bash\npip install torchmetrics-ext\n```\n\n## What is TorchMetrics Extension\nIt is an extension of [torchmetrics](https://lightning.ai/docs/torchmetrics/) containing more metrics for machine learning tasks. Currently, it offers metrics for:\n- 3D Visual Grounding\n  - [ScanRefer](https://daveredrum.github.io/ScanRefer/)\n  - [ReferIt3D](https://referit3d.github.io/)\n\n## Using TorchMetrics Extension\nHere are examples for using the metrics in TorchMetrics Extension:\n\n### ScanRefer\nIt measures the thresholded accuracy Acc@kIoU, where the positive predictions have higher intersection over union (IoU) with the ground truths than the thresholds. The metric is based on the [ScanRefer](https://daveredrum.github.io/ScanRefer/).\n```python\nimport torch\nfrom torchmetrics_ext.visual_grounding import ScanReferMetric\nmetric = ScanReferMetric()\n\n# min max bounds of 3D axis-aligned bounding boxes (B, 2, 3)\npred_aabbs = torch.tensor([[[0., 0., 0.], [1., 1., 1.]], [[0., 0., 0.], [2., 2., 2.]]], dtype=torch.float32)\ngt_aabbs = torch.tensor([[[0., 0., 0.], [1., 1., 1.]], [[0., 0., 0.], [1.5, 1.5, 1.5]]], dtype=torch.float32)\n\ngt_eval_types = (\"unique\", \"multiple\")\nresults = metric(pred_aabbs, gt_aabbs, gt_eval_types)\n```\n\n### ReferIt3D\nIt measures the accuracy of selecting the target object from the candidates. The metric is based on the [ReferIt3D](https://referit3d.github.io/).\n```python\nimport torch\nfrom torchmetrics_ext.visual_grounding import ReferIt3DMetric\nmetric = ReferIt3DMetric()\n\n# indices of predicted and ground truth objects (B, )\npred_indices = torch.tensor([5, 2, 0, 0], dtype=torch.uint8)\ngt_indices = torch.tensor([5, 5, 1, 0], dtype=torch.uint8)\n\ngt_eval_types = ((\"easy\", \"view_dep\"), (\"easy\", \"view_indep\"), (\"hard\", \"view_dep\"), (\"hard\", \"view_dep\"))\nresults = metric(pred_indices, gt_indices, gt_eval_types)\n```\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "An extension of torchmetrics package.",
    "version": "0.2.1",
    "project_urls": {
        "Homepage": "https://github.com/eamonn-zh/torchmetrics_ext"
    },
    "split_keywords": [
        "deep learning",
        " machine learning",
        " pytorch",
        " metrics"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "d006ffad332238162fb31042c4d1a75dbe7a280e8bf14d94f920b6ff921afb36",
                "md5": "46794c59570b946acabc84a314b536ac",
                "sha256": "34fdf592d34d655a49d66bf34a87ff6f7e607e95788e61da0a3cacb56b0e4031"
            },
            "downloads": -1,
            "filename": "torchmetrics_ext-0.2.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "46794c59570b946acabc84a314b536ac",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 12844,
            "upload_time": "2024-10-17T22:06:02",
            "upload_time_iso_8601": "2024-10-17T22:06:02.394434Z",
            "url": "https://files.pythonhosted.org/packages/d0/06/ffad332238162fb31042c4d1a75dbe7a280e8bf14d94f920b6ff921afb36/torchmetrics_ext-0.2.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "90d57f2bcecd4a4bcbfa36ef93ed13c419442de4836ab36c4c257fa68cbb77dc",
                "md5": "3199f112656b049d2620d0903e6f0c90",
                "sha256": "04486dc30b2037074e797c2ce046cb3487dfd671fad1647bbc95173ae974cd50"
            },
            "downloads": -1,
            "filename": "torchmetrics_ext-0.2.1.tar.gz",
            "has_sig": false,
            "md5_digest": "3199f112656b049d2620d0903e6f0c90",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 11112,
            "upload_time": "2024-10-17T22:06:03",
            "upload_time_iso_8601": "2024-10-17T22:06:03.675297Z",
            "url": "https://files.pythonhosted.org/packages/90/d5/7f2bcecd4a4bcbfa36ef93ed13c419442de4836ab36c4c257fa68cbb77dc/torchmetrics_ext-0.2.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-10-17 22:06:03",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "eamonn-zh",
    "github_project": "torchmetrics_ext",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "torchmetrics-ext"
}
        
Elapsed time: 0.35935s