cloud-annotations / object-detection-react

⚛️ Real-Time Custom Object Detection with TensorFlow.js
MIT License
255 stars 108 forks source link

Download Model Stuck #15

Closed sachinshelke closed 4 years ago

sachinshelke commented 4 years ago

Hi, Model size is around 22 MB. many time is download smoothly but when slow internet detected, downloading stuck at 92%. here is the implementation

await tf.loadGraphModel( MODEL_PATH, 
       {
           onProgress: (progress)=> {
                   console.log('Model Progress' + progress)
           }
      }
)

Have tried to call this function again but still no it stuck at this at 92% and does not further proceed.

How to reproduce? Clear cache, in inspect mode --> Network --> Network Speed --> Slow 3G

After couple of iteration of above step it can be reproduce.

Understand that this is not related to ml, but still asking if get any solution.

bourdakos1 commented 4 years ago

Just to clarify, does the model never load? or do you just never get a progress callback for 100%?

sachinshelke commented 4 years ago

Its 7:3 ratio. Many time it loads and get the callback of 100% as well however may time it stuck at 92%. It work fine if we reload page.

Tensorflow uses Promise to download model and there is no way to cancel promise. I tried hack using promise.race([debouncePromise, downloadModelPromise])with debounce of 10 sec of progress difference. But even if debouncePromise calls first downloadModelPromise keep running and showing progress. So technically it won't be possible to cancel promise.

I tried with restart download process but it reiterate till 92% and again stuck. Seems like tf.loadGraphModel() internally check if model downloading or not.

Just would like to know that, Can it be possible to reinitiate download model process? :)

bourdakos1 commented 4 years ago

I would open this on https://github.com/tensorflow/tfjs

I don't think there's anything I can do about this