customVOC


NamecustomVOC JSON
Version 0.0.1 PyPI version JSON
download
home_pagehttps://github.com/aljbri/customPascalVOC
SummaryCustom Pascal VOC Dataset reader for PyTorch
upload_time2024-01-25 00:49:28
maintainer
docs_urlNone
authorAljbri Abdussalam
requires_python>=3.6
license
keywords pascal voc voc dataset loader dataset reader
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Custom Pascal VOC PyTorch Module
This PyTorch module serves as a flexible  dataset reader for custom datasets created using the Pascal VOC format. It is a modified version of the original [Pascal VOC dataset reader](https://github.com/anthony-cabacungan/vision/blob/main/torchvision/datasets/voc.py) provided by PyTorch's *torchvision* package. The primary enhancement is the removal of folder structure restrictions, allowing users to read datasets organized in any manner while still leveraging the Pascal VOC annotation structure.

# Classes

The module includes two classes: `VOCDetection` and `VOCSegmentation`.

## **VOCDetection** : 
This class is designed for reading datasets following [Pascal VOC](http://host.robots.ox.ac.uk/pascal/VOC/) Detection format. 

```Python
VOCDetection(root: str, image_set: str = 'train', transform: Optional[Callable] = None, 
             target_transform: Optional[Callable] = None, transforms: Optional[Callable] = None)
```
**Parameters:**
* **root** (string): Root directory of the VOC Dataset.
* **image_set** (string, optional): Select the image_set to use, ``"train"``, ``"val"`` or ``"test"``.
* **transform** (callable, optional): A function/transform that takes in a PIL image and returns a transformed version. E.g, ``transforms.RandomCrop``.
* **target_transform** (callable, required): A function/transform that takes in the target and transforms it.
* **transforms** (callable, optional): A function/transform that takes input sample and its target as entry and returns a transformed version.

## **VOCSegmentation** 
This class is tailored for reading datasets structured in the [Pascal VOC](http://host.robots.ox.ac.uk/pascal/VOC/) Segmentation format.

```Python
VOCSegmentation(root: str, image_set: str = 'train', transform: Optional[Callable] = None,
                target_transform: Optional[Callable] = None, transforms: Optional[Callable] = None)
```
**Parameters:**
* root (string): Root directory of the VOC Dataset.
* image_set (string, optional): Select the image_set to use, ``"train"``, ``"val"`` or ``"test"``.
* transform (callable, optional): A function/transform that  takes in a PIL image and returns a transformed version. E.g, ``transforms.RandomCrop``.
* target_transform (callable, optional): A function/transform that takes in the target and transforms it.
* transforms (callable, optional): A function/transform that takes input sample and its target as entry and returns a transformed version.


# Installing

You can install the package from [pypi](https://pypi.org/project/customVOC) using the following code:

    pip install --update customVOC

# Using customVOC

After installing the module, you can import either of the two classes: 'VOCDetection' and 'VOCSegmentation'.

```Python
from customVOC import VOCDetection
from customVOC import VOCSegmentation
```
Once imported, you can use these classes similarly to the ones from the torchvision package, without passing the year. When initializing, provide the root folder containing the dataset with one of the following subfolders: ``"train"``, ``"val"``, or ``"test"`` depending on the dataset portion you are using.

---
The following example loads the training dataset and converts the image to a tensor using ``ToTensor()``:
```Python
from customVOC import VOCDetection
from torchvision.transforms import ToTensor
from torch.utils.data import DataLoader

# Create an instance of VOCDetection dataset.
voc_dataset = VOCDetection(root="datset_path",image_set="train", transform=ToTensor())

# Create a DataLoader for the VOCDetection dataset.
data_loader = DataLoader(voc_dataset, batch_size=4, shuffle=True, collate_fn=lambda batch: tuple(zip(*batch)))
```
> [!TIP]
>  *The collate function is used to customize how batches are created from individual samples in the dataset.*
---
> [!NOTE]  
> * The package is an absolute copy of the original code, with modifications to the way of reading image and annotation files locations.
> * The images and annotations files should be stored in the same folder, either train, val, or test, depending on what part of the dataset you have.
> * Only ***VOCDetection*** has been tested on reading datasets.

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/aljbri/customPascalVOC",
    "name": "customVOC",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.6",
    "maintainer_email": "",
    "keywords": "Pascal VOC,VOC,Dataset loader,Dataset reader",
    "author": "Aljbri Abdussalam",
    "author_email": "Aljbri Abdussalam <mr.aljbri@gmail.com>",
    "download_url": "https://files.pythonhosted.org/packages/49/e7/0f911dc31b2ef280777f41b16b021580a99f78b64f78b3d5a78170147dd2/customVOC-0.0.1.tar.gz",
    "platform": null,
    "description": "# Custom Pascal VOC PyTorch Module\r\nThis PyTorch module serves as a flexible  dataset reader for custom datasets created using the Pascal VOC format. It is a modified version of the original [Pascal VOC dataset reader](https://github.com/anthony-cabacungan/vision/blob/main/torchvision/datasets/voc.py) provided by PyTorch's *torchvision* package. The primary enhancement is the removal of folder structure restrictions, allowing users to read datasets organized in any manner while still leveraging the Pascal VOC annotation structure.\r\n\r\n# Classes\r\n\r\nThe module includes two classes: `VOCDetection` and `VOCSegmentation`.\r\n\r\n## **VOCDetection** : \r\nThis class is designed for reading datasets following [Pascal VOC](http://host.robots.ox.ac.uk/pascal/VOC/) Detection format. \r\n\r\n```Python\r\nVOCDetection(root: str, image_set: str = 'train', transform: Optional[Callable] = None, \r\n             target_transform: Optional[Callable] = None, transforms: Optional[Callable] = None)\r\n```\r\n**Parameters:**\r\n* **root** (string): Root directory of the VOC Dataset.\r\n* **image_set** (string, optional): Select the image_set to use, ``\"train\"``, ``\"val\"`` or ``\"test\"``.\r\n* **transform** (callable, optional): A function/transform that takes in a PIL image and returns a transformed version. E.g, ``transforms.RandomCrop``.\r\n* **target_transform** (callable, required): A function/transform that takes in the target and transforms it.\r\n* **transforms** (callable, optional): A function/transform that takes input sample and its target as entry and returns a transformed version.\r\n\r\n## **VOCSegmentation** \r\nThis class is tailored for reading datasets structured in the [Pascal VOC](http://host.robots.ox.ac.uk/pascal/VOC/) Segmentation format.\r\n\r\n```Python\r\nVOCSegmentation(root: str, image_set: str = 'train', transform: Optional[Callable] = None,\r\n                target_transform: Optional[Callable] = None, transforms: Optional[Callable] = None)\r\n```\r\n**Parameters:**\r\n* root (string): Root directory of the VOC Dataset.\r\n* image_set (string, optional): Select the image_set to use, ``\"train\"``, ``\"val\"`` or ``\"test\"``.\r\n* transform (callable, optional): A function/transform that  takes in a PIL image and returns a transformed version. E.g, ``transforms.RandomCrop``.\r\n* target_transform (callable, optional): A function/transform that takes in the target and transforms it.\r\n* transforms (callable, optional): A function/transform that takes input sample and its target as entry and returns a transformed version.\r\n\r\n\r\n# Installing\r\n\r\nYou can install the package from [pypi](https://pypi.org/project/customVOC) using the following code:\r\n\r\n    pip install --update customVOC\r\n\r\n# Using customVOC\r\n\r\nAfter installing the module, you can import either of the two classes: 'VOCDetection' and 'VOCSegmentation'.\r\n\r\n```Python\r\nfrom customVOC import VOCDetection\r\nfrom customVOC import VOCSegmentation\r\n```\r\nOnce imported, you can use these classes similarly to the ones from the torchvision package, without passing the year. When initializing, provide the root folder containing the dataset with one of the following subfolders: ``\"train\"``, ``\"val\"``, or ``\"test\"`` depending on the dataset portion you are using.\r\n\r\n---\r\nThe following example loads the training dataset and converts the image to a tensor using ``ToTensor()``:\r\n```Python\r\nfrom customVOC import VOCDetection\r\nfrom torchvision.transforms import ToTensor\r\nfrom torch.utils.data import DataLoader\r\n\r\n# Create an instance of VOCDetection dataset.\r\nvoc_dataset = VOCDetection(root=\"datset_path\",image_set=\"train\", transform=ToTensor())\r\n\r\n# Create a DataLoader for the VOCDetection dataset.\r\ndata_loader = DataLoader(voc_dataset, batch_size=4, shuffle=True, collate_fn=lambda batch: tuple(zip(*batch)))\r\n```\r\n> [!TIP]\r\n>  *The collate function is used to customize how batches are created from individual samples in the dataset.*\r\n---\r\n> [!NOTE]  \r\n> * The package is an absolute copy of the original code, with modifications to the way of reading image and annotation files locations.\r\n> * The images and annotations files should be stored in the same folder, either train, val, or test, depending on what part of the dataset you have.\r\n> * Only ***VOCDetection*** has been tested on reading datasets.\r\n",
    "bugtrack_url": null,
    "license": "",
    "summary": "Custom Pascal VOC Dataset reader for PyTorch",
    "version": "0.0.1",
    "project_urls": {
        "Homepage": "https://github.com/aljbri/customPascalVOC",
        "issues": "https://github.com/aljbri/customPascalVOC/issues"
    },
    "split_keywords": [
        "pascal voc",
        "voc",
        "dataset loader",
        "dataset reader"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "cc2efb137d8f215f9b89eccbe7b8ec15344a8b8b68a7ecba281e8a555e2016cc",
                "md5": "dc8eb56f75c324edb5916e2482cef127",
                "sha256": "c9ec453da0fec8a6a78fa94d0fc41016529b0a6166d78f091deab2fe2fe28661"
            },
            "downloads": -1,
            "filename": "customVOC-0.0.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "dc8eb56f75c324edb5916e2482cef127",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.6",
            "size": 5467,
            "upload_time": "2024-01-25T00:49:26",
            "upload_time_iso_8601": "2024-01-25T00:49:26.509398Z",
            "url": "https://files.pythonhosted.org/packages/cc/2e/fb137d8f215f9b89eccbe7b8ec15344a8b8b68a7ecba281e8a555e2016cc/customVOC-0.0.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "49e70f911dc31b2ef280777f41b16b021580a99f78b64f78b3d5a78170147dd2",
                "md5": "2deb8735dc0d9fd779578475abfe7adb",
                "sha256": "42a9178ab832f240420a452398d3935515dff54d6c563dd7b6f28e0f08b1d395"
            },
            "downloads": -1,
            "filename": "customVOC-0.0.1.tar.gz",
            "has_sig": false,
            "md5_digest": "2deb8735dc0d9fd779578475abfe7adb",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.6",
            "size": 5673,
            "upload_time": "2024-01-25T00:49:28",
            "upload_time_iso_8601": "2024-01-25T00:49:28.504801Z",
            "url": "https://files.pythonhosted.org/packages/49/e7/0f911dc31b2ef280777f41b16b021580a99f78b64f78b3d5a78170147dd2/customVOC-0.0.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-01-25 00:49:28",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "aljbri",
    "github_project": "customPascalVOC",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "customvoc"
}
        
Elapsed time: 0.17035s