Giter Club home page Giter Club logo

depthperceptionhapticsystem's Introduction

Depth Perception Haptic System (DPHS)

Senior Design II Spring 2022

Department of Electrical and Computer Engineering

Univeristy of Central Florida

Abstract: Blind/low-vision individuals typically use canes to navigate their environments. Canes allow for people to check their immediate walking path, but nothing beyond or above the floor. Our project intends to provide a hands-free alternative to the cane. Robot vision and distance sensors are combined to create a map of the space in front of the user. This map is then projected on to a vest lined with vibrating motors. Similar alternatives are either uncomfortable (containing several distance sensors), are not hands-free, or rely on complicated machinery.

Software Overview

github_software_overview

The software integrates the Benewake TFMini-S LiDAR (I2C), Raspberry Pi Camera v2 (Legacy stack), and PCA9685 PWM Controller (I2C) on a custom carryout board for the Raspberry Pi Compute Module 4. The core functionality of the project comes from the Depth Perception Service which implements a depth inferencing model to relay information about obstacles to the user.

The final version of this project uses MiDaS v2.1 Small created by Ranftl et al. The Tensorflow Lite version of the model was converted to the MNN framework, and then quantized using RedWebv1.

image

Results of running MiDaS on TFLite, TFLite + XNNPACK delegate, and MNN are provided. The MNN quantized model was generated with the following dataset configuration JSON:

{
    "format":"RGB",
    "mean":[123.675,116.28,103.53],
    "normal":[0.01712475,0.017507,0.01742919],
    "width":256,
    "height":256,
    "path":"/home/pi/quantization/Imgs/",
    "feature_quantize_method":"KL",
    "weight_quantize_method":"MAX_ABS"
}

Contributers

References

K. Xian, C. Shen, Z. Cao, “The IEEE Conference on Computer Vision and Pattern Recognition (CVPR),” 2018. https://sites.google.com/site/redwebcvpr18/

R. Ranftl, K. Lasinger, D. Hafner, K. Schindler, and Vladlen Koltun, “Towards Robust Monocular Depth Estimation: Mixing Datasets for Zero-shot Cross-dataset Transfer,” 2020 IEEE Transactions on Pattern Analysis and Machine Intelligence (TPAMI)

Special Thanks

Thank you to:

  • ISL Org for providing MiDaS and its source code.
  • Alibaba for the incredible MNN framework.
  • Xian and team for providing the RedWeb dataset.

depthperceptionhapticsystem's People

Contributors

jasonmatos23-git avatar

Watchers

 avatar

depthperceptionhapticsystem's Issues

Component independence

Components should be as independent as possible to allow for faster testing and demo development. For example, services should be able to be run without creating a RoutineContainer object.

Faster TFLite monocular depth model

Current model (Intel Midas/v2_1_small) runs at approximately 900 ms without optimizations on the Raspberry Pi 4 using TFLite with Python. Should find either a new model which has a lower latency, modify a model, or create a model based on existing architectures.

Setup speaker in Output

Use hardware PWM to connect to and play audio through the speaker. Figure out what kind of audio can be played, how to store and play audio clips, and consider how routines will request audio to be played.

Initial setup

Setup DPHS, SystemContainer, Executable, SystemService, and Service components. Basically, setting up the framework for the core functionality of the project.

Output does not del PWM on exit

When canceling execution of Output.py, there is no function to delete the PWM instance (which enables sleep mode). Additionally, flickering occurs if chip is not disconnected from power between runs.

Minimum working example

The essential components need to be fully integrated to produce a minimum, working, and error-free product. In particular, the following must be connected:

  • API: Camera module, Forward LiDAR, Input, Output, Speaker, PWM Motor control
  • Services and Routines: DepthPerception, EmergencyDetection
  • Modes: General, Low Power, and (for demonstration) LiDAR/CV only
  • Scheduler, System (mode/state), Hardware Interrupts, and mode indications for callback functions

Note: The intention is for this, and the representative value issue #31 , and potentially #14 be the last PRs for dev/v1-0-0. Tuning, optimizations, error checking/handling should be covered in a future dev/v1-1-0 or dev/v2-0-0

API resource management

Modules included in the API do not properly disable/re-enable/destroy. Must implement better resource management to prevent errors such as #33 . Additional optimizations may be included in this issue.

I2C Connection to PWM Driver

Find out how to connect software to PCA9685 (PWM LED/motor control chip). Additionally set output unit to handle changing duty cycles.

Implement mode running

Tie general mode, low power mode, and outdoor mode together. This is likely to go in scheduler.py. Scheduler should poll the mode and run/toggle services based on that mode.

Error handling

Errors and exceptions should be handled to prevent the system from crashing or stalling out across all components.

Representative value and intensity mapping

Must transform data from depth inference to 9 duty cycle values. Current approach is bilinear resize output to 32x32, apply Gaussian kernels to different points of image and find a maximum value, feed the maximums into a function for intensity of estimated depth, and output the results over PWM.

API Organization and Camera in Input

Introduction of PWM and LiDAR modules to the API folder has made things slightly disorganized. Adding an Input/ and Output/ directory to place these modules in (or a modules/ directory) is desirable. Additionally, separating the Camera code from the Input.py file is desirable for organization, clarity, ease-of-updating, and ensuring proper resource management.

GPIO Configuration

Must set pins to their appropriate ALTs based on @ChadPauley 's GPIO assignment document. GPIO0/1 may not work for the lidar. In that case use any other unoccupied SDA/SCL.

SMBus object deleted before PWM can write 0 to all outputs

Bug has to do with #27 and its associated PR. The bus is closed before the pwm script can write 0 to all outputs, which results in the LEDs remaining on after program termination. A quick fix is to write 0 to all outputs before closing the smbus object, but this may not be an ideal solution.

IdleDetection

Enable a low power mode on detection of no movement for some amount of time.

Move smbus2 instantiation to system.py

Noticing redundant creation of SMBus objects. Will be more effective to create one in system.py and pass it into the input and output components. Additionally consider using with _ as bus and implementing __enter__ and __exit__. Former likely in DPHS.py, the latter within system.py. Frankly creating multiple of these objects may not even work, so this is important to address.

Low power mode

Set peripheral devices (e.g. LiDAR, camera, motor controller) to their low power modes. Mode may be revisited in the future for improved performance.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.