xulihang / ImageTrans-docs

Documentation of ImageTrans, a computer-aided image translation tool. ImageTrans的文档项目。ImageTrans是一款计算机辅助图片/漫画翻译软件。
https://imagetrans.readthedocs.io/
87 stars 9 forks source link

Error related to machine translation comes repeatedly #31

Closed KillerXSF closed 3 years ago

KillerXSF commented 3 years ago

error: java.lang.NullPointerException StackTrace: java.lang.NullPointerException at anywheresoftware.b4a.keywords.Common.WaitFor(Common.java:1054) at org.xulihang.imagetrans.mt$ResumableSub_getMT.resume(mt.java:646) at org.xulihang.imagetrans.mt._getmt(mt.java:511) at org.xulihang.imagetrans.main$ResumableSub_showTM.resume(main.java:16121) at anywheresoftware.b4a.BA.checkAndRunWaitForEvent(BA.java:136) at anywheresoftware.b4a.BA.raiseEvent2(BA.java:85) at anywheresoftware.b4a.BA.raiseEvent(BA.java:78) at anywheresoftware.b4a.keywords.Common$3.run(Common.java:1086) at com.sun.javafx.application.PlatformImpl.lambda$null$5(PlatformImpl.java:295) at java.security.AccessController.doPrivileged(Native Method) at com.sun.javafx.application.PlatformImpl.lambda$runLater$6(PlatformImpl.java:294) at com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:95) at com.sun.glass.ui.win.WinApplication._runLoop(Native Method) at com.sun.glass.ui.win.WinApplication.lambda$null$3(WinApplication.java:177) at java.lang.Thread.run(Thread.java:748)

xulihang commented 3 years ago

I need more details. What is the MT you choose? It may need your own API keys.

And how did this happen (exact steps)?

KillerXSF commented 3 years ago

I used ocrspace. The mentioned error pops up when i select a box to move. I close the pop up and move the box but for the next box the error pops up again.

KillerXSF commented 3 years ago

Others - baidu, azure, google. They either show null or don't detect the text to translate. Ocrspace is the only one which works but translation is bad.

xulihang commented 3 years ago

OCRSPACE is not a machine translation service. You can see from the log that the problem is related to machine translation.

Tencent, Baidu, Niutrans and Google are the machine translation services that are usable without manual setup of API keys.

xulihang commented 3 years ago

You need to apply your own API keys if you want to use OCRs like Google. I've written about this in FAQ.

Baidu OCR should be able to work. I don't see why it can't work. Maybe your internet is restricted.

xulihang commented 3 years ago

If the Translation Assist Tab is switched to, the program will automatically call machine translation: image

Go to preferences to set which MT to use:

image

KillerXSF commented 3 years ago

Where should I confirm from which machine translator was used?

KillerXSF commented 3 years ago

I disabled microsoft machine translator from preferences. It solved the issue.

xulihang commented 3 years ago

See the notes in the translation candidate list: image

KillerXSF commented 3 years ago

You need to apply your own API keys if you want to use OCRs like Google. I've written about this in FAQ.

Baidu OCR should be able to work. I don't see why it can't work. Maybe your internet is restricted.

When baidu is enabled, the same error pops up. I have installed baidu and allowed access to internet. So internet restrictions shouldn't be the cause.

xulihang commented 3 years ago

There are Baidu machine translation and Baidu OCR. They are different. It's strange that enabling Baidu MT will cause such a problem.

KillerXSF commented 3 years ago

IMG_20210418_193719.jpg These all are enabled when i get the error.

xulihang commented 3 years ago

Do not enable Google. This requires your personal API keys.

KillerXSF commented 3 years ago

On disabling baidu, no error is found. I translating vertical traditional chinese to english. Which one would be best among these?

xulihang commented 3 years ago

Could you give me a sample image?

I think Baidu OCR is the best. But some steps may have to be done to make it to give the best result.

Like detect the text areas first and then OCR these areas separately.

If the text's reading order is right-to-left, you have to set this in the project settings.

xulihang commented 3 years ago

Some offline Chinese OCRs have good result, like ChineseOCR-lite and PaddleOCR. But they are not included by default.

KillerXSF commented 3 years ago

Baidu is not working even after i did everything as you said. Tencent, niutrans give somewhat correct translation.

On Sun, 18 Apr, 2021, 7:51 pm xulihang, @.***> wrote:

Could you give me a sample image?

I think Baidu OCR is the best. But some steps may have to be done to make it to give the best result.

Like detect the text areas first and then OCR these areas separately.

If the text's reading order is right-to-left, you have to set this in the project settings.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/xulihang/ImageTrans-docs/issues/31#issuecomment-821999221, or unsubscribe https://github.com/notifications/unsubscribe-auth/ATSCRODDGB67D62WUBHVQDDTJLTF7ANCNFSM43EG4ZNQ .

xulihang commented 3 years ago

Have you changed the default API settings? If so, you can unzip ImageTrans to restore its default settings.

image

xulihang commented 3 years ago

Please note that ImageTrans is a computer-aided translation tool. If you know nothing about Chinese, it may be difficult for you to read these images relying solely on the raw OCR and machine translation results.

KillerXSF commented 3 years ago

Yes i understand that. I will do as you said. Thank you!