======Mosquito Vision: Guidance for Automated Robotic Mosquito Salivary Gland Extraction====== **Last updated: May 9, 2020** ======Summary====== The goal of this project is to create a ROS-integrated computer vision system for mosquito detection and keypoint identification to guide an automated mosquito dissection robotic system for live malaria vaccine production. The target keypoints on the mosquito to be identified include the proboscis, the head, and the neck. This project is in conjunction with Sanaria Inc. (Rockville, MD). * **Students:** Akash Chaurasia, Alan Lai, Parth Vora * **Mentors:** Balazs Vagvolgyi, Dr. Russ Taylor ======Background, Specific Aims, and Significance====== Malaria is a mosquito-borne disease that affects humans and is caused by a single-celled organism of the Plasmodium group. In 2017, there were over 200 million clinical cases of malaria, causing over 435,000 deaths, and over $12 billion USD loss in Africa alone. Despite the impact that malaria has and the clear need, there currently exists no effective malaria vaccine in the market. However, Sanaria, a biotechnology company in Rockville MD, has recently been successful in developing a live malaria vaccine that has shown to be up to 100% effect in clinical cases. These vaccines are made from attenuated Plasmodium falciparum sporozoites (PfSPZ), the very bacteria that causes malaria. Because of the live nature of these vaccines, they must be cultivated within live mosquitoes, and hence must also be extracted from mosquito salivary glands before being able to be used as a vaccine. {{ :courses:456:2020:projects:456-2020-05:project_proposal_background_images.jpg?500 |}} Currently, the workflow to create this vaccine is slow, requiring manual extraction of the attenuated PfSPZ from salivary glands using syringes. Hence, an autonomous robotic system is currently being developed in order to automate the process. The full workflow for automated PfSPZ extraction is outlined in Figure 2. Our project will focus on leveraging computer vision techniques to allow the robot to autonomously detect keypoints on the mosquito. This will allow the robot to optimally position the mosquito for decapitation and salivary gland extraction while minimizing human input. Project goals: - Develop computer vision methods for * mosquito localization on a rotating platform * mosquito body part localization: head, neck, proboscis * mosquito orientation recognition: left, right, other - Integrate implemented methods with robotic test bed - Write documentation for algorithms and system integration - Validate methods using robot system and mosquitos All of these components are required to provide robust vision guidance to support a fully autonomous system, ultimately streamlining the production of an impactful vaccine. ======Deliverables====== * **Minimum:** (Expected by 3/31 - **Complete**) - Model-based computer vision: * Algorithm for location of mosquitoes in the field of view of the camera * Algorithm for location of the mosquito neck * Algorithm for location of the two ends of the mosquito proboscis * Thorough documentation of design choices, algorithms, and code usage - Deep Learning: * Algorithm for determination of orientation of mosquitoes * Framework for training model on detection of mosquito keypoints (abdomen, thorax, head, neck, proboscis) * Thorough documentation of design choices, algorithms, and code usage * **Expected:** (Expected by 4/15 - **Complete**) * In addition to the above... - Model-based computer vision: * Fully integrated library for aforementioned computer vision methods * Documentation detailing implementation and usage of library * Integration of library with ROS to communicate with robot system - Deep Learning: * Implementation of DL orientation algorithm in a ready-to-be-integrated class-based model * **Maximum:** (Expected by 5/1 - **Complete**) * In addition to the above... - Model-based computer vision: * Validation of all algorithms on large dataset of mosquito images * Documentation of validation methods and results - Deep Learning * Creation and validation of library to streamline process of training mosquito pose estimation ======Technical Approach====== **Model-Based Approach** The main goals of the model-based approaches are to (1) detect and locate mosquitoes, (2) locate the center of the neck, and (3) locate the center of the proboscis. This is shown below in figure 3, as algorithms part of a proposed Sanaria CV library that communicates with the robot via the ROS client. {{ :courses:456:2020:projects:456-2020-05:project_proposal_image_processing_workflow.jpg?350 |}} The goals of each of these steps is to find where the mosquitoes are on the rotating wheel, determine how far the robot must drag the mosquito to align it with the blade cutter, and determine where to grab the mosquito respectively. Each of these steps will be performed using traditional computer vision methods as follows: - Image processing to isolate correct mosquito, error checking * Thresholding * Binary image processing (erosion, dilation) * Connected components labeling * Filtering, creating bounding boxes - Template matching, model-based optimization for head/neck localization - Image processing to identify proboscis * Model-based optimization to find endpoints of proboscis Ultimately, these algorithms will be encapsulated in a single library with a function each to find a mosquito, locate its neck, and locate the endpoints of its proboscis. Furthermore, since the entire robot system and its individual components will be integrated in ROS, we will create a ROS service which can be called by the robot driver client, ultimately using these algorithms and seamlessly transmitting the outputs to later stages in the workflow. **Deep Learning Approach** The main goals of the deep learning approaches for this project are to (1) classify the orientation of the mosquito, (2) detect and locate the mosquitoes, and (3) locate keypoints of the mosquito, which include the proboscis tip, the proboscis end, the head, the neck, the thorax, and the abdomen. The process of creating deep learning neural network models and using them in practice is outlined below in figure 4. {{ :courses:456:2020:projects:456-2020-05:deep_learning_workflow_v2.jpg?500 |}} Deep learning can occur via either training from scratch, or transfer learning. Training from scratch (shown in figure 4 as the right light-blue shaded box) occurs when a network model is initialized from random weights, and training images are provided to the network, where a series of forward propagation and backpropagation are performed so that the network is able to learn features of the image that it uses for classification. Though this specializes the model for our purposes, training is slow, and because of our limited dataset, accuracy is low. Validation images are used to evaluate the training progress of the models. Therefore, transfer learning was used for this project, which involves taking a pretrained network (shown in figure 4 as the left light-blue shaded box) and fine-tuning it. By pretraining the network on other images, the neural network already has a representation of features of images that it can use for classification, speeding up the training process. The fine tuning process outlined in the image by using our training and validation dataset allows us to modify the model weights such that it can be used for our purposes. Once the model has been trained, inference can occur, as shown in the light-red shaded box in the bottom of figure 4. The model is loaded, and the relevant image is imported and processed. Inference occurs when the image is fed into the trained neural network, where it will output the classification or other predictions. __Orientation Classification__ The orientation classification model aims to classify the mosquito as either missing, lying on its back or stomach, lying on its left side, or lying on its right side, as seen in figure 5. Deep learning is the preferred modality over image processing, since orientation is conveyed by the textures of the mosquito rather than distinct features that one can easily identify. Hence the use of deep learning to automatically learn these implicit features would have more success. Transfer learning of neural network models was performed via PyTorch. Pretrained models such as ResNet18, ResNet152, VGG16, and DenseNet121 were loaded from PyTorch, and trained on our orientation image dataset. Conditions such as data augmentation, learning rate, epoch number, and optimizers were varied to determine the best combination that would yield the highest accuracy. - Target accuracy: 95% - Target running time: < 1000 ms Besides using deep learning for orientation determination, an exploratory side of this project is to use deep learning for automatic detection of keypoints of the mosquito, such as the proboscis tip and base, neck, midpoint between thorax and abdomen, and the end of the abdomen. It is the hope that if deep learning is successful, then it will be able to support (or even replace) the image processing algorithms, as sufficient training will make the detection robust to lighting conditions and other factors that may stump the image processing algorithm, providing more confident estimations of the location of the neck and other keypoints of the mosquito. __Mosquito Detection__ Transfer learning was also performed for our mosquito detection task, which involves locating the mosquito in the image. The Detectron2 library framework, made by Facebook AI and based on Mask R-CNN, was used for training, as it hosts a large number of pretrained models, and supports object detection, as required for this project. To use this model, Detectron2 models were loaded from the library, and training and validation images from the old system setup were used to train the model via the framework. Once training was completed, testing images were then provided to the model, where evaluation was performed. - Target mAP@IoU=0.5: 0.96 - Target mAP@IoU=0.75: 0.84 - Target running time: < 400 ms __Mosquito Pose Estimation__ For mosquito pose estimation/keypoint detection, the Detectron2 library was also used, as it supported human pose estimation, which was re-purposed to be applicable for mosquito keypoints. Again, Detectron2 models were loaded from the library, and training and validation images from the old system setup were used to train the model via the framework. Once training was completed, testing images were then provided to the model, where evaluation was performed. - Target average RMSE for all body parts: 4 pixels - Target running time: < 400 ms The proposed workflow for training both mosquito detection and mosquito pose estimation is as follows: - Detectron2 pretrained model for either mosquito detection or pose estimation is loaded - Training and validation images are loaded in - Annotations for the training and validation images are parsed - Images and annotations are provided to the Detectron2 framework, and training occurs - Testing images are loaded and annotations parsed - Evaluation of the models is performed on testing images - Tweaking and variations of the model and training parameters are done to further refine the model ======Dependencies====== {{ :courses:456:2020:projects:456-2020-05:project_proposal_dependencies.jpg?650 |}} Items in red are no longer applicable due to the changes due to COVID-19 ======Milestones and Status ====== {{ :courses:456:2020:projects:456-2020-05:project_timeline_updated0507.jpg?700 |}} Items in red are no longer possible due to COVID-19 updates. - Milestone name: Deep learning environment setup * Responsibility: Alan * Planned Date: 2020/02/14 * Expected Date: 2020/02/14 * Status: **Complete** - Milestone name: ~95% success rate for orientation detection * Responsibility: Alan * Planned Date: 2020/02/28 * Expected Date: 2020/02/26 * Status: **Complete** - Milestone name: Documentation for orientation detection workflow and algorithms * Responsibility: Alan * Planned Date: 2020/02/28 * Expected Date: 2020/03/16 * Status: **Complete** - Milestone name: ROS integration of head & neck localization algorithm * Responsibility: Akash & Parth * Planned Date: 2020/02/28 * Expected Date: 2020/02/28 * Status: **Complete 2020/02/26** - Milestone name: ~95% success rate for head and neck localization within 30 pixels * Responsibility: Akash & Parth * Planned Date: 2020/02/28 * Expected Date: 2020/02/28 * Status: **Complete** - Milestone name: ~95% success rate for mosquito finder (IOU > 70%) * Responsibility: Akash & Parth * Planned Date: 2020/03/16 * Expected Date: 2020/03/16 * Status: **Complete** - Milestone name: ~95% success rate for proboscis finder (Lateral Error < 30 pixels) * Responsibility: Akash & Parth * Planned Date: 2020/04/01 * Expected Date: 2020/04/01 * Status: **Complete** - Milestone name: ~95% success rate for bounding box detection deep learning algorithm (IOU > 0.5) * Responsibility: Alan * Planned Date: 2020/04/05 * Expected Date: 2020/04/05 * Status: **Complete** - Milestone name: Deep learning pose estimation average error within 5 pixels for validation set * Responsibility: Alan * Planned Date: 2020/04/30 * Expected Date: 2020/04/30 * Status: **Complete** - Milestone name: Full system integration of head, neck, and proboscis detection * Responsibility: Akash & Parth * Planned Date: 2020/04/29 * Expected Date: 2020/04/29 * Status: **Complete** - Milestone name: Creation of library for training and usage of bounding box and keypoint detection * Responsibility: Alan * Planned Date: 2020/05/05 * Expected Date: 2020/05/05 * Status: **Complete** ======Reports and presentations====== * Project Plan * {{:courses:456:2020:projects:456-2020-05:sanaria_cis_proj_proposal.pdf| Project plan presentation}} * {{:courses:456:2020:projects:456-2020-05:proj_proposal.pdf|Project plan proposal}} * Project Background Reading * See Bibliography below for links. * [[https://ieeexplore.ieee.org/document/8842860|Mosquito Pick-and-Place: Automating a Key Step in PfSPZ-based Malaria Vaccine Production]] * Project Checkpoint * {{:courses:456:2020:projects:456-2020-05:project_checkpoint_presentation_1_.pdf| Project checkpoint presentation}} * Paper Seminar Presentations * Akash Chaurasia: //Mosquito Pick-and-Place: Automating a Key Step in PfSPZ-based Malaria Vaccine Production// * {{:courses:456:2020:projects:456-2020-05:pick_and_place_paper.pdf|Original paper}} * {{:courses:456:2020:projects:456-2020-05:ac_seminar_critique.pdf|Written critique}} * {{:courses:456:2020:projects:456-2020-05:ac_seminar_presentation.pdf |Presentation}} * Alan Lai: //Multi-mosquito object detection and 2d pose estimation for automation of PfSPZ malaria vaccine production// * {{ :courses:456:2020:projects:456-2020-05:mos_deep_learning_paper.pdf |Original paper}} * {{ :courses:456:2020:projects:456-2020-05:al_seminar_critique.pdf |Written critique}} * {{ :courses:456:2020:projects:456-2020-05:al_seminar_presentation_v2.pdf |Presentation}} * Parth Vora: // An Efficient Production Process for Extracting Salivary Glands from Mosquitoes// * {{ :courses:456:2020:projects:456-2020-05:cis_ii_paper.pdf | Original paper}} * {{ :courses:456:2020:projects:456-2020-05:cis_ii_critique.pdf | Written critique}} * {{ :courses:456:2020:projects:456-2020-05:parth_-_seminar_presentation_1_.pdf |Presentation}} * Project Mini Checkpoint Presentation * {{ :courses:456:2020:projects:456-2020-05:project_mini_checkpoint_presentation.pdf | Presentation}} * Project Final Presentation * {{:courses:456:2020:projects:456-2020-05:mosquito_vision_final_presentation.pdf|Final Presentation Slides [PDF]}} * {{https://docs.google.com/presentation/d/1kWXwgYZvtqqF_E4p3JsXprMuNi78vutaDadDWZ2DxyY/edit?usp=sharing|Final Presentation Slides [online]}} * Project Final Report * {{:courses:456:2020:projects:456-2020-05:mosquito_vision_final_report.pdf|Final Report}} * {{https://git.lcsr.jhu.edu/sanaria_cv_alan/mosquito_deep_learning|Deep Learning Source Code}} * {{https://git.lcsr.jhu.edu/mosquito-vision/sanaria_cv_algorithms| Image Processing Source Code}} * {{https://git.lcsr.jhu.edu/sanaria_cv_alan/mosquito_deep_learning/-/wikis/home|Deep Learning Documentation}} (GitLab access only given to advisors/lab members) * {{https://git.lcsr.jhu.edu/mosquito-vision/sanaria_cv_algorithms/-/wikis/manual| Image Porcessing Documentation}} (GitLab access only given to advisors/lab members) ======Project Bibliography======= - H. Phalen, P. Vagdargi, M. Pozin, S. Chakravarty, G. S. Chirikjian, I. Iordachita, and R. H. Taylor, "Mosquito Pick-and-Place: Automating a Key Step in PfSPZ-based Malaria Vaccine Production", in IEEE Conference on Automation Science and Engineering (CASE), Vancouver, BC, August 22-26, 2019. pp. 12-17. - M. Schrum, A. Canezin, S. Chakravarty, M. Laskowski, S. Comert, Y. Sevimli, G. S. Chirikjian, Stephen L. Hoffman, and R. H. Taylor, "An Efficient Production Process for Extracting Salivary Glands from Mosquitoes", arXIV, 2019, http://arxiv.org/abs/1903.02532. - H. Wu, J. Mu, T. Da, M. Xu, R. H. Taylor, I. Iordachita, and G. S. Chirikjian, "Multi-mosquito object detection and 2D pose estimation for automation of PfSPZ malaria vaccine production", in IEEE 15th International Conference on Automation Science and Engineering (CASE), Vancouver, BC, August 22-26, 2019. - M. Xu, S. Lyu, Y. Xu, C. Kocabalkanli, B. K. Chirikjian, J. S. Chirikjian, J. Davis, J. S. Kim, I. Iordachita, R. H. Taylor, and G. S. Chirikjian, "Mosquito Staging Apparatus for producing PfSPZ Malaria Vaccines", in IEEE 15th International Conference on Automation Science and Engineering (CASE), Vancouver, BC, August 22-26, 2019. ======Other Resources and Project Files====== Here give list of other project files (e.g., source code) associated with the project. If these are online give a link to an appropriate external repository or to uploaded media files under this name space (2020-05). Source code and Documentation for deep learning can be found [[https://git.lcsr.jhu.edu/sanaria_cv_alan/mosquito_deep_learning|here]] Source code and Documentation for image processing algorithms can be found [[https://git.lcsr.jhu.edu/mosquito-vision/sanaria_cv_algorithms|here]]