{"id":18835262,"url":"https://github.com/mlpack/models","last_synced_at":"2025-10-28T17:31:11.853Z","repository":{"id":22099565,"uuid":"248572894","full_name":"mlpack/models","owner":"mlpack","description":"models built with mlpack","archived":false,"fork":false,"pushed_at":"2024-08-14T19:58:13.000Z","size":60891,"stargazers_count":37,"open_issues_count":17,"forks_count":40,"subscribers_count":24,"default_branch":"master","last_synced_at":"2025-02-06T02:38:37.798Z","etag":null,"topics":["mlpack"],"latest_commit_sha":null,"homepage":"https://models.mlpack.org/docs","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mlpack.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-03-19T18:10:14.000Z","updated_at":"2025-01-27T20:08:18.000Z","dependencies_parsed_at":"2024-06-08T02:24:11.192Z","dependency_job_id":"57da267e-cb88-47c3-8979-847b60ba61b0","html_url":"https://github.com/mlpack/models","commit_stats":{"total_commits":383,"total_committers":25,"mean_commits":15.32,"dds":0.7258485639686685,"last_synced_commit":"6a87ab2e8188708e0da65867ff72f424700c7ab8"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mlpack%2Fmodels","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mlpack%2Fmodels/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mlpack%2Fmodels/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mlpack%2Fmodels/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mlpack","download_url":"https://codeload.github.com/mlpack/models/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":238686679,"owners_count":19513520,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["mlpack"],"created_at":"2024-11-08T02:15:10.999Z","updated_at":"2025-10-28T17:31:11.416Z","avatar_url":"https://github.com/mlpack.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"The mlpack **models** repository provides **ready-to-use** implementations of popular\nand cutting-edge machine learning models mostly deep learning models. The\nimplementations in this repository are intended to be compiled into command-line\nprograms and bindings to Python and other languages.\n\n\u003e (This README contains various TODO comments like this one, so if you are\n\u003e helping with the transition from the `examples/` repository, be sure to look for\n\u003e comments like this one. Once the transition is done, we can remove this\n\u003e comment (and the others).)\n\nWe provide ability to download datasets as well as pretrained weights using our\nutility functions, by default we assume the server to be mlpack.org.\nTo download any file from mlpack.org simple use the following command.\n\nNOTE: Our dataloader and models automatically download weights if necessary during\nruntime.\n\n```cpp\nUtils::DownloadFile(url, downloadPath);\n```\n\n_(If this repository gets set up as a submodule to the main mlpack repository\nand that is how everything in it should be compiled, then we should point that\nout here!)_\n\n### Contents\n\n  1. [Introduction](#1-introduction)\n  2. [Dependencies](#2-dependencies)\n  3. [Building-From-Source](#3-building-from-source)\n  4. [Using Dataloaders](#4-using-dataloaders)\n  5. [Using Augmentation](#5-using-augmentation)\n  6. [Supported Models](#6-supported-models)\n  7. [Datasets](#7-datasets)\n\n### Introduction\n\nThis repository contains a number of different models implemented in C++ using\nmlpack. To understand more about mlpack, refer to the [mlpack\nrepository](https://github.com/mlpack/mlpack/) or the [mlpack\nwebsite](https://www.mlpack.org/).\n\n### Dependencies\n\nIn order to compile and build the programs in this repository, you'll need to\nmake sure that you have the same dependencies available that mlpack requires, in\naddition to mlpack itself.\n\n_(If this should only be built as a submodule, we should probably remove this\npart about dependencies and instruct users to build this as a submodule of the\nmain mlpack repository.)_\n\n      mlpack\n      Armadillo      \u003e= 8.400.0\n      Boost (program_options, math_c99, unit_test_framework, serialization,\n             spirit) \u003e= 1.58\n      CMake          \u003e= 3.3.2\n      ensmallen      \u003e= 2.10.0\n\nTo install mlpack refer to the [installation\nguide](https://www.mlpack.org/docs.html) that's available in the mlpack\ndocumentation.\n\nAll of those dependencies should be available in your distribution's package\nmanager. If not, you will have to compile each of them by hand. See the\ndocumentation for each of those packages for more information.\n\n### Building from source\n\nTo install this project run the following command.\n\n  `mkdir build \u0026\u0026 cd build \u0026\u0026 cmake ../`\n\nUse the optional command `-D DEBUG=ON ` to enable debugging.\n\nOnce CMake is configured, compile:\n\n  `make`\n\nYou can also build with multiple cores using the `-j` option.  For example,\nbuilding with 4 cores can be done with the following command:\n\n  `make -j4`\n\n### Using Dataloaders\n\nThis repository provides dataloaders and data preprocessing modules for mlpack library.\nIt also provides utility function required required for downloading, extracting and processing\nimage, text and sequential data. For more information about dataloaders and utility functions.\n\n#### Dataloaders for popular datasets.\n\nCreating and processing data can be done in just a single line. Don't have the dataset downloaded,\nNo worries, we will download and preprocess it for you. Kindly refer to sample code given below.\n\n```cpp\nconst string datasetName = \"mnist\";\nbool shuffleData = true;\ndouble ratioForTrainTestSplit = 0.75;\n\n// Create the DataLoader object.\nDataLoader\u003c\u003e dataloader(datasetName, shuffleData, ratioForTrainTestSplit);\n```\n\nTo train or test your model with our dataloaders is very simple.\n```cpp\n// Use the dataloader for training.\nmodel.Train(dataloader.TrainFeatures(), dataloader.TrainLabels());\n \n// Use the dataloader for prediction.\nmodel.Predict(dataloader.TestFeatures(), dataloader.TestLabels());\n```\n\nCurrently supported datasets are mentioned below :\n\n|  **Dataset** | **Usage** | **Details** |\n| --- | --- | --- |\n|  MNIST | DataLoader\u003c\u003e (\"mnist\"); | MNIST dataset is the de facto “hello world” dataset of computer vision.\u003cbr/\u003e Each image is 28 pixels in height and 28 pixels in width, for a total of 784 pixels in total. The first column, called \"label\", is the digit that was drawn by the user. The rest of the columns contain the pixel-values of the associated image.|\n|  Pascal VOC Detection | DataLoader\u003cmat, field\u003cvec\u003e\u003e (\"voc-detection\") | The Pascal VOC challenge is a very popular dataset for building and evaluating algorithms for image classification, object detection and segmentation.\u003cbr/\u003e VOC detection dataset provides support for loading object detection dataset in PASCAL VOC. Note : By default we refer to VOC - 2012 dataset as VOC dataset.|\n| CIFAR 10 | DataLoader\u003c\u003e (\"cifar10\"); | The CIFAR-10 dataset consists of 60000 32x32 colour images in 10 classes, with 6000 images per class. There are 50000 training images and 10000 test images.|\n\n#### Loading Other Datasets.\n\nWe are continuously adding new datasets to this repository, However you can also\nuse our dataloaders to load other datasets.\n\n##### Loading CSV Datasets.\nUse our `LoadCSV` function to load and process CSV datasets.\n\n```cpp\nDataLoader\u003c\u003e irisDataloader;\n\nconst string datasetPath = \"mnist\";\nbool shuffleData = true;\ndouble ratioForTrainTestSplit = 0.75;\nbool isTrainingData = true;\nbool useFeatureScaling = true;\nbool dropHeader = false;\n\n// Starting column index for Training Features.\nsize_t startInputFeatures = 0;\n// Ending column index for training Features.\n// We also support wrapped index i.e. -1 implies last column and so on.\nsize_t endInputFeatures = -2;\n\nirisDataloader(datasetPath, isTrainingData, shuffleData, ratioForTrainTestSplit,\n    useFeatureScaling, dropHeader, startInputFeatures, endInputFeatures);\n```\n\n##### Loading Image Dataset.\n\nUse our `LoadImageDatasetFromDirectory` to load image dataset in given directory. Directory should contain folders with folder name as class label and each folder should contain images corresponding to the class name.\n\n```cpp\nDataLoader\u003c\u003e dataloader;\ndataloader.LoadImageDatasetFromDirectory(\"path/to/directory\", imageWidth, imageHeight, imageDepth);\n```\n\n##### Loading Object Detection Dataset.\n\nWe provide support to load annotations represented in XML files and their corresponding images. If your dataset contains fixed number of objects in each annotation use matrix type to load your dataset else use field type for labels / annotations. If images are not of same size pass a vector containing resize parameter. By default, each image is resized to 64 x 64.\n\n ```cpp\n DataLoader\u003c\u003e dataloader;\n vector\u003cstring\u003e classes = {\"class-name-0\", \"class-name-1\", \"class-name-2\"}\n dataloader.LoadObjectDetectionDataset(\"path/to/annotations/\", \"path/to/images/\", classes);\n ```\n\n#### Preprocessing.\n\nFor all datasets that we support we provide, We preprocess them internally. We also\nprovide access to preprocessor functions for standard datasets in case one needs to\napply them to their datasets.\n\nThey can simply be called as follows by calling static functions of ProProcess class i.e.\nPreProcess::SupportedDatasetName\n\n```cpp\nPreProcess\u003c\u003e::MNIST(dataloader.TrainFeatures(), dataloader.TrainLabels(),\n    dataloader.ValidFeatures(), dataloader.ValidLabels(), dataloader.TestFeatures());\n```\n\nThis is especially useful when preprocessing of your dataset resembles any other standard\ndataset that we support.\n### Using Augmentation\n\nTo prevent overfitting on training data, we provide support for native augmentation. The constructor takes in a list / vector of strings which contain supported augmentation. Augmentation can be applied to the dataset by calling the `Transform` function. For more information about augmentation.\n\n```cpp\nAugmentation augmentation({\"horizontal-flip\", \"resize : (64, 64)\"}, 0.2);\naugmentation.Transform(dataset, imageWidth, imageHeight, imageDepth);\n```\n\n### Supported Models\n\nCurrently model-zoo project has the following models implemented:\n\n|  **Model** | **Usage** | **Available Weights** | **Paper** |\n| --- | --- | --- | --- |\n|  Darknet 19 | DarkNet\u003cNegativeLogLikelihood\u003c\u003e, HeInitialization, 19\u003e darknet19({imageDepth, imageWidth, imageHeight}, numClasses)| ImageNet |[YOLO9000](https://pjreddie.com/media/files/papers/YOLO9000.pdf)|\n|  Darknet 53 | DarkNet\u003cNegativeLogLikelihood\u003c\u003e, HeInitialization, 53\u003e darknet19({imageDepth, imageWidth, imageHeight}, numClasses)| ImageNet |[YOLOv3](https://pjreddie.com/media/files/papers/YOLOv3.pdf)|\n\nAll models can be included as shown below :\n```cpp\n#include \u003cmodels/Model-ClassName/Model_ClassName.hpp\u003e\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmlpack%2Fmodels","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmlpack%2Fmodels","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmlpack%2Fmodels/lists"}