MapDatasetGenerator
Generate and load dataset of road network maps.
Installation from pip
pip install mapdatasetgenerator
Creating patches
# Run this script to generate data in /output directory.
import logging
import sys
root = logging.getLogger()
root.setLevel(logging.INFO)
handler = logging.StreamHandler(sys.stdout)
handler.setLevel(logging.INFO)
formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s')
handler.setFormatter(formatter)
root.addHandler(handler)
from mapdataset import ImageGroupReader, single_layer_converter, MapsDataset, MapReader
sfMap = MapReader('./data/input/sf_layered.txt', "SF_Layered")
mapsDataset = MapsDataset(
patch_size=(32, 32),
stride=10,
sample_group_size=1280,
converter=single_layer_converter,
outputDir="./data/output"
)
mapsDataset.generate_patches(sfMap) #This will generate dill files which contain the saved sample lists.
Reading patches
# Script to read dill data objects as numpy arrays.
from PIL import Image
import os
import sys
import logging
root = logging.getLogger()
root.setLevel(logging.INFO)
handler = logging.StreamHandler(sys.stdout)
handler.setLevel(logging.INFO)
formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s')
handler.setFormatter(formatter)
root.addHandler(handler)
from mapdataset import ImageGroupReader, single_layer_converter, MapsDataset, MapReader, ImageUtils
dillFolder = "./data/output/SF_Layered/32x32/group-1280-stride-10"
mapsDataset = MapsDataset(
patch_size=(32, 32),
stride=10,
sample_group_size=1280,
converter=single_layer_converter,
outputDir="./data/output"
)
mapsDataset.loadPatches("./data/output/SF_Layered/32x32/group-1280-stride-10")
patchNo = randint(0, len(mapsDataset))
logging.info(f"reading patch {patchNo}")
patch = mapsDataset[patchNo]
im = ImageUtils.TorchNpPatchToPILImgGray(patch)
path = os.path.join(dillFolder, f"{patchNo}.png")
im.save(path)
Using for training
- Create patches if you already do not have them
- Create a MapsDataset object and load patches. Now you can use the dataset object as a regular Pytorch dataset or use it with a Dataloader.
Metadata
Release files for mapdatasetgenerator 0.0.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| MapDatasetGenerator-0.0.2.tar.gz | 7.8 kB | Without provenance | Details for MapDatasetGenerator-0.0.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| mapdatasetgenerator-0.0.2-py3-none-any.whl | Python 3 | none | any | Details for mapdatasetgenerator-0.0.2-py3-none-any.whl |
Total release size: 17.5 kB
Release files / MapDatasetGenerator-0.0.2.tar.gz
| Download URL | MapDatasetGenerator-0.0.2.tar.gz |
|---|---|
| Size | 7.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
68b6a3c8ee028d4731443fcb541b14f8d7c9b558e228603dbe2fd5dc6f7d171f
|
|
BLAKE2b-256 checksum How to use checksums |
0b9ef8f1ca7e8c5a44a7f40f398755c9c5a97870db7c1db1d23189a69514792f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.2.1 CPython/3.7.9 Windows/10
|
Release files / mapdatasetgenerator-0.0.2-py3-none-any.whl
| Download URL | mapdatasetgenerator-0.0.2-py3-none-any.whl |
|---|---|
| Size | 9.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
fb34852b487d4b5afd91beaf307aceb44ff91609cfbc37437a8408b56c1326c8
|
|
BLAKE2b-256 checksum How to use checksums |
40c898dbb86e5efea170140254aad554d33b492e882e499c5109c4b3726323db
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.2.1 CPython/3.7.9 Windows/10
|
Security for mapdatasetgenerator 0.0.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.