Skip to content

Introduce Focoos Open Source Models ✨#96

Merged
CuriousDolphin merged 147 commits into
mainfrom
feat/opensource-modelling
Jun 4, 2025
Merged

Introduce Focoos Open Source Models ✨#96
CuriousDolphin merged 147 commits into
mainfrom
feat/opensource-modelling

Conversation

@CuriousDolphin
Copy link
Copy Markdown
Member

@CuriousDolphin CuriousDolphin commented May 28, 2025

✨ Introduce Focoos Open Source Models ✨

CONTEXT

This PR implements comprehensive integration of Focoos open source models with the newly introduced ModelManager system to provide a unified, standardized approach for model loading, training, and export across the Focoos ecosystem.

BREAKING KEY CHANGES

Complete refactor of entire sdk:

  • PreTrained Model Registry Integration: Added 11 pretrained models including fai-detr-l-obj365, fai-mf-l-ade, bisenetformer-s-ade and variants
  • Unified Model Loading: Single ModelManager.get() interface for registry, hub, and local model access
  • Configuration Management: Automated config loading with ConfigManager and BackboneManager for model families
  • Models Image Processors support
  • Refactor LocalModel to InferModel
  • Inference Runtime Backend Support: Integration with ONNX, TorchScript runtimes via BaseRuntime interface
  • Local Training
  • Data Pipeline Enhancement: Complete data loading system with mappers, samplers, and augmentation support
  • Hub Integration
  • Refactor Focoos() to FocoosHUB()

more info on: https://focoosai.github.io/focoos/

CuriousDolphin and others added 30 commits April 17, 2025 12:16
…factor RTDetr model configurations

- Added AutoBackbone class for lazy loading of backbone models.
- Refactored RTDetr model configurations to use a unified RTDetrConfig class.
- Updated model registry to support new backbone configurations.
- Updated .gitignore to include datasets directory.
- Updated AutoModel to register models using ModelFamily instead of model names.
- Added new RTDetr model configuration to the model registry.
- Improved bounding box processing in RTDetrProcessor for pixel precision.
- Introduced FocoosModel as a high-level wrapper
- Updated AutoModel to return FocoosModel instances instead of BaseModelNN.
- Refactored model loading and configuration validation processes.
- Added DatasetEntry and BasicContainer classes for improved data handling.
…son file - more adaptable for the hub

- Refactored AutoConfig to create configurations from dictionaries (json) instead of pretrained model names.
- Introduced AutoConfigBackbone for managing backbone configurations.
- Updated ModelInfo to use a dictionary for configuration parameters.
- Added new model configurations for RTDETR models in JSON format.
- Simplified the DatasetEntry and ModelOutput classes by extending BaseContainer.
Improve the organization of model registry by moving ModelRegistry to a dedicated submodule, allowing for better modularity and maintainability.

Key changes:
- Moved ModelRegistry to focoos.model_registry.model_registry.
- Updated import paths in auto_model.py to reflect the new structure.
- Enhanced ModelInfo to include focoos_model attribute for better model identification.
- Updated the configuration handling to allow for dynamic updates with additional keyword arguments.
- Improved error logging in FocoosModel to check for consistency between model and dataset class counts.
- Added DarkNet backbone configuration and architecture.
- Introduced new model configurations for various backbones, including ConvNeXtV2 and MIT.
- Cleaned and refactored existing backbone code for improved clarity and maintainability.
- Updated copyright information in relevant files.
- Added unit tests for backbone initialization and forward pass functionality.
- Introduced a new ClassificationDatasetMapper for handling image classification tasks.
- Added support for loading datasets from folder structures with category subfolders.
- Enhanced the AutoModel and AutoConfig classes to register and manage classification models.
- Implemented a new FAIClassification model with a dedicated classification head and loss module.
- Updated the model configuration to include parameters specific to classification tasks.
- Improved logging for dataset creation and model processing.
- Introduced CLS_FOLDER layout for classification datasets in DatasetLayout.
- Enhanced AutoDataset to support loading datasets from folder structures.
- Added classification augmentations for training and validation.
- Implemented ClassificationEvaluator for computing accuracy, precision, recall, and F1 score.
- Updated trainer to include classification metrics in evaluation.
- Improved logging for classification evaluation results.
Update the ROOT_DIR to improve organization and clarity for users. The change moves the cache directory to a more intuitive location and introduces an experiments directory to facilitate better management of experiment-related files.

- Changed ROOT_DIR to "FocoosAI" for better user understanding.
- Added EXPERIMENTS_ROOT to organize experiment files separately.

This impacts the file structure, making it easier for users to locate and manage their models, datasets, and experiments.
Refactor the directory structure to enhance clarity and organization for users. This change standardizes the naming conventions for dataset and model directories, improving the overall usability of the system.

These changes impact how users interact with datasets and models, making it easier to manage and locate resources within the application.
Improve the DictClass by adding pickling support through the __reduce__ method, allowing for better serialization of instances. This change is essential for users who need to save and load model configurations seamlessly.
- Updated model registration to include new model families and configurations for DETR and MaskFormer.
- Introduced DatasetEntry for consistent dataset representation across various mappers.
- Enhanced dataset mappers for classification, detection, and semantic segmentation to utilize the new DatasetEntry structure.
- Improved error handling and logging in evaluation processes for better debugging and user experience.
- Added new model registry files for various model configurations, improving the overall organization and accessibility of model resources.
- Added more coco models
- Added "shapely" version 2.1.0 to dependencies for improved geometric operations.
- Introduced new model registry files for COCO instance segmentation models, enhancing model accessibility.
- Removed outdated model registry file for ADE instance segmentation, streamlining the model registry.
- Enhanced code clarity with consistent formatting and improved error messages in various components.
… function

- Updated postprocessing type in MaskFormerConfig to use a Literal for better type safety.
- Adjusted accepted postprocessing types in FAIMaskFormer to exclude "panoptic".
- Introduced a new interpolate_image function for resizing images, improving code organization and clarity.
- Refactored MaskFormerProcessor to utilize the new interpolation function for mask predictions.
fcdl94 and others added 4 commits May 30, 2025 16:40
- Changed the dataset conversion path in `convert_supervisely_dataset_to_coco` to use a more descriptive variable name.
- Enhanced the results processing in `SemSegEvaluator` to handle non-finite values, ensuring cleaner output.
- Removed redundant directory creation check in `download_ext_file` method.
- Added a test to verify that the method correctly creates non-existing directories when downloading files.
- Updated mock tests to include additional header handling in API requests.
giuseppeambrosio97 and others added 19 commits June 3, 2025 12:42
- Reorganized API references in `mkdocs.yaml`, replacing outdated entries with new documentation files for model management, inference, and processing.
- Added new API documentation files for `focoos_model`, `model_manager`, `model_registry`, `infer_model`, `processor`, and `hub`.
- Removed obsolete API documentation files for `focoos`, `local_model`, `remote_model`, `remote_dataset`, and `runtime`.
- Enhanced docstrings across various classes and methods in the codebase to improve clarity and provide detailed usage instructions.
- Added detailed docstrings to the BaseModelNN class and its methods, providing clear descriptions of parameters, return values, and exceptions.
- Improved documentation for the model's initialization, device and dtype properties, forward pass, state dictionary loading, and benchmarking methods.
- This enhancement aims to improve code clarity and usability for developers implementing concrete model classes.
- Added a new API reference for `base_model` in `mkdocs.yaml`.
- Revised the setup documentation to clarify the installation process for various inference runtimes, including updates to runtime names and requirements.
- Improved descriptions for optional dependencies and installation commands for ONNX and Torch runtimes.
- Ensured consistency in the documentation regarding CUDA and cuDNN version requirements.
…uides

- Updated `mkdocs.yaml` to reflect new sections for QuickStart, Training, Inference, and Contributing.
- Introduced new documentation files for training and inference processes, detailing model usage and deployment options.
- Revised the main index page to enhance clarity and provide a cohesive overview of the Focoos library.
- Added a new concepts page for foundational understanding of the library's functionalities.
- Improved organization of model documentation, consolidating model references and descriptions for better accessibility.
- Updated `mkdocs.yaml` to improve organization of API references, introducing nested structures for `focoos_model` and `infer` sections.
- Added new documentation files for `auto_dataset`, `base_model`, `trainer_evaluation`, and `trainer_hooks`, providing detailed API references.
- Removed obsolete entries from the documentation structure to streamline access to relevant information.
- Enhanced docstrings in the `ClassificationEvaluator` class to provide comprehensive descriptions of methods and attributes, improving clarity for users.
- Deleted unused export files for ONNX and TorchScript to clean up the codebase.
- Deleted the `list_shared_datasets` method, which listed datasets shared with the user, to streamline the API.
- This change simplifies the class structure and focuses on core functionalities.
- Introduced a new Jupyter notebook for Focoos HUB integration, covering setup, user info retrieval, listing remote models and datasets, and performing remote inference.
- The notebook includes detailed markdown explanations and code snippets to guide users through the integration process.
- This addition aims to enhance user experience by providing practical examples and a comprehensive overview of Focoos HUB functionalities.
- TOFIX: links to API Reference

- Added comprehensive documentation for the `FocoosModel` and `InferModel` classes, detailing key features, loading strategies, inference processes, training configurations, and model export options.
- Included code examples for loading models from various sources, performing inference, and training, enhancing user understanding and accessibility of the library's functionalities.
- Updated the index page to reflect changes and improve navigation within the documentation.
- Introduced model size configurations for ConvNeXtV2, allowing dynamic selection of depths and embedding dimensions based on predefined sizes.
- Added logging functionality to ConvNeXtV2 and MobileNetV2 for better tracking of pretrained model loading.
- Removed the outdated MIT backbone implementation to streamline the codebase.
- Updated STDC and Swin backbones to support model size configurations and improved logging for pretrained weights.
…pretrained models

- Introduced a `pretrained` option in the `ResnetConfig` class to allow users to specify whether to use pretrained weights.
- Added a `use_conv_last` option in the `STDCConfig` class for additional configuration flexibility.
- Updated output layer indices in the `STDC` class to improve clarity and consistency in layer identification.
- Introduced new documentation files for Focoos HUB, including `hub.md`, `overview.md`, and `remote_inference.md`, detailing model and dataset management, remote inference capabilities, and usage examples.
- Updated `mkdocs.yaml` to include a new HUB section with organized navigation for easy access to the new documentation.
- Enhanced the `remote_model.py` to improve error handling in training information retrieval.
- This addition aims to provide comprehensive guidance for users on utilizing the Focoos HUB effectively.
- TODO: cls, detr, bisenetformer model docs
- TODO: fix references to API refs

- Renamed "QuickStart" to "Main Concepts" in `mkdocs.yaml` for clarity.
- Updated model references in `mkdocs.yaml` to use consistent naming conventions.
- Corrected section titles in `inference.md` and `training.md` for consistency and clarity.
- Added new model documentation for `bisenetformer`, `fai_cls`, `fai_detr`, and `fai_mf`, detailing architecture, configuration, and output formats.
- Enhanced `models.md` to include updated model names and metrics for better user guidance.
- These changes aim to improve the overall coherence and accessibility of the documentation.
- Updated `concepts.md` to include links to relevant API references for `ModelManager`, `ModelInfo`, and `FocoosDetections`.
- Improved clarity in `inference.md` by adding links to `RuntimeTypes` and correcting the Focoos Hub URL.
- Expanded `bisenetformer.md` and added new documentation for `fai_cls.md` and `fai_detr.md`, detailing model architectures, configurations, and outputs.
- Enhanced overall coherence and accessibility of the documentation to better guide users in utilizing the models effectively.
- Removed the MIT backbone entry from the BACKBONE_CONFIGS dictionary in `test_backbone.py` to streamline the configuration options and eliminate redundancy.
@CuriousDolphin CuriousDolphin merged commit 4b71832 into main Jun 4, 2025
19 of 20 checks passed
@CuriousDolphin CuriousDolphin deleted the feat/opensource-modelling branch June 4, 2025 14:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

3 participants