torchood


Nametorchood JSON
Version 0.0.1 PyPI version JSON
download
home_pageNone
Summaryimplement of local laplace filter algorithm
upload_time2024-12-16 11:01:36
maintainerNone
docs_urlNone
authorNone
requires_python>=3.10
licenseApache 2.0
keywords pytorch ood out of distribution out-of-distribution classification
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            
<center>

![](https://kirigaya.cn/files/images/bird.png)


[[torchood](https://github.com/LSTM-Kirigaya/torchood)]: pytorch implementation for universal out of distribution methods

```bash
pip install torchood
```

</center>

## Support Methods

| Support Methods | Source |
|:---|:---|
| Robust Classification with Convolutional Prototype Learning (Prototype Networks) | [CVPR 2018: Rbust classification with convolutional prototype learning](https://arxiv.org/pdf/1805.03438) |
| Predictive Uncertainty Estimation via Prior Networks(Prior Networks) | [NeurIPS 2018: Predictive Uncertainty Estimation via Prior Networks]() |
| Evidential Deep Learning to Quantify Classification Uncertainty (EDL) | [NeurIPS 2018: Evidential Deep Learning to Quantify Classification Uncertainty](https://papers.nips.cc/paper/2018/hash/a981f2b708044d6fb4a71a1463242520-Abstract.html) |
| Posterior Network (PostNet) | [NeurIPS 2020: Posterior Network: Uncertainty Estimation without OOD Samples via Density-Based Pseudo-Counts]() |
| Evidential Neural Network (ENN) | [NeurIPS 2018: Evidential Deep Learning to Quantify Classification Uncertainty](https://arxiv.org/pdf/1806.01768) |
| Evidence Reconciled Neural Network(ERNN) | [MICCAI 2023: Evidence Reconciled Neural Network for Out-of-Distribution Detection in Medical Images](https://conferences.miccai.org/2023/papers/249-Paper2401.html) |
| Redundancy Removing Evidential Neural Network(R2ENN) | - |

---

## Usage

```bash
pip install torchood
```

```python
import torchood

class UserDefineModel(nn.Module):
    ...

classifier = UserDefineModel(...)
classifier = torchood.EvidenceNeuralNetwork(classifier)
```

### Train

```python
for data, label in train_loader:
    # transform data & label to correct device
    # ...

    _, evidence, _ = classifier(data)
    loss = classifier.criterion(evidence, label)

    optimizer.zero_grad()
    loss.backward()
    optimizer.step()
```

### Infer

```python
prob, uncertainty = classifier.predict(inputs)
```

![](./images/robot.png)

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "torchood",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.10",
    "maintainer_email": null,
    "keywords": "Pytorch, ood, out of distribution, out-of-distribution, classification",
    "author": null,
    "author_email": "lstm-kirigaya <1193466151@qq.com>",
    "download_url": "https://files.pythonhosted.org/packages/06/7a/dc31ca4fb7344d0882e5e9b14f516122fbc8f50de6ed2f789e36619384f1/torchood-0.0.1.tar.gz",
    "platform": null,
    "description": "\n<center>\n\n![](https://kirigaya.cn/files/images/bird.png)\n\n\n[[torchood](https://github.com/LSTM-Kirigaya/torchood)]: pytorch implementation for universal out of distribution methods\n\n```bash\npip install torchood\n```\n\n</center>\n\n## Support Methods\n\n| Support Methods | Source |\n|:---|:---|\n| Robust Classification with Convolutional Prototype Learning (Prototype Networks) | [CVPR 2018: Rbust classification with convolutional prototype learning](https://arxiv.org/pdf/1805.03438) |\n| Predictive Uncertainty Estimation via Prior Networks(Prior Networks) | [NeurIPS 2018: Predictive Uncertainty Estimation via Prior Networks]() |\n| Evidential Deep Learning to Quantify Classification Uncertainty (EDL) | [NeurIPS 2018: Evidential Deep Learning to Quantify Classification Uncertainty](https://papers.nips.cc/paper/2018/hash/a981f2b708044d6fb4a71a1463242520-Abstract.html) |\n| Posterior Network (PostNet) | [NeurIPS 2020: Posterior Network: Uncertainty Estimation without OOD Samples via Density-Based Pseudo-Counts]() |\n| Evidential Neural Network (ENN) | [NeurIPS 2018: Evidential Deep Learning to Quantify Classification Uncertainty](https://arxiv.org/pdf/1806.01768) |\n| Evidence Reconciled Neural Network(ERNN) | [MICCAI 2023: Evidence Reconciled Neural Network for Out-of-Distribution Detection in Medical Images](https://conferences.miccai.org/2023/papers/249-Paper2401.html) |\n| Redundancy Removing Evidential Neural Network(R2ENN) | - |\n\n---\n\n## Usage\n\n```bash\npip install torchood\n```\n\n```python\nimport torchood\n\nclass UserDefineModel(nn.Module):\n    ...\n\nclassifier = UserDefineModel(...)\nclassifier = torchood.EvidenceNeuralNetwork(classifier)\n```\n\n### Train\n\n```python\nfor data, label in train_loader:\n    # transform data & label to correct device\n    # ...\n\n    _, evidence, _ = classifier(data)\n    loss = classifier.criterion(evidence, label)\n\n    optimizer.zero_grad()\n    loss.backward()\n    optimizer.step()\n```\n\n### Infer\n\n```python\nprob, uncertainty = classifier.predict(inputs)\n```\n\n![](./images/robot.png)\n",
    "bugtrack_url": null,
    "license": "Apache 2.0",
    "summary": "implement of local laplace filter algorithm",
    "version": "0.0.1",
    "project_urls": {
        "text": "https://github.com/LSTM-Kirigaya"
    },
    "split_keywords": [
        "pytorch",
        " ood",
        " out of distribution",
        " out-of-distribution",
        " classification"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "cf3574d0c976886aa16f011313e43c3cad6cb06254eadfb69a10b7e98cdf32fb",
                "md5": "872a3028586954b8c0a796bcf83355f9",
                "sha256": "6e6ef8068eb38f9887aa60599c1472fce0533f5cd6db5c9694329ccdf2f8f32e"
            },
            "downloads": -1,
            "filename": "torchood-0.0.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "872a3028586954b8c0a796bcf83355f9",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.10",
            "size": 8188,
            "upload_time": "2024-12-16T11:01:33",
            "upload_time_iso_8601": "2024-12-16T11:01:33.498675Z",
            "url": "https://files.pythonhosted.org/packages/cf/35/74d0c976886aa16f011313e43c3cad6cb06254eadfb69a10b7e98cdf32fb/torchood-0.0.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "067adc31ca4fb7344d0882e5e9b14f516122fbc8f50de6ed2f789e36619384f1",
                "md5": "0813a1b5082a54cc84aaec03565a157f",
                "sha256": "2b254a7cb001bb822eff11d5e2fc0512a5e665b17db2a283493cc188b02be1ff"
            },
            "downloads": -1,
            "filename": "torchood-0.0.1.tar.gz",
            "has_sig": false,
            "md5_digest": "0813a1b5082a54cc84aaec03565a157f",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.10",
            "size": 7632,
            "upload_time": "2024-12-16T11:01:36",
            "upload_time_iso_8601": "2024-12-16T11:01:36.407823Z",
            "url": "https://files.pythonhosted.org/packages/06/7a/dc31ca4fb7344d0882e5e9b14f516122fbc8f50de6ed2f789e36619384f1/torchood-0.0.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-12-16 11:01:36",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "torchood"
}
        
Elapsed time: 0.39022s