LungDamageDetectionCLI


NameLungDamageDetectionCLI JSON
Version 1.0.0 PyPI version JSON
download
home_pageNone
SummaryCLI application for training and inferring lung injury detection model
upload_time2024-06-28 10:52:51
maintainerNone
docs_urlNone
authorNone
requires_python==3.10.*
licenseMIT License Copyright (c) 2024 mtuci.ru Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
keywords detection lung injuries dicom unet pytorch torch cli computer vision medicine covid-19
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # LUNG INJURY DETECTION CLI APP

___

This repository provides source code of CLI app for training and inferring lung injury detection model. The model is based on U-Net architecture implemented with pytorch framework for python. 

## INSTALLATION

___

<u>The project depends on python ==3.10.*</u>

Install from PyPI:
```shell
pip install LungDamageDetectionCLI
```
Install from repo:
```shell
git clone <repo-name> && cd <project-dir>
pdm install
```

## DEVELOPMENT AND USE

___

Run CLI app from project dir
```shell
pdm run ldd-cli SUBCOMMAND
```

This app supports these subcommands:
* train - run model training
* test - run model test
* inference - detect injuries

You may copy .env.example and rename it into .env

<b>Environment Variables</b>

    PATH_TO_DATA=  # directory containing dataset 
    DCM_DIR=  # directory inside PATH_TO_DATA containing dcm files
    PNG_DIR=  # directory inside PATH_TO_DATA containing png files
    TRAIN_SET=  # number of images for model training
    TEST_SET=  # number of images for model test
    VAL_SET=  # number of images for model validation
    EPOCHS=  # number of training epochs
    LR=  # learning rate
    BATCH_SIZE=  # size of batch
    IMG_SIZE=512 # width and height of images in dataset
    BACKBONE=resnet101 # name of backbone model
    SAVE_PATH=  # path of trained model state dict
    OUT_PATH=  # directory to save inference results
    INPUT_PATH=  # dcm file or directory of dcm files for model inference
    USE_AUGMENTATION=false # dataset is loaded with augmentation if true
    SEED=5 # seed for numpy.random.seed

or pass desired values through command line args (names of args are case insensitive).

Supported backbone names:
* resnet18
* resnet34
* resnet50
* resnet101 
* resnet152
* vgg16
* vgg19
* densenet121
* densenet161
* densenet169
* densenet201

All code is placed in src directory.

To train model place .dcm files of CT of lungs in PATH_TO_DATA/DCM_DIR and .png masks in PATH_TO_DATA/PNG_DIR then set TRAIN_SET, VAL_SET and TEST_SET variables according to your dataset size. App saves state dict of model every epoch. If SAVE_PATH file exists model will be loaded using it when the app is restarted.

If USE_AUGMENTATION is true some images will be rotated, cropped and flipped.

After model test trained model metrics are printed.

<b>Metrics</b>
- precision
- recall
- f1 score
- jaccard coefficient
- dice coefficient

To inference model you have to provide path of dcm file or path of directory with several dcm files into INPUT_PATH.

Result png files are placed in OUTPUT_PATH. Png files have same name as dcms.

## LICENSE

___

Lung injury detection CLI app is [MIT licensed](LICENSE)

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "LungDamageDetectionCLI",
    "maintainer": null,
    "docs_url": null,
    "requires_python": "==3.10.*",
    "maintainer_email": null,
    "keywords": "detection, lung injuries, dicom, unet, pytorch, torch, cli, computer vision, medicine, covid-19",
    "author": null,
    "author_email": "grottI0 <chernega.bk@gmail.com>",
    "download_url": "https://files.pythonhosted.org/packages/a7/58/5eea199a14fca2f19c3587adbece680d68e742168f1ff7e111dc26c07891/lungdamagedetectioncli-1.0.0.tar.gz",
    "platform": null,
    "description": "# LUNG INJURY DETECTION CLI APP\n\n___\n\nThis repository provides source code of CLI app for training and inferring lung injury detection model. The model is based on U-Net architecture implemented with pytorch framework for python. \n\n## INSTALLATION\n\n___\n\n<u>The project depends on python ==3.10.*</u>\n\nInstall from PyPI:\n```shell\npip install LungDamageDetectionCLI\n```\nInstall from repo:\n```shell\ngit clone <repo-name> && cd <project-dir>\npdm install\n```\n\n## DEVELOPMENT AND USE\n\n___\n\nRun CLI app from project dir\n```shell\npdm run ldd-cli SUBCOMMAND\n```\n\nThis app supports these subcommands:\n* train - run model training\n* test - run model test\n* inference - detect injuries\n\nYou may copy .env.example and rename it into .env\n\n<b>Environment Variables</b>\n\n    PATH_TO_DATA=  # directory containing dataset \n    DCM_DIR=  # directory inside PATH_TO_DATA containing dcm files\n    PNG_DIR=  # directory inside PATH_TO_DATA containing png files\n    TRAIN_SET=  # number of images for model training\n    TEST_SET=  # number of images for model test\n    VAL_SET=  # number of images for model validation\n    EPOCHS=  # number of training epochs\n    LR=  # learning rate\n    BATCH_SIZE=  # size of batch\n    IMG_SIZE=512 # width and height of images in dataset\n    BACKBONE=resnet101 # name of backbone model\n    SAVE_PATH=  # path of trained model state dict\n    OUT_PATH=  # directory to save inference results\n    INPUT_PATH=  # dcm file or directory of dcm files for model inference\n    USE_AUGMENTATION=false # dataset is loaded with augmentation if true\n    SEED=5 # seed for numpy.random.seed\n\nor pass desired values through command line args (names of args are case insensitive).\n\nSupported backbone names:\n* resnet18\n* resnet34\n* resnet50\n* resnet101 \n* resnet152\n* vgg16\n* vgg19\n* densenet121\n* densenet161\n* densenet169\n* densenet201\n\nAll code is placed in src directory.\n\nTo train model place .dcm files of CT of lungs in PATH_TO_DATA/DCM_DIR and .png masks in PATH_TO_DATA/PNG_DIR then set TRAIN_SET, VAL_SET and TEST_SET variables according to your dataset size. App saves state dict of model every epoch. If SAVE_PATH file exists model will be loaded using it when the app is restarted.\n\nIf USE_AUGMENTATION is true some images will be rotated, cropped and flipped.\n\nAfter model test trained model metrics are printed.\n\n<b>Metrics</b>\n- precision\n- recall\n- f1 score\n- jaccard coefficient\n- dice coefficient\n\nTo inference model you have to provide path of dcm file or path of directory with several dcm files into INPUT_PATH.\n\nResult png files are placed in OUTPUT_PATH. Png files have same name as dcms.\n\n## LICENSE\n\n___\n\nLung injury detection CLI app is [MIT licensed](LICENSE)\n",
    "bugtrack_url": null,
    "license": "MIT License\n        \n        Copyright (c) 2024 mtuci.ru\n        \n        Permission is hereby granted, free of charge, to any person obtaining a copy\n        of this software and associated documentation files (the \"Software\"), to deal\n        in the Software without restriction, including without limitation the rights\n        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n        copies of the Software, and to permit persons to whom the Software is\n        furnished to do so, subject to the following conditions:\n        \n        The above copyright notice and this permission notice shall be included in all\n        copies or substantial portions of the Software.\n        \n        THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n        SOFTWARE.",
    "summary": "CLI application for training and inferring lung injury detection model",
    "version": "1.0.0",
    "project_urls": {
        "Homepage": "https://github.com/mtuciru/Lung-Damage-Detection-CLI",
        "Repository": "https://github.com/mtuciru/Lung-Damage-Detection-CLI.git"
    },
    "split_keywords": [
        "detection",
        " lung injuries",
        " dicom",
        " unet",
        " pytorch",
        " torch",
        " cli",
        " computer vision",
        " medicine",
        " covid-19"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "8e794ed5eb6890d5eeec16ad60294b49006b1f5236879c9c102195717d9ac968",
                "md5": "791ca35ed32e0048cf9eee2816d7da8e",
                "sha256": "17a50cf5941fb013076e231ce693d2b19967a13a783d28429629acb2b93958bc"
            },
            "downloads": -1,
            "filename": "lungdamagedetectioncli-1.0.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "791ca35ed32e0048cf9eee2816d7da8e",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "==3.10.*",
            "size": 13019,
            "upload_time": "2024-06-28T10:52:49",
            "upload_time_iso_8601": "2024-06-28T10:52:49.291062Z",
            "url": "https://files.pythonhosted.org/packages/8e/79/4ed5eb6890d5eeec16ad60294b49006b1f5236879c9c102195717d9ac968/lungdamagedetectioncli-1.0.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "a7585eea199a14fca2f19c3587adbece680d68e742168f1ff7e111dc26c07891",
                "md5": "817c1a9215a85986e7fd95f214447560",
                "sha256": "3ce2f9e9487c83fc7c70f9213067b90512d7b27eb932e52537e9447945600118"
            },
            "downloads": -1,
            "filename": "lungdamagedetectioncli-1.0.0.tar.gz",
            "has_sig": false,
            "md5_digest": "817c1a9215a85986e7fd95f214447560",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "==3.10.*",
            "size": 12155,
            "upload_time": "2024-06-28T10:52:51",
            "upload_time_iso_8601": "2024-06-28T10:52:51.400470Z",
            "url": "https://files.pythonhosted.org/packages/a7/58/5eea199a14fca2f19c3587adbece680d68e742168f1ff7e111dc26c07891/lungdamagedetectioncli-1.0.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-06-28 10:52:51",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "mtuciru",
    "github_project": "Lung-Damage-Detection-CLI",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "lungdamagedetectioncli"
}
        
Elapsed time: 0.28829s