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

Face Recognition - File can't be opened for writing

Scheduled Pinned Locked Moved Solved Troubleshooting
8 Posts 4 Posters 14.1k 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.
  • F Offline
    feuerball
    last edited by paviro May 10, 2016, 4:46 AM May 9, 2016, 11:01 PM

    Well the Mirror and the modules are working for now.

    The next step is to seperate modules to specific users so i use the FaceRec lib.

    I trained 10 images first for a quick test.
    When im trying to start MMv2 with this module he pushes this error message:

    [MMM-Facial-Recognition] Facerecognition started...
    [MMM-Facial-Recognition] Loading training data...
    [MMM-Facial-Recognition] ALGORITHM: LBPH
    Whoops! There was an uncaught exception...
    { [Error: OpenCV Error: Unspecified error (File can't be opened for writing!) in load, file /build/opencv-ISmtkH/opencv-2.4.9.1+dfsg/modules/contrib/src/facerec.cpp, line 325
    Traceback (most recent call last):
      File "modules/MMM-Facial-Recognition/facerecognition/facerecognition.py", line 59, in <module>
        model.load(json.loads(sys.argv[1])["trainingFile"])
    cv2.error: /build/opencv-ISmtkH/opencv-2.4.9.1+dfsg/modules/contrib/src/facerec.cpp:325: error: (-2) File can't be opened for writing! in function load
    >]
      executable: 'python',
      options: null,
      script: 'modules/MMM-Facial-Recognition/facerecognition/facerecognition.py',
      args: [ '{"recognitionAlgorithm":1,"lbphThreshold":50,"fisherThreshold":250,"eigenThreshold":3000,"useUSBCam":false,"trainingFile":"~/MagicMirror/modules/MMM-Facial-Recognition/training.xml","interval":1,"logoutDelay":15,"users":["Marvin"],"defaultClass":"default","forAllClass":"for_all"}' ],
      exitCode: 1 }
    MagicMirror will not quit, but it might be a good idea to check why this happened. Maybe no internet connection?
    If you think this really is an issue, please open an issue on GitHub: https://github.com/MichMich/MagicMirror/issues
    
    1 Reply Last reply Reply Quote 0
    • K Offline
      KirAsh4 Moderator
      last edited by May 9, 2016, 11:53 PM

      Looks like it doesn’t have permission to open your trainingFile:

      model.load(json.loads(sys.argv[1])[“trainingFile”])
      cv2.error: /build/opencv-ISmtkH/opencv-2.4.9.1+dfsg/modules/contrib/src/facerec.cpp:325: error: (-2) File can’t be opened for writing! in function load
      

      Notice the File can't be opened for writing message.

      Wherever it’s trying to create that file, the main process running MM can’t write to that location.

      A Life? Cool! Where can I download one of those from?

      1 Reply Last reply Reply Quote 0
      • P Offline
        paviro Admin
        last edited by May 10, 2016, 4:43 AM

        Probably it does not even exist in that path. Be sure to add the training file path to the conduct of put it in the module folder.

        We're all stories in the end. Just make it a good one, eh?

        – The Doctor

        1 Reply Last reply Reply Quote 0
        • F Offline
          feuerball
          last edited by May 10, 2016, 6:54 AM

          The XML file is located in the module path mmm-facial-recognition.
          I will answer more precisely when I’m back hat home

          1 Reply Last reply Reply Quote 0
          • F Offline
            feuerball
            last edited by feuerball May 11, 2016, 5:25 PM May 11, 2016, 5:24 PM

            So, my internet is back after a day :D

            I reinstalled the module with deleting & cloning it again.

            The training.xml is located in

            /home/pi/MagicMirror/modules/MMM-Facial-Recognition

            I installed open cv with

            sudo apt-get install libopencv-dev python-opencv

            after this, i went into the folder

            MMM-Facial-Recognition

            and typed

            sudo npm install

            I still get the same error MSG :(

            i also changed the rights on the training.xml to Anyone/Anyone/Anyone

            please help <3

            P 1 Reply Last reply May 11, 2016, 6:33 PM Reply Quote 0
            • P Offline
              paviro Admin @feuerball
              last edited by May 11, 2016, 6:33 PM

              @feuerball try putting it somewhere else and set the trainingFile setting in your config :)

              We're all stories in the end. Just make it a good one, eh?

              – The Doctor

              1 Reply Last reply Reply Quote 1
              • F Offline
                feuerball
                last edited by May 11, 2016, 7:29 PM

                well i rewrote the destination of the file @ the config again and now it works.

                seems like there was an error anywhere :D

                thanks :)

                P 1 Reply Last reply Mar 31, 2017, 4:47 PM Reply Quote 0
                • P Offline
                  pgb168 @feuerball
                  last edited by Mar 31, 2017, 4:47 PM

                  @feuerball I didn’t understand what is the config

                  I am having the same error

                  1 Reply Last reply Reply Quote 0
                  • 1 / 1
                  • First post
                    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