Skip to content
Snippets Groups Projects
Commit a232eaba authored by Thibault Allenet's avatar Thibault Allenet
Browse files

Add python biding for MNIST database

parent a57953ae
No related branches found
No related tags found
No related merge requests found
#include <pybind11/pybind11.h>
#include <pybind11/stl.h>
#include "aidge/backend/opencv/database/MNIST.hpp"
namespace py = pybind11;
namespace Aidge {
void init_MNIST(py::module& m){
py::class_<MNIST, std::shared_ptr<MNIST>, Database>(m, "MNIST")
.def(py::init<const std::string&, bool, bool>(), py::arg("dataPath"), py::arg("train"), py::arg("load_data_in_memory")=false)
.def("get_item", &MNIST::getItem, py::arg("index"),
R"mydelimiter(
Return samples of each data modality for the given index.
:param index: Database index corresponding to one item
:type index: int
)mydelimiter")
.def("get_len", &MNIST::getLen,
R"mydelimiter(
Return the number of items in the database.
)mydelimiter")
.def("get_nb_modalities", &MNIST::getNbModalities,
R"mydelimiter(
Return the number of modalities in one item of the database.
)mydelimiter");
}
}
...@@ -6,12 +6,9 @@ namespace py = pybind11; ...@@ -6,12 +6,9 @@ namespace py = pybind11;
namespace Aidge { namespace Aidge {
void init_Aidge(py::module& /*m*/){ void init_MNIST(py::module&);
}
PYBIND11_MODULE(aidge_backend_opencv, m) { PYBIND11_MODULE(aidge_backend_opencv, m) {
init_Aidge(m); init_MNIST(m);
} }
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment