nischi / MMM-Face-Reco-DNN

Face recognition with opencv and deep neural network
MIT License
91 stars 46 forks source link

BG translation #6

Closed ivanovd closed 5 years ago

ivanovd commented 5 years ago

Can you please add a Bulgarian transaltion as well:

{
  "message": "Здравей %person, радвам се да те видя!",
  "title": "Лицево разпознаване",
  "stranger": "непознат"
}

I was unable to do it ... the module was throwing an error when I added. bg.json to the translations folder and adding it to the getTranslations function in MMM-Face-Reco-DNN.js

The error after starting the module is:

SyntaxError: Unexpected token T in JSON at position 0
    at JSON.parse (<anonymous>)
    at PythonShell.asJson (/home/pi/MagicMirror/modules/MMM-Face-Reco-DNN/node_modules/python-shell/index.js:358:21)
    at /home/pi/MagicMirror/modules/MMM-Face-Reco-DNN/node_modules/python-shell/index.js:310:42
    at Array.forEach (<anonymous>)
    at PythonShell.recieveInternal (/home/pi/MagicMirror/modules/MMM-Face-Reco-DNN/node_modules/python-shell/index.js:306:15)
    at PythonShell.receiveStderr (/home/pi/MagicMirror/modules/MMM-Face-Reco-DNN/node_modules/python-shell/index.js:290:21)
    at Socket.<anonymous> (/home/pi/MagicMirror/modules/MMM-Face-Reco-DNN/node_modules/python-shell/index.js:108:18)
    at Socket.emit (events.js:182:13)
    at addChunk (_stream_readable.js:279:12)
    at readableAddChunk (_stream_readable.js:260:13)
{ Error: FileNotFoundError: [Errno 2] No such file or directory: 'modules/MMM-Face-Reco-DNN/tools/encodings.pickle'
    at PythonShell.parseError (/home/pi/MagicMirror/modules/MMM-Face-Reco-DNN/node_modules/python-shell/index.js:246:21)
    at terminateIfNeeded (/home/pi/MagicMirror/modules/MMM-Face-Reco-DNN/node_modules/python-shell/index.js:129:32)
    at ChildProcess.<anonymous> (/home/pi/MagicMirror/modules/MMM-Face-Reco-DNN/node_modules/python-shell/index.js:121:13)
    at ChildProcess.emit (events.js:182:13)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:237:12)
    ----- Python Traceback -----
    File "modules/MMM-Face-Reco-DNN/tools/facerecognition.py", line 49, in <module>
      data = pickle.loads(open(args["encodings"], "rb").read())
  traceback:
   'Traceback (most recent call last):\n  File "modules/MMM-Face-Reco-DNN/tools/facerecognition.py", line 49, in <module>\n    data = pickle.loads(open(args["encodings"], "rb").read())\nFileNotFoundError: [Errno 2] No such file or directory: \'modules/MMM-Face-Reco-DNN/tools/encodings.pickle\'\n',
  executable: 'python3',
  options: null,
  script: 'modules/MMM-Face-Reco-DNN/tools/facerecognition.py',
  args:
   [ '--cascade=modules/MMM-Face-Reco-DNN/tools/haarcascade_frontalface_default.xml',
     '--encodings=modules/MMM-Face-Reco-DNN/tools/encodings.pickle',
     '--usePiCamera=0',
     '--method=dnn',
     '--detectionMethod=hog',
     '--interval=2000',
     '--output=0' ],
  exitCode: 1 }

Thanks in advance

nischi commented 5 years ago

@ivanovd sure, i will try to add it.

But the error say something different: No such file or directory: 'modules/MMM-Face-Reco-DNN/tools/encodings.pickle'

Maybe a follow issue, i will test it.

ivanovd commented 5 years ago

Exactly, that is the strange thing. Once I remove the translation file and the bg language from the function and restart MM it starts without the error …

nischi commented 5 years ago

Your Language is also strange :-P I will test it as soon as possible

nischi commented 5 years ago

I can't reproduce the error you have. But i added Bulgarian translations and successfully testet it.

https://github.com/nischi/MMM-Face-Reco-DNN/tree/v1.0.3