autonise / CRAFT-Remade

Implementation of CRAFT Text Detection
MIT License
191 stars 47 forks source link

No Output After Training on Weak Supervision #54

Open theahmedmustafa opened 2 years ago

theahmedmustafa commented 2 years ago

I tried training for Weak supervision using the SynthText Strong supervision model on a custom data set.

I trained for just three epochs with 1000 iterations each but when I use the models that get saved at each iteration at save-path the inference results are totally blank! No bounding box is drawn on any image after prediction.

Here are a few other observations:

  1. The Test-(iteration) folders in save-path contains images from my test dateset with blue bounding boxes which I assume is the ground truth, but no predicted bounding box seem to be drawn
  2. My loss drops to 0 and my accuracy goes to one just after a few iterations in the first epoch
  3. My precision and recall are both 1.0. The cumulative F-score is nan, probably because at some stage it gives a division error for some reason.
  4. All the folders in both (iteration)-next-target and (iteration)-predicted folders in the Generated folder at target-path are empty
  5. Prediction on the SynthText Strong Supervision model works just fine

I did write a script to convert the annotations for my data to the ICDAR format (basically what the _preprocess function in main.py does), and it seems to match the required format, so I do not think that is the issue. The training runs without error.

Also, all the text annotations for the bounding boxes in my ground truth are ### since the data is not text level annotated, only the bounding boxes are drawn. I hope that is not the issue.

If you can make any sense of what the problem might be, kindly do tell me. Regards

mayank-git-hub commented 2 years ago

Hello @theahmedmustafa .

Text annotations are required for weak supervision as it uses the number of characters in the word to break the word bounding box into equal sized segments. If no text annotations are provided, the model will just be fine-tuned to predict the output of the targets generated using the strong supervised model, which can have a lot of errors. This will cause instability during training and could lead to the results you are getting.

theahmedmustafa commented 2 years ago

I added the text annotations to my data set and it has started to produce bounding boxes, however I am confused why all the folders inside Generated folder at target-path are always empty