White cane or blind stick is helpful tool for the visually impaired. But sometimes it could be difficult for the visually impaired to locate the white cane at their or in case or they forgot to put it.
In this project page, I will make an easy to build device with minimum component to help locate the white cane.
HardwareFor simplicity to duplicate I'll be using two main hardware:
- Grove vision AI V2
The reason to choose this two hardware is the M5stick already have internal battery and have grove port that easily attached with the Grove vision AI V2.
Data ModelTo make detection for the white cane I use the wiki tutorial from seeedstudio in order for the grove vision AI V2 have the white cane detection capability.
In order to make a good model I need find a good dataset and roboflow has a lot of it
after finding a suitable dataset, I just need to change this line to generate a data model based on the dataset
after the data model is generated, to put the data model to the Grove Vision AI V2, I login to the sensecraft website and uploaded the model
after the data model is uploaded I deploy it the grove vision hardware and test it.
after flashing is done, now we can test it
The M5Stick C Plus2 already have buzzer onboard. This could made building easier.
Connect the Grove Vision AI V2 to M5Stick C Plus2 via the grove port on each end.
Open up Arduino IDE and add these two library in the library manager.
- M5Stick C Plus2
- SSCMA
Then Upload this code
#include <Seeed_Arduino_SSCMA.h>
#include "M5StickCPlus2.h"
SSCMA AI;
void setup()
{
AI.begin();
auto cfg = M5.config();
StickCP2.begin(cfg);
Serial.begin(9600);
}
void loop()
{
if (!AI.invoke())
{
Serial.println("invoke success");
Serial.print("perf: prepocess=");
Serial.print(AI.perf().prepocess);
Serial.print(", inference=");
Serial.print(AI.perf().inference);
Serial.print(", postpocess=");
Serial.println(AI.perf().postprocess);
for (int i = 0; i < AI.boxes().size(); i++)
{
Serial.print("Box[");
Serial.print(i);
Serial.print("] target=");
Serial.print(AI.boxes()[i].target);
Serial.print(", score=");
Serial.print(AI.boxes()[i].score);
Serial.print(", x=");
Serial.print(AI.boxes()[i].x);
Serial.print(", y=");
Serial.print(AI.boxes()[i].y);
Serial.print(", w=");
Serial.print(AI.boxes()[i].w);
Serial.print(", h=");
Serial.println(AI.boxes()[i].h);
StickCP2.Speaker.tone(10000, 100);
delay(1000);
StickCP2.Speaker.tone(4000, 20);
delay(1000);
}
for (int i = 0; i < AI.classes().size(); i++)
{
Serial.print("Class[");
Serial.print(i);
Serial.print("] target=");
Serial.print(AI.classes()[i].target);
Serial.print(", score=");
Serial.println(AI.classes()[i].score);
}
for (int i = 0; i < AI.points().size(); i++)
{
Serial.print("Point[");
Serial.print(i);
Serial.print("]: target=");
Serial.print(AI.points()[i].target);
Serial.print(", score=");
Serial.print(AI.points()[i].score);
Serial.print(", x=");
Serial.print(AI.points()[i].x);
Serial.print(", y=");
Serial.println(AI.points()[i].y);
}
for (int i = 0; i < AI.keypoints().size(); i++)
{
Serial.print("keypoint[");
Serial.print(i);
Serial.print("] target=");
Serial.print(AI.keypoints()[i].box.target);
Serial.print(", score=");
Serial.print(AI.keypoints()[i].box.score);
Serial.print(", box:[x=");
Serial.print(AI.keypoints()[i].box.x);
Serial.print(", y=");
Serial.print(AI.keypoints()[i].box.y);
Serial.print(", w=");
Serial.print(AI.keypoints()[i].box.w);
Serial.print(", h=");
Serial.print(AI.keypoints()[i].box.h);
Serial.print("], points:[");
for (int j = 0; j < AI.keypoints()[i].points.size(); j++)
{
Serial.print("[");
Serial.print(AI.keypoints()[i].points[j].x);
Serial.print(",");
Serial.print(AI.keypoints()[i].points[j].y);
Serial.print("],");
}
Serial.println("]");
}
}
}
then you can see the result in the serial monitor, and when the camera detect a white cane the M5stickC buzzer will turn on notifying the user.
since it is using the Grove Vision AI V2, you can change any kind of object that you want and you can change it easily on the sensecraft AI platform.
For example in this video below I change the device to detect a person
Comments