Implementing Web Application for updating weights of Model

Hi Everyone,

I was thinking of creating a web application that would classify images and also if the model incorrectly classifies the image then the user can mark its correct label and then the weights of the model will be updated accordingly.

How can I implement the deep learning model required for this task?
What should be the preferred approach to achieve this task?
Is this approach called as On-line training algorithm? If so can anyone provide me resources, information and share their experience with me of how they have implemented this model?

Thanks.

I need to test this theory out and probably will try it over the next few days but hypothetically so long as you calculated the gradients along with it (your inference time will increase with this though) you could do a backwards pass through your model and update everything. You’d need essentially a mock training loop that executes the actual weight update to your discretion.

Which now thinking about it this becomes a semi-supervised environment.

I suppose this is what is called active learning. And some labelling tools, ex: Prodigy, SMART, HistomicsML, provide this functionality.

1 Like

For most use cases, I think you would typically just log the transactions, and then do a batch update in an offline process.

You would generally use online learning more in the scenario where the data distribution is shifting very rapidly and you need your model to update accordingly in a streaming process.

2 Likes

Thanks @dcooper01. After logging all the incorrectly classified images, Can we highly penalize the model for this incorrect classification so that for the next cases it can classify correctly? If so what would be the approach over here that you would follow?

I suppose it would depend on your particular use case (I hate that answer, but it really does depend!). I think you could consider a few different approaches.

I would probably try one of the following three options (in order of personal preference):

  1. Retrain model starting from original starter model (i.e. pre-trained ResNet34) with new training data as part of a weekly / monthly batch job that includes automated testing
  2. Update existing model with transfer learning / fine tuning strategy on new data (just run for a couple epochs probably)
  3. Incremental learning / online learning (but again, I’d only pursue this if I expected the data distribution to change rapidly and/or there were some characteristics of the data that made batch processing infeasible)

Other thoughts:

  • I would also have some basic monitoring / alerting in place that evaluates any shifts in data distribution (i.e. Does the data I trained on match what I’m seeing in production?)

There are a few things you could look into if you have a major class imbalance or some classes are just more difficult:

1 Like

Thanks for the detailed reply @dcooper01 . I will try the suggested methods :slight_smile:

1 Like