<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Magic mirror using hdf5]]></title><description><![CDATA[<p dir="auto">Hello!<br />
I am making emotion detection module but some error message appears.</p>
<pre><code>Traceback (most recent call last):
  File "modules/MMM-Test/face.py", line 11, in &lt;module&gt;
    emotion_classifier = load_model(os.getcwd()+'/files/emotion_model.hdf5', compile=False)
  File "/home/pi/.local/lib/python3.7/site-packages/tensorflow_core/python/keras/saving/save.py", line 140, in load_model
    loader_impl.parse_saved_model(filepath)
  File "/home/pi/.local/lib/python3.7/site-packages/tensorflow_core/python/saved_model/loader_impl.py", line 83, in parse_saved_model
    constants.SAVED_MODEL_FILENAME_PB))
OSError: SavedModel file does not exist at: /home/pi/MagicMirror/files/emotion_model.hdf5/{saved_model.pbtxt|saved_model.pb}

    at PythonShell.parseError (/home/pi/MagicMirror/modules/MMM-Test/node_modules/python-shell/index.js:268:21)
    at terminateIfNeeded (/home/pi/MagicMirror/modules/MMM-Test/node_modules/python-shell/index.js:139:32)
    at ChildProcess.&lt;anonymous&gt; (/home/pi/MagicMirror/modules/MMM-Test/node_modules/python-shell/index.js:131:13)
    at ChildProcess.emit (events.js:182:13)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:237:12)
  executable: 'python3',
  options: null,
  script: 'modules/MMM-Test/face.py',
  args: null,
  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
Shutting down server...
</code></pre>
<p dir="auto">And finally I found that this error message appears when<br />
there is no “emotion_model.hdf5” in file/home/pi/MagicMirror/files/.<br />
When I run it with python3 it works well, and if I intentionally change the name of hdf5 file as “happy_model.hdf5” and run it with python3, same error appears.<br />
So I realized that this error means that there is no hdf5 file in the directory.<br />
Even though I can run it with python3, when I try to run it with magicmirror, because of that error message I couldn’t run it with magic mirror.</p>
<p dir="auto">I even eliminate everything except the line that means loading hdf5 file as follows.</p>
<pre><code>import cv2
import numpy as np   
from tensorflow.keras.preprocessing.image import img_to_array
from tensorflow.keras.models import load_model
import os
import json
import sys
import time
# Face detection XML load and trained model loading
face_detection = cv2.CascadeClassifier(os.getcwd()+'/files/haarcascade_frontalface_default.xml')
emotion_classifier = load_model(os.getcwd()+'/files/emotion_model.hdf5', compile=False)
</code></pre>
<p dir="auto">But same error message appears.<br />
Is there anyone who have ever experienced this problem or who can give me advice?<br />
Thank you.</p>
]]></description><link>https://forum.magicmirror.builders/topic/11602/magic-mirror-using-hdf5</link><generator>RSS for Node</generator><lastBuildDate>Fri, 06 Mar 2026 21:04:29 GMT</lastBuildDate><atom:link href="https://forum.magicmirror.builders/topic/11602.rss" rel="self" type="application/rss+xml"/><pubDate>Fri, 15 Nov 2019 12:44:35 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Magic mirror using hdf5 on Mon, 18 Nov 2019 13:18:53 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/16kyj" aria-label="Profile: 16KYJ">@<bdi>16KYJ</bdi></a> said in <a href="/post/64641">Magic mirror using hdf5</a>:</p>
<blockquote>
<p dir="auto">os.getcwd()</p>
</blockquote>
<p dir="auto">it returns the current working directory…  (result of cd)</p>
<p dir="auto">you would have to modify the script to find where IT is located</p>
<p dir="auto">see <a href="https://stackoverflow.com/questions/595305/how-do-i-get-the-path-of-the-python-script-i-am-running-in" target="_blank" rel="noopener noreferrer nofollow ugc">https://stackoverflow.com/questions/595305/how-do-i-get-the-path-of-the-python-script-i-am-running-in</a></p>
]]></description><link>https://forum.magicmirror.builders/post/64653</link><guid isPermaLink="true">https://forum.magicmirror.builders/post/64653</guid><dc:creator><![CDATA[sdetweil]]></dc:creator><pubDate>Mon, 18 Nov 2019 13:18:53 GMT</pubDate></item><item><title><![CDATA[Reply to Magic mirror using hdf5 on Mon, 18 Nov 2019 07:34:59 GMT]]></title><description><![CDATA[<p dir="auto">I finally found that if I start magic mirror using “npm start”<br />
even if python code is not in ~/Magicmirror folder, os.getcwd() return ~/Magicmirror folder.<br />
I thought that it will return the location of the python code.</p>
]]></description><link>https://forum.magicmirror.builders/post/64641</link><guid isPermaLink="true">https://forum.magicmirror.builders/post/64641</guid><dc:creator><![CDATA[16KYJ]]></dc:creator><pubDate>Mon, 18 Nov 2019 07:34:59 GMT</pubDate></item></channel></rss>