Skip to content

A system that calculates insulin dose by estimating carbs in a meal.

License

Notifications You must be signed in to change notification settings

Frost-Lee/insulin_calculator

Repository files navigation

Insulin Calculator

A system that calculates the insulin required to compensate the blood glucose rise caused by a meal.

Configuration

  • Generate the C shared objects by executing make under insulin_calculator_server/fvolume/c_core/.
  • Set storage directories in insulin_calculator_server/config.py.

System Modules

The system is a client - server system with multiple functional modules. The functionalities of the modules includes generating food segmentation mask, estimating volume and area of objects in depth map, calculating insulin dose with consideration of carbs intake and blood glucose measure, as well as mobile and server application.

Food Segmentation Model

A segmentation model that generate a mask indicating food / not food for a given image. U-Net is used in this system, this network is trained on Food201-MultiLabel. See here for module details.

Food Volume Estimation

A module that estimate the food volume and top surface area with depth map and color image. This process is done by generating a volume map as well as an area map according to the depth map as well as camera intrinsics, the integrate their area according to food labels generated by segmentation model and separated by connected component detection algorithm. The food classification of each entity is done by calling Food API. See here for module details.

Food Density Library

A food density library that maps the food volume to food weight. This library only done for test use, thus only a small subset of all food's density is recorded. To make this project a fully usable commercial project, this library have to be huge. When building the library, the food volume is estimated by the Food Volume Estimation module. See here for module details.

Insulin Dose Estimation

A module that calculates the insulin dose considering the intake food nutrition and personalized data. This module is not finished yet.

Front End

An iOS application that runs on iPhones with True Depth camera. This module is capable for capturing the depth map and color image of food, submitting the result to the server, and handle the response. This application is done in Swift with Storyboard user interface. See here for module details.

Back End

A Flask HTTP server that handles the front end data and provides model response. The submitted data will be stored in the server if the user permits. See here for module details.

Possible Improvements

Here are some possible ways for improving the performance of this system. They are worth trying for the future work.

Speed Improvements

  • Use a server with GPU
  • Find better ways to extract depth map as JSON.
  • Filtering entities that is too small to be a real food entity.
  • Compress the data and reduce the data transfering time.

Accuracy Improvements

  • Consider instance segmentation.
  • Correct depth map and color image distortion, see here for the details.
  • Compensating the device orientation bias by updating the volume calculation algorithm.

Copyright

This project is my bachelor thesis project at Massachusetts Institute of Technology (MIT), the user should not violate terms and conditions specified by Inventions and Proprietary Information Agreement (IPIA) of MIT.

About

A system that calculates insulin dose by estimating carbs in a meal.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published