novioleo/FOTS

what about recognition of chinese?

isyanan1024 opened this issue · 14 comments

as above.

descide by your dataset and your augmentation and other train tricks.
this framework just put the east and crnn together.
fots do not improve acc too much,but speedup the inference process.
feel free to try beyond ask.
@isyanan1024

Thank you. I will try and give my results for your reference.

hello! I am coming again,when i do this "gpus": [].The model is ok.
Train Epoch: 1 [0/856 (0%)] Loss: 15.064854 Detection Loss: 0.023753 Recognition Loss:15.041101
Train Epoch: 1 [16/856 (2%)] Loss: 13.251626 Detection Loss: 0.023268 Recognition Loss:13.228358
Train Epoch: 1 [32/856 (4%)] Loss: 9.033509 Detection Loss: 0.023247 Recognition Loss:9.010262
But "gpus": [2] this,it does't work.I don't know how to put target data on gpu.
Traceback (most recent call last):
File "train.py", line 93, in
main(config, args.resume)
File "train.py", line 60, in main
trainer.train()
File "/home/yana/OCR/FOTS/base/base_trainer.py", line 79, in train
result = self._train_epoch(epoch)
File "/home/yana/OCR/FOTS/trainer/trainer.py", line 90, in _train_epoch
training_mask)
File "/root/anaconda3/lib/python3.7/site-packages/torch/nn/modules/module.py", line 547, in call
result = self.forward(*input, **kwargs)
File "/home/yana/OCR/FOTS/model/loss.py", line 90, in forward
recognition_loss = self.recognition_loss(y_true_recog, y_pred_recog)
File "/root/anaconda3/lib/python3.7/site-packages/torch/nn/modules/module.py", line 547, in call
result = self.forward(*input, **kwargs)
File "/home/yana/OCR/FOTS/model/loss.py", line 61, in forward
loss = self.ctc_loss(pred[0], gt[0], pred[1], gt[1])
File "/root/anaconda3/lib/python3.7/site-packages/torch/nn/modules/module.py", line 547, in call
result = self.forward(*input, **kwargs)
File "/root/anaconda3/lib/python3.7/site-packages/torch/nn/modules/loss.py", line 1295, in forward
self.zero_infinity)
File "/root/anaconda3/lib/python3.7/site-packages/torch/nn/functional.py", line 1767, in ctc_loss
zero_infinity)
RuntimeError: Tensor for argument #2 'targets' is on CPU, but expected it to be on GPU (while checking arguments for ctc_loss_gpu)

I have tried servel methods,but it doen't work.can you help me fix it!

@isyanan1024 convert targets to cuda tensor and parallelize targets with data.parallel method.

Why is there a negative value?
Train Epoch: 1 [0/856 (0%)] Loss: 15.064854 Detection Loss: 0.023753 Recognition Loss:15.041101
Train Epoch: 1 [16/856 (2%)] Loss: 13.251626 Detection Loss: 0.023268 Recognition Loss:13.228358
Train Epoch: 1 [32/856 (4%)] Loss: 9.033509 Detection Loss: 0.023247 Recognition Loss:9.010262
Train Epoch: 1 [48/856 (6%)] Loss: 3.983241 Detection Loss: 0.024929 Recognition Loss:3.958312
Train Epoch: 1 [64/856 (7%)] Loss: -1.337442 Detection Loss: 0.035711 Recognition Loss:-1.373154
Train Epoch: 1 [80/856 (9%)] Loss: -2.451252 Detection Loss: 0.026129 Recognition Loss:-2.477382
Train Epoch: 1 [96/856 (11%)] Loss: -3.242201 Detection Loss: 0.052011 Recognition Loss:-3.294212

@nov

@isyanan1024 convert targets to cuda tensor and parallelize targets with data.parallel method.

Thank you!Maybe you should change this in this repo,because most of us should be use cuda.

gt = (tensor([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0], dtype=torch.int32), tensor([9, 8, 7, 6, 7, 5, 4, 4, 4, 5, 6, 4, 4, 5], dtype=torch.int32))
it's a tuple,how can i convert this to cuda tensor?
like this?
gt = torch.tensor(gt)

feel free to try instead ask for help first.

Yes,you are right.
I am so shame to that.
Thank you!

may i close this issue now? @isyanan1024

@novioleo yes . you can .