### Train with torchrun Source: https://github.com/yeshwanth95/pix2poly/blob/master/README.md Start training with distributed data parallelism. Replace `` with the number of GPUs to use. ```shell torchrun --nproc_per_node= train_ddp.py ``` -------------------------------- ### Run inria_to_coco.py to prepare INRIA train/val splits Source: https://github.com/yeshwanth95/pix2poly/blob/master/data_preprocess/README.md Command to convert INRIA raw tiles and ground truths into MS COCO format. The first 5 tiles of each city are kept as validation split. Requires the pix2poly_env environment. ```shell # with pix2poly_env python inria_to_coco.py ``` -------------------------------- ### Run evaluate_mass_roads_predictions.py for Massachusetts Roads Source: https://github.com/yeshwanth95/pix2poly/blob/master/README.md Computes evaluation metrics for raster predictions on the Massachusetts Roads Dataset. Requires ground truth directory and predicted raster masks folder. ```bash python evaluate_mass_roads_predictions.py --gt-dir data/mass_roads_1500/test/map --dt-dir path/to/predicted/raster/masks/folder ``` -------------------------------- ### Run spacenet_to_coco.py to prepare SpaceNet train/val splits Source: https://github.com/yeshwanth95/pix2poly/blob/master/data_preprocess/README.md Command to convert SpaceNet raw tiles and ground truths into MS COCO format. The first 15% tiles are kept as validation split. Requires the pix2poly_env environment. ```shell # with pix2poly_env python spacenet_to_coco.py ``` -------------------------------- ### Run whu_buildings_to_coco.py to prepare WHU Buildings splits Source: https://github.com/yeshwanth95/pix2poly/blob/master/data_preprocess/README.md Command to convert WHU Buildings raw tiles and ground truths (512x512) into MS COCO format for train, validation, and test splits. Requires the pix2poly_env environment. ```shell # with pix2poly_env python whu_buildings_to_coco.py ``` -------------------------------- ### Download Massachusetts Roads dataset Source: https://github.com/yeshwanth95/pix2poly/blob/master/data_preprocess/README.md Command to download the Massachusetts Roads Dataset using the provided shell script. ```shell ./download_mass_roads_dataset.sh ``` -------------------------------- ### Run evaluation.py for building datasets Source: https://github.com/yeshwanth95/pix2poly/blob/master/README.md Computes evaluation metrics for predicted building footprint files. The --eval-type argument accepts one of: ciou, angle, polis, or topdig. ```bash python evaluation.py --gt-file path/to/ground/truth/annotation.json --dt-file path/to/prediction.json --eval-type ``` -------------------------------- ### INRIA dataset directory structure Source: https://github.com/yeshwanth95/pix2poly/blob/master/data_preprocess/README.md Required folder layout for the raw INRIA Aerial Image Labeling Dataset before running inria_to_coco.py. ```text data/inria_raw/ ├── test/ │ └── images/ └── train/ ├── gt/ └── images/ ``` -------------------------------- ### Predict on INRIA dataset Source: https://github.com/yeshwanth95/pix2poly/blob/master/README.md Generate predictions for the INRIA dataset. Run the prediction script with the required arguments, then run the postprocessing script after adjusting input/output paths in lines 6-10. ```shell python predict_inria_coco_val_set.py -d inria_coco_224_negAug \ -e \ -c \ -o python postprocess_coco_parts.py # change input and output paths in L006 to L010. ``` -------------------------------- ### Convert SpaceNet 16-bit to 8-bit Source: https://github.com/yeshwanth95/pix2poly/blob/master/data_preprocess/README.md Command to convert pansharpened RGB image tiles from 16-bit to 8-bit. Requires the gdal_env environment. ```shell # with gdal_env python spacenet_convert_16bit_to_8bit.py ``` -------------------------------- ### Split Massachusetts Roads tiles into 224x224 patches Source: https://github.com/yeshwanth95/pix2poly/blob/master/data_preprocess/README.md Command to split the 1500x1500 tiles into 224x224 overlapping patches. Requires the gdal_env environment. ```shell # using gdal_env python mass_roads_tiles_to_patches.py ``` -------------------------------- ### Predict on WHU Buildings dataset Source: https://github.com/yeshwanth95/pix2poly/blob/master/README.md Generate predictions for the WHU Buildings dataset. Run the prediction script with the required arguments, then run the postprocessing script after adjusting input/output paths in lines 6-10. ```shell python predict_whu_buildings_coco_test_set.py -d whu_buildings_224_coco \ -e \ -c \ -o python postprocess_coco_parts.py # change input and output paths in L006 to L010. ``` -------------------------------- ### Conda environment specification for Pix2Poly Source: https://github.com/yeshwanth95/pix2poly/blob/master/README.md Conda environment specification for Pix2Poly. Use with `conda env create -f environment.yml` (or equivalent) to set up the required dependencies, including PyTorch 2.1.2, CUDA 11.8, timm, transformers, and various image-processing libraries. ```yaml channels: - defaults dependencies: - torchvision=0.16.2 - pytorch=2.1.2 - pytorch-cuda=11.8 - torchaudio=2.1.2 - timm=0.9.12 - transformers=4.32.1 - pycocotools=2.0.6 - torchmetrics=1.2.1 - tensorboard=2.15.1 - pip: - albumentations==1.3.1 - imageio==2.33.1 - matplotlib-inline==0.1.6 - opencv-python-headless==4.8.1.78 - scikit-image==0.22.0 - scikit-learn==1.3.2 - scipy==1.11.4 - shapely==2.0.4 ``` -------------------------------- ### SpaceNet 2 Vegas dataset directory structure Source: https://github.com/yeshwanth95/pix2poly/blob/master/data_preprocess/README.md Required folder layout for the raw SpaceNet 2 Vegas subset before running the conversion scripts. ```text data/AOI_2_Vegas_Train/ └── geojson/ └── buildings/ └── RGB-PanSharpen/ ├── gt/ └── images/ ``` -------------------------------- ### Generate vector annotations for Massachusetts Roads patches Source: https://github.com/yeshwanth95/pix2poly/blob/master/data_preprocess/README.md Two commands to generate vector annotation files for the patches: first clip tile vectors, then convert world coordinates to pixel coordinates. Both require the gdal_env environment. ```shell # using gdal_env python mass_roads_clip_tile_vectors.py python mass_roads_world_to_pixel_coords.py ``` -------------------------------- ### WHU Buildings dataset directory structure Source: https://github.com/yeshwanth95/pix2poly/blob/master/data_preprocess/README.md Required folder layout for the raw WHU Buildings aerial imagery dataset (0.2 meter split) before running whu_buildings_to_coco.py. ```text data/WHU_aerial_0.2/ ├── test/ │ ├── image/ │ └── label/ ├── train/ │ ├── image/ │ └── label/ └── val/ ├── image/ └── label/ ``` -------------------------------- ### Predict on Spacenet 2 dataset Source: https://github.com/yeshwanth95/pix2poly/blob/master/README.md Generate predictions for the Spacenet 2 dataset. Run the prediction script with the required arguments, then run the postprocessing script after adjusting input/output paths in lines 6-10. ```shell python predict_spacenet_coco_val_set.py -d spacenet_coco \ -e \ -c \ -o python postprocess_coco_parts.py # change input and output paths in L006 to L010. ``` -------------------------------- ### Predict on Massachusetts Roads dataset Source: https://github.com/yeshwanth95/pix2poly/blob/master/README.md Generate predictions for the Massachusetts Roads dataset. Use `-s` to specify the split ('test' or 'val'), and adjust `--batch_size` according to available resources. ```shell python predict_mass_roads_test_set.py -e \ -c \ -s \ # 'test' or 'val' --img_size 224 \ --input_size 224 \ --batch_size 24 \ # modify according to resources ``` -------------------------------- ### Clip Massachusetts Roads shapefile to raster extents Source: https://github.com/yeshwanth95/pix2poly/blob/master/data_preprocess/README.md Command to generate vector annotations for each tile by clipping the roads geojson to the corresponding raster extents. Requires the gdal_env environment. ```shell # using gdal_env python mass_roads_clip_shapefile.py ``` -------------------------------- ### Convert SpaceNet geojson to pixel coordinates Source: https://github.com/yeshwanth95/pix2poly/blob/master/data_preprocess/README.md Command to convert geojson annotations from world space coordinates to pixel space coordinates. Requires the gdal_env environment. ```shell # with gdal_env python spacenet_world_to_pixel_coords.py ``` -------------------------------- ### Massachusetts Roads 224x224 directory structure Source: https://github.com/yeshwanth95/pix2poly/blob/master/data_preprocess/README.md Final directory structure of the processed 224x224 patches of the Massachusetts Roads Dataset, used for training Pix2Poly. ```text data/mass_roads_224/ ├── test/ │ ├── map/ │ ├── pixel_annotations/ │ ├── sat/ │ └── shape/ ├── train/ │ ├── map/ │ ├── pixel_annotations/ │ ├── sat/ │ └── shape/ └── valid/ ├── map/ ├── pixel_annotations/ ├── sat/ └── shape/ ``` -------------------------------- ### Massachusetts Roads 1500x1500 directory structure Source: https://github.com/yeshwanth95/pix2poly/blob/master/data_preprocess/README.md Directory structure resulting from clipping the shapefile, containing 1500x1500 tiles of the Massachusetts Roads Dataset. ```text data/mass_roads_1500/ ├── test/ │ ├── map/ │ ├── sat/ │ └── shape/ ├── train/ │ ├── map/ │ ├── sat/ │ └── shape/ └── valid/ ├── map/ ├── sat/ └── shape/ ``` -------------------------------- ### Cite Pix2Poly paper (WACV 2025) Source: https://github.com/yeshwanth95/pix2poly/blob/master/README.md BibTeX citation for the Pix2Poly paper published at WACV 2025. Use this when citing the work. ```bibtex @InProceedings{Adimoolam_2025_WACV, author = {Adimoolam, Yeshwanth Kumar and Poullis, Charalambos and Averkiou, Melinos}, title = {Pix2Poly: A Sequence Prediction Method for End-to-End Polygonal Building Footprint Extraction from Remote Sensing Imagery}, booktitle = {Proceedings of the Winter Conference on Applications of Computer Vision (WACV)}, month = {February}, year = {2025}, pages = {8473-8482} } ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.