• Recent
  • Tags
  • Unsolved
  • Solved
  • MagicMirror² Repository
  • Documentation
  • 3rd-Party-Modules
  • Donate
  • Discord
  • Register
  • Login
MagicMirror Forum
  • Recent
  • Tags
  • Unsolved
  • Solved
  • MagicMirror² Repository
  • Documentation
  • 3rd-Party-Modules
  • Donate
  • Discord
  • Register
  • Login
A New Chapter for MagicMirror: The Community Takes the Lead
Read the statement by Michael Teeuw here.

MMM-Face-Reco-DNN TypeError: '<' not supported between instances of 'numpy.ndarray' and 'str'

Scheduled Pinned Locked Moved Troubleshooting
8 Posts 3 Posters 1.3k Views 3 Watching
Loading More Posts
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • G Offline
    ghiesseldorf
    last edited by Jul 20, 2020, 7:14 PM

    Running on Raspberry Pi 3 and Pi-camera on Raspian buster latest. When testing the MMM-Face_Reco-DDN facerecognition.py module stand alone, faces are correctly identified in the camera and [names] output. However, when running from MagicMirror, the error occurs, and it looks like it is complaining about improper use of a boolean operator in the code. I don’t know python data class rules, but if this was a code issue, surely others woudl have seen it in this module? Do I maybe have a lost data class object or something? PythonSherrError: TypeError: ‘<’ not supported between instances of ‘numpy.ndarray’ and ‘str’ is received, and the python traceback seems to point to the facerecognition.py module.```

    [ERROR]  Whoops! There was an uncaught exception...
    [2020-07-20 13:16:36.029] [ERROR]  PythonShellError: TypeError: '<' not supported between instances of 'numpy.ndarray' and 'str'
        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:200:13)
        at Process.ChildProcess._handle.onexit (internal/child_process.js:272:12)
        ----- Python Traceback -----
        File "modules/MMM-Face-Reco-DNN/tools/facerecognition.py", line 143, in <module>
          if minDistance < args["tolerance"]: {
      traceback: 'Traceback (most recent call last):\n  File ' +
        '"modules/MMM-Face-Reco-DNN/tools/facerecognition.py", line ' +
        '143, in <module>\n    if minDistance < args["tolerance"]:\n' +
        "TypeError: '<' not supported between instances of " +
        "'numpy.ndarray' and 'str'\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=1',
        '--source=0',
        '--rotateCamera=0',
        '--method=dnn',
        '--detectionMethod=hog',
        '--interval=2000',
        '--output=0',
        '--extendDataset=False',
        '--dataset=modules/MMM-Face-Reco-DNN/dataset/',
        '--tolerance=0.6'
      ],
      exitCode: 1
    
    
    G 1 Reply Last reply Jul 20, 2020, 7:17 PM Reply Quote 0
    • G Offline
      ghiesseldorf @ghiesseldorf
      last edited by Jul 20, 2020, 7:17 PM

      @ghiesseldorf ```
      [ERROR] Whoops! There was an uncaught exception…
      [2020-07-20 13:16:36.029] [ERROR] PythonShellError: TypeError: ‘<’ not supported between instances of ‘numpy.ndarray’ and ‘str’
      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. (/home/pi/MagicMirror/modules/MMM-Face-Reco-DNN/node_modules/python-shell/index.js:121:13)
      at ChildProcess.emit (events.js:200:13)
      at Process.ChildProcess._handle.onexit (internal/child_process.js:272:12)
      ----- Python Traceback -----
      File “modules/MMM-Face-Reco-DNN/tools/facerecognition.py”, line 143, in
      if minDistance < args[“tolerance”]: {
      traceback: 'Traceback (most recent call last):\n File ’ +
      '“modules/MMM-Face-Reco-DNN/tools/facerecognition.py”, line ’ +
      ‘143, in \n if minDistance < args[“tolerance”]:\n’ +
      "TypeError: ‘<’ not supported between instances of " +
      “‘numpy.ndarray’ and ‘str’\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=1’,
      ‘–source=0’,
      ‘–rotateCamera=0’,
      ‘–method=dnn’,
      ‘–detectionMethod=hog’,
      ‘–interval=2000’,
      ‘–output=0’,
      ‘–extendDataset=False’,
      ‘–dataset=modules/MMM-Face-Reco-DNN/dataset/’,
      ‘–tolerance=0.6’
      ],
      exitCode: 1

      1 Reply Last reply Reply Quote 0
      • G Offline
        ghiesseldorf
        last edited by Jul 20, 2020, 8:45 PM

        It does look like there is a dataclass issue with the “tolerance” variable. Running facerecognition.py from the commandline with only the --cascade & --encodings parameters, the module executes. However, if adding the --tolerance parameter which alters the variable from the default value, it fails on the boolean statement. Also, even commenting out the variable in the MM config.js file apparently still passes something to the module for this variable, because it fails the same as including the --tolerance value at stand alone startup. So, any thoughts on how to fix it??

        1 Reply Last reply Reply Quote 0
        • G Offline
          ghiesseldorf
          last edited by Jul 20, 2020, 9:33 PM

          FIXED: updated the ap.add_argument statement (line 66) of facerecognition.py to include “type=float” on the --tolerance variable

          S K 2 Replies Last reply Jul 21, 2020, 12:41 AM Reply Quote 2
          • S Away
            sdetweil @ghiesseldorf
            last edited by Jul 21, 2020, 12:41 AM

            @ghiesseldorf good catch! why suddenly float after all this time?

            Sam

            How to add modules

            learning how to use browser developers window for css changes

            G 1 Reply Last reply Jul 21, 2020, 11:20 PM Reply Quote 0
            • G Offline
              ghiesseldorf @sdetweil
              last edited by Jul 21, 2020, 11:20 PM

              @sdetweil “after all this time” is right! I kept telling myself the issue couldn’t be the code itself because there were no posts about it on the forum, so it had to be something I (or my environment) was doing wrong.

              S 1 Reply Last reply Jul 21, 2020, 11:34 PM Reply Quote 0
              • S Away
                sdetweil @ghiesseldorf
                last edited by Jul 21, 2020, 11:34 PM

                @ghiesseldorf I was working on a 4 yr old piece of code a couple weeks ago that was suddenly failing. turns out the node version fixed some expression evaluation problem, and boom it broke old unchanged code,
                now, the expression should have returned false, as it does now. but did return true.

                Sam

                How to add modules

                learning how to use browser developers window for css changes

                1 Reply Last reply Reply Quote 0
                • K Offline
                  kobiavr @ghiesseldorf
                  last edited by Jul 24, 2020, 5:28 PM

                  @ghiesseldorf Thanks a lot, I had the same error after the last update and it fixed it for me

                  1 Reply Last reply Reply Quote 0
                  • 1 / 1
                  1 / 1
                  • First post
                    1/8
                    Last post
                  Enjoying MagicMirror? Please consider a donation!
                  MagicMirror created by Michael Teeuw.
                  Forum managed by Sam, technical setup by Karsten.
                  This forum is using NodeBB as its core | Contributors
                  Contact | Privacy Policy