Skip to content

Conversation

@malwaredllc
Copy link
Contributor

@malwaredllc malwaredllc commented Apr 16, 2022

This PR is to hand off the work I did this semester in an organized way that will enable the group to continue building off of it if they choose to.

The changes include:

  1. autolabel.py - this is the auto-labelling script I wrote and used to generate labels for the Detectron2 research. I cleaned up and refactored the code, and added a help menu (use python3 autolabel.py --help for usage information). It uses blob detection features of skimage (with parameters set by the user) to automatically generate annotations for quantum dots in the COCO format. It can operate on single image files, or recursively operate on directories of images. You can use the --show flag to preview the labels for an image and tweak the parameters before deciding and saving the labels with the --save flag. There are various other options and parameters as well, which I will go over in more detail in a hand-off meeting with Harry, which we can record for future students to reference.

  2. input_dir/ - this is a directory which contains all the images from raw_samples/, each with a corresponding JSON annotations file in COCO format (e.g. input_dir/32/5a.tif, input_dir/32/5a.json etc.). You can update/overwrite these annotations by running the autolabel.py script with the --save flag with your updated parameters for any image/directory of your choosing.

  3. Detectron2Research.ipynb - this is my research notebook in which I used Detectron2 with the object detection base model faster_rcnn_R_50_C4_1x and trained it on the annotated images of quantum dots. To use it in its current form, you'll need to upload the notebook to Google Colab, then upload your annotated images (input_dir/) to Google Drive, as well as some test images to Google Drive as well. I used 132/2b.tif and 107/2a.tif because they have a known QD count done by humans manually. Make sure to update the filepaths in the notebook (i.e. /content/gdrive/train/, /content-gdrive/test etc) to match wherever you upload the files in your Google Drive.

  4. generate_labels.sh - this is a bash script which contains all the commands I used to generate labels, all strung together to run concurrently, so you can see what parameters I used, as well as modify parameters and regenerate all the labels if you want.

@malwaredllc malwaredllc changed the title April2 Autolabel script, Research notebook, COCO annotations for raw samples Apr 16, 2022
@review-notebook-app
Copy link

Check out this pull request on  ReviewNB

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB

@malwaredllc
Copy link
Contributor Author

@erjank this PR contains my work this semester to hand-off to the group

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant