How mwasifanwar/terracognita works
Project type and purpose
• TerraCognita is a machine-learning/data-analysis pipeline for archaeological site prediction. It ingests multi-modal data (satellite imagery + geological/archaeological datasets), trains a fusion model, and runs inference to produce geospatial predictions of potential ancient sites.
File structure
• Top-level:
• train_model.py – orchestrates end-to-end training
• predict_sites.py – entry point for running inference
• models/ – serialized model artifacts
• setup.py, requirements.txt – packaging & dependencies
• src/:
• config.py – global configuration, paths, hyperparameters
• data_loader.py – loads/merges various data sources
• satellite_processor.py – satellite imagery preprocessing (e.g., tiling, normalization)
• geological_analyzer.py – feature extraction from geological data
• fusion_model.py – defines the multi-modal ML architecture
• site_predictor.py – wraps model inference logic
• utils/ – geospatial_tools.py (coordinate reprojections, shapefile handling), visualization.py (plot maps & results)
• tests/: unit tests for each core component
Key insights from README
• Multi-modal fusion of imagery + geological/archaeological inputs
• Produces spatial predictions of undiscovered ancient sites
• Likely integrates GIS libraries, a deep-learning framework, and visualization tools
Main components
a. Data Sources
• Satellite Imagery (e.g., GeoTIFFs)
• Geological Data (e.g., elevation, soil type)
• Archaeological Records (optional shapefiles or CSV)
b. Ingestion & Preprocessing
• SatelliteProcessor
• GeologicalAnalyzer
• DataLoader (merges and aligns datasets)
c. Core ML Pipeline
• FusionModel (multi-modal neural net)
• Training Engine (train_model.py orchestrator)
• Model Registry (models/ directory)
d. Inference & Prediction
• SitePredictor (predict_sites.py entry point)
• Post-processing (thresholding, clustering)
• Visualization (maps, heatmaps)
e. Configuration & Utilities
• Config Manager (config.py)
• GeospatialTools & Visualization utilities
Relationships & data flow
• DataLoader ↔ SatelliteProcessor & GeologicalAnalyzer for feature extraction
• Processed features → FusionModel
• FusionModel ← config settings
• Training Engine triggers FusionModel training → Model Registry
• Inference Engine loads trained model → SitePredictor → Output Results
• Visualization module subscribes to output → renders maps
Architectural patterns & principles
• Modular pipeline: each stage is a self-contained component
• Separation of concerns: preprocessing, modeling, inference, visualization
• Config-driven: all file paths and hyperparameters in config.py
• Testable units: each module has corresponding tests
Technologies & frameworks
• Core language: Python
• GIS libs: GDAL/rasterio, GeoPandas
• ML framework: PyTorch or TensorFlow (implied by fusion_model)
• Visualization: Matplotlib/Seaborn or Folium
• Packaging: setuptools (setup.py)
• Config.py feeding parameters to loaders and models
• Separation between training and inference flows
• Where models are saved/loaded (models/ directory)