HuskyLens 2 Model Application: No Smoking on Campus

Even in the teaching building corridors, under the shade of trees on the playground, or at the back door of the library, you might still occasionally spot classmates sneaking a cigarette — that choking smoke makes passing teachers and students frown, and it’s totally against the campus no-smoking rules. But now, these "hidden" smoking behaviors have a new rival: HuskyLens 2! It’s transformed into the campus "smoking-buster" — just deploy the dedicated smoker detection model, and the cameras will get "eagle eyes". Whether someone’s hiding in the stairwell or huddled in the flower bed corner, once they take out a cigarette and light it up, the rule-breaking act will be quickly caught and exposed. No more relying on teachers’ patrols or classmates’ reminders — this AI "guard" is online 24/7, quietly protecting the fresh air in every learning space on campus, keeping smoke away from break times, and letting the scent of books linger with clean air.


First, let’s introduce the HuskyLens 2 AI Vision Sensor. It’s an easy-to-use, versatile AI vision sensor equipped with a dedicated 6TOPS computing power AI chip. It comes with over 20 ready-to-use AI models out of the box, including face recognition, object detection, image classification, pose recognition, and instance segmentation. What’s more, users can also deploy self-trained models to teach HuskyLens 2 to identify any target object. It offers a complete end-to-end solution for self-trained model deployment, supporting users to customize the entire process from model training to practical application. Breaking free from the limitations of pre-installed models, it allows users to train exclusive recognition models for specific needs, achieving a capability leap from "general recognition" to "customized cognition".


In this project, you’ll learn how to deploy your own smoker detection model on HuskyLens 2, combine it with the K10 and speech synthesis module, and build a smoking alarm guard!

A super simple setup, and smokers won’t stand a chance!

Prep Work

Hardware Needed

To follow this tutorial, you’ll need these hardware items:


- HUSKYLENS 2 AI Vision Sensor * 1
- It’s an easy-to-use AI vision module powered by the Kendryte K230 AI chip (6 TOPS). It comes with over 20 built-in vision models and supports custom model deployment. Compatible with UART/I²C interfaces, it can connect to platforms like Arduino, ESP32, and Raspberry Pi.


- UNIHIKER K10 * 1
- A learning board designed specifically for programming, IoT, and AI project teaching in IT courses. It integrates a camera, LCD color screen, microphone, speaker, WiFi/Bluetooth module, RGB indicator lights, and various sensors and expansion interfaces in one.


- microSD 16GB (TF) Class10 Memory Card * 1
- A high-performance Micro SDHC card. With 16GB capacity, it can store lots of photos, videos, documents, and other data. Class 10 speed rating ensures a minimum write speed of 10MB/s, enabling smooth recording and playback of full HD videos.


- TF Card/MicroSD Card Reader * 1
- It’s a thing that reads TF cards and MicroSD cards. Uses a USB 3.0 port, works with lots of stuff, transfers data fast, is small and easy to carry, and you just plug it in and it works.

HARDWARE LIST
1 HUSKYLENS 2 AI Vision Sensor
1 UNIHIKER K10
1 microSD 16GB (TF) Class10 Memory Card
1 TF Card/MicroSD Card Reader

Software Needed


- Mind+: A homegrown youth programming software with independent intellectual property rights. It integrates various mainstream main control boards and hundreds of open-source hardware, supporting AI and IoT functions. You can program with drag-and-drop graphical blocks or high-level languages like Python/C/C++. It lets you easily enjoy the fun of creation.

To check HuskyLens 2’s firmware version: Go to System Settings → Device Info.

The version in the picture is 0.9.0. You need to update it to version 1.1.6 or higher. For firmware update, please refer to: https://wiki.dfrobot.com/_SKU_SEN0638_Gravity_HUSKYLENS_2_AI_Camera_Vision_Sensor#7.%20Firmware%20Update

Feature Implementation

HUKSYLENS 2 Model Deployment

Connect your computer to HUSKYLENS 2 with a USB data cable. Once connected, a disk named Huskylens will show up on your computer. Copy the smoker detection model ZIP file to the \storage\installation_package folder of the Huskylens disk.

File - dfrobot_smoking_detection.4dd6.zip

Tap the HUSKYLENS 2 screen, then tap to enter 'Model Installation'.

Pick Local Installation, and you’ll see the screen below once it’s installed successfully.

Now check the HUSKYLENS 2 screen — if a new feature called "Smoking Detection" pops up, that means you’ve successfully imported your self-trained model into HUSKYLENS 2!

Tap into the Smoking Detection feature and check out how well the model you deployed recognizes things.

K10 Playing Audio Files

Use a TF card reader to put the audio file(s) onto the TF card, then insert the TF card into K10’s TF card slot. The specified audio file on the TF card will play in the background. Right now, only WAV-format stereo audio is supported — otherwise, there might be static or the audio will play too fast.

icon no_smoking.wav.zip 56KB Download(0)

Heads up: If you’re using a memory card larger than 32GB, you need to format it to FAT32 first.

Hardware Connection & Setup

Connecting the Hardware

Use a 4-pin white rubber cable to link the K10 and HuskyLens 2. And make sure both the K10 and HuskyLens 2 are powered up.

Mount and secure

You can use a fixing clip that fits HuskyLens 2. Here’s the link for this 3D-printed part: https://makerworld.com.cn/zh/@user_739543819/upload

Code blocks

Add HuskyLens 2 to the Mind+ user library.

Once the model is deployed, find the self-trained model block for HuskyLens 2.

Find the algorithm ID number for Smoking Detection in HuskyLens 2 — mine, for example, is 131.

First off, you need to initialize HuskyLens 2 and switch to the ID of the smoking detection algorithm.

Then, in each loop, you gotta ask the algorithm for data once, and check if it’s detected the target.

Next, use the algorithm target block to check the name of the target box — ID 0 is fixed here. The name of the first target is the name of the detected target box. It could be "person", "cigarette", or "smoke".

If both a person and a cigarette are detected, it’ll sound an alarm. And the image shown on K10 will be different either during detection or when something is detected.

Attachment

icon Smoker Detection.mp.zip 5.81MB Download(0)
License
All Rights
Reserved
licensBg
0