novioleo / FOTS

implement FOTS and apply it on real scenario.
68 stars 23 forks source link

what about recognition of chinese? #17

Closed isyanan1024 closed 5 years ago

isyanan1024 commented 5 years ago

as above.

novioleo commented 5 years ago

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

isyanan1024 commented 5 years ago

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

novioleo commented 5 years ago

welcome.

------------------ 原始邮件 ------------------ 发件人: "isyanan1024"notifications@github.com; 发送时间: 2019年8月28日(星期三) 中午11:34 收件人: "novioleo/FOTS"FOTS@noreply.github.com; 抄送: "北国枫叶。"744351893@qq.com; "Comment"comment@noreply.github.com; 主题: Re: [novioleo/FOTS] what about recognition of chinese? (#17)

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

— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or mute the thread.

isyanan1024 commented 5 years ago

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!

novioleo commented 5 years ago

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

isyanan1024 commented 5 years ago

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

isyanan1024 commented 5 years ago

@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.

novioleo commented 5 years ago

@isyanan1024 https://discuss.pytorch.org/t/ctcloss-returns-negative-loss-after-some-batches/43607

isyanan1024 commented 5 years ago

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)

novioleo commented 5 years ago

feel free to try instead ask for help first.

isyanan1024 commented 5 years ago

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

novioleo commented 5 years ago

may i close this issue now? @isyanan1024

isyanan1024 commented 5 years ago

@novioleo yes . you can .

novioleo commented 4 years ago

depend on your train dataset and tricks.

---原始邮件--- 发件人: "isyanan1024"<notifications@github.com> 发送时间: 2019年8月28日 10:12:31 收件人: "novioleo/FOTS"<FOTS@noreply.github.com>; 抄送: "Subscribed"<subscribed@noreply.github.com>; 主题: [novioleo/FOTS] 你好,请问这个识别中文效果怎么样? (#17)

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or mute the thread.