icatcherplus / icatcher_plus

iCatcher+: Robust and automated annotation of infant gaze from videos collected in laboratory, field, and online studies
GNU General Public License v3.0
17 stars 17 forks source link

Added RegNet gaze model as the default option, added unit tests #51

Closed shehadak closed 1 year ago

shehadak commented 1 year ago

Changed the model loading code to include an option for choosing the gaze model. If no model is specified, by default, the RegNet image encoder trained on Lookit will be loaded. In particular, those are the four cases:

  1. --model is left unspecified: Loads the RegNet image encoder trained on Lookit as part of the GazeCodingModel.
  2. --model=icatcher+_lookit_regnet.pth: Loads the RegNet image encoder trained on Lookit as part of the GazeCodingModel.
  3. --model=icatcher+_lookit.pth: Loads the ResNet image encoder trained on Lookit as part of the GazeCodingModel.
  4. --model=my_own_model_path: Loads the model specified by the path provided by the user. For now, it assumes that the model uses a ResNet image encoder backbone, for backward compatibility.

In addition, added three unit tests that test the model loading functionality in cases 1-3 above. For case 4, including a model in the repository seems like a huge and unjustified storage lift. Still, I could add functionality to download a model, load it, and then delete it if you think that's appropriate. Additional test cases make sure that the entire inference pipeline runs to completion with both gaze models. However, this option is only enabled for GPU devices, otherwise, it will timeout on the GitHub Actions automatic testing workflow.