English | 中文
If you like MaixCDK or MaixPy, please give a star ⭐️ to the MaixPy and MaixCDK open source project to encourage us to develop more features.
#include "maix_nn.hpp"
#include "maix_camera.hpp"
#include "maix_display.hpp"
int main()
{
nn::Classifier classifier("/root/models/mobilenetv2.mud");
image::Size input_size = classifier.input_size();
camera::Camera cam = camera::Camera(input_size.width(), input_size.height(), classifier.input_format());
display::Display disp = display::Display();
char msg[64];
while(!app::need_exit())
{
image::Image *img = cam.read();
auto *result = classifier.classify(*img);
int max_idx = result->at(0).first;
float max_score = result->at(0).second;
snprintf(msg, sizeof(msg), "%5.2f: %s", max_score, classifier.labels[max_idx].c_str());
img->draw_string(10, 10, msg, image::COLOR_RED);
disp.show(*img);
delete result;
delete img;
}
return 0;
}
from maix import camera, display, image, nn
classifier = nn.Classifier(model="/root/models/mobilenetv2.mud")
cam = camera.Camera(classifier.input_width(), classifier.input_height(), classifier.input_format())
disp = display.Display()
while 1:
img = cam.read()
res = classifier.classify(img)
max_idx, max_prob = res[0]
msg = f"{max_prob:5.2f}: {classifier.labels[max_idx]}"
img.draw_string(10, 10, msg, image.COLOR_RED)
disp.show(img)
The functionality of MaixCDK is kept in sync with MaixPy, and the MaixPy documentation is also applicable to MaixCDK.
Just add comments, then you can use this API in MaixPy!
Python demo code:
from maix import uart
devices = uart.list_devices()
print(devices)
MaixCDK implemention in maix_uart.hpp
:
namespace maix::uart {
/**
* List all UART devices can be directly used.
* @return All device path, list type, element is string type
* @maixpy maix.uart.list_devices
*/
std::vector<std::string> list_devices();
}
No need for AI expertise or expensive training equipment, train models with one click, deploy to MaixCAM with one click.
Community | Address |
---|---|
MaixCDK Documentation | MaixCDK Documentation |
MaixPy Documentation | MaixPy Documentation |
App Store | maixhub.com/app |
Project Sharing | maixhub.com/share |
Bilibili | Search for MaixCAM or MaixPy on Bilibili |
Discussion | maixhub.com/discussion |
MaixCDK issues | github.com/sipeed/MaixPy/issues |
Telegram | t.me/maixpy |
QQ Group | 862340358 |