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

Further personalization with Face-Reco

Scheduled Pinned Locked Moved General Discussion
16 Posts 3 Posters 2.8k Views 4 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.
  • S Offline
    sdetweil @JerryP
    last edited by sdetweil Jan 11, 2021, 2:52 PM Jan 11, 2021, 2:37 PM

    @JerryP you are not following the doc.

    module: "compliments",
    classes:"......",
    config:{
       compliments:{
           ....
        }
    }
    

    https://docs.magicmirror.builders/modules/compliments.html#configuration-options

    Sam

    How to add modules

    learning how to use browser developers window for css changes

    J 1 Reply Last reply Jan 11, 2021, 5:28 PM Reply Quote 0
    • M Offline
      Macboy @JerryP
      last edited by Jan 11, 2021, 4:18 PM

      @JerryP

      Haha! Good to know! Thanks for pointing that out to me. It’s a pretty dormant Twitter account but I guess one never knows how that could be used.

      1 Reply Last reply Reply Quote 0
      • M Offline
        Macboy
        last edited by Jan 11, 2021, 4:29 PM

        @michmich @paviro

        I’m unable to edit the posts above with my wife’s tokens because too much time has passed since I posted. Do one of you have the ability to either redact that portion of the code snippets (the TimelineOrList sections) in both posts above?

        Possibly harmless to have that info out in public but someone could maliciously use her account for evil I guess. If the posts need to be removed that is okay as well. And if there is a method available to me to pull the posts or edit them I’m happy to do so - just let me know how. I’ll be more alert next time I start posting code. Funny enough I DID take a quick scan making sure I wasn’t posting SSIDs and passwords…haha

        If anyone else knows how I can change that up just let me know.

        1 Reply Last reply Reply Quote 0
        • J Offline
          JerryP @sdetweil
          last edited by Jan 11, 2021, 5:28 PM

          @sdetweil
          ??? WHATEVER… it’s not my account…

          Luckily @macboy is getting the hint :) :)

          M 1 Reply Last reply Jan 11, 2021, 6:18 PM Reply Quote 0
          • M Offline
            Macboy
            last edited by Macboy Jan 11, 2021, 6:13 PM Jan 11, 2021, 6:01 PM

            Just reposting the initial posts which I’ve deleted with the important info removed. (Thanks again for the heads up on what’s sensitive info and what’s not guys!)

            ------- Original post (in case anyone happens across this and doesn’t understand what my question/issue was) --------

            With my compliments.js per below and my config.js also per below, the Face Reco works. I’ll post a second reply here showing how I tried to change both of these files.

            Module.register("compliments", {
            	// Module config defaults.
            	defaults: {
            		compliments: {
            			anytime: ["Hey there, looking good!"],
            			morning: ["Good morning!", "Enjoy your day!", "Attack today!"],
            			afternoon: ["Hello, beauty!", "You look great!", "Looking good today!"],
            			evening: ["You nailed the day!", "What a great day!", "Hi family!"],
            			"....-01-01": ["Happy new year!"]
            		},
            		updateInterval: 80000,
            		remoteFile: null,
            		fadeSpeed: 4000,
            		morningStartTime: 3,
            		morningEndTime: 12,
            		afternoonStartTime: 12,
            		afternoonEndTime: 17,
            		random: true,
            		mockDate: null
            	},
            
            

            And my current config.js (the whole thing since I can’t figure out why it’s reverting to no Face Reco when I change it).

            var config = {
            	address: "localhost", 	// Address to listen on, can be:
            							// - "localhost", "127.0.0.1", "::1" to listen on loopback interface
            							// - another specific IPv4/6 to listen on a specific interface
            							// - "0.0.0.0", "::" to listen on any interface
            							// Default, when address config is left out or empty, is "localhost"
            	port: 8080,
            	basePath: "/", 	// The URL path where MagicMirror is hosted. If you are using a Reverse proxy
            					// you must set the sub path here. basePath must end with a /
            	ipWhitelist: ["127.0.0.1", "::ffff:127.0.0.1", "::1"], 	// Set [] to allow all IP addresses
            															// or add a specific IPv4 of 192.168.1.5 :
            															// ["127.0.0.1", "::ffff:127.0.0.1", "::1", "::ffff:192.168.1.5"],
            															// or IPv4 range of 192.168.3.0 --> 192.168.3.15 use CIDR format :
            															// ["127.0.0.1", "::ffff:127.0.0.1", "::1", "::ffff:192.168.3.0/28"],
            
            	useHttps: false, 		// Support HTTPS or not, default "false" will use HTTP
            	httpsPrivateKey: "", 	// HTTPS private key path, only require when useHttps is true
            	httpsCertificate: "", 	// HTTPS Certificate path, only require when useHttps is true
            
            	language: "en",
            	logLevel: ["INFO", "LOG", "WARN", "ERROR"],
            	timeFormat: 24,
            	units: "metric",
            	// serverOnly:  true/false/"local" ,
            	// local for armv6l processors, default
            	//   starts serveronly and then starts chrome browser
            	// false, default for all NON-armv6l devices
            	// true, force serveronly mode, because you want to.. no UI on this device
            
            	modules: [
            		{
                module: 'MMM-Face-Reco-DNN',
                config: {
                  // Logout 15 seconds after user was not detected any more
                  // If they are detected within this period, the delay will start again
                  logoutDelay: 15000,
                  // How often the recognition starts in milliseconds
                  // With a Raspberry Pi 3+ it works well every 2 seconds
                  checkInterval: 2000,
                  // Module set used for when there is no face detected ie no one is in front of the camera
                  noFaceClass: 'noface',
                  // Module set used for when there is an unknown/unrecognised face detected
                  unknownClass: 'unknown',
                  // Module set used for when there is a known/recognised face detected
                  knownClass: 'known',
                  // Module set used for strangers and if no user is detected
                  defaultClass: 'default',
                  // Set of modules which should be shown for any user ie when there is any face detected
                  everyoneClass: 'everyone',
                  // Set of modules that are always shown - show if there is a face or no face detected
                  alwaysClass: 'always',
                  // XML to recognize with haarcascade
                  cascade: 'modules/MMM-Face-Reco-DNN/tools/haarcascade_frontalface_default.xml',
                  // Pre-encoded pickle with the faces
                  encodings: 'modules/MMM-Face-Reco-DNN/tools/encodings.pickle',
                  // Use Raspberry Pi camera or another type
                  // 1 = RasPi camera, 0 = other camera
                  usePiCamera: 1,
                  // If using another type of camera, you can choose
                  // i.e. 0 = /dev/video0 or 'http://link.to/live'
                  source: 0,
                  // Rotate camera
                  rotateCamera: 0,
                  // Method of facial recognition
                  // dnn = deep neural network, haar = haarcascade
                  method: 'dnn',
                  // Which face detection model to use
                  // "hog" is less accurate but faster on CPUs
                  // "cnn" is a more accurate deep-learning model which is GPU/CUDA accelerated
                  detectionMethod: 'hog',
                  // How long in milliseconds modules take to hide and show
                  animationSpeed: 0,
                  // Path to Python to run the face recognition
                  // null or '' means default path
                  pythonPath: null,
                  // Should a welcome message be shown using the MagicMirror alerts module?
                  welcomeMessage: true,
                  // Capture new pictures of recognized people, if unknown we save it in folder "unknown"
                  // So you can extend your dataset and retrain it afterwards for better recognitions
                  extendDataset: false,
                  // If extendDataset is true, you need to set the full path of the dataset
                  dataset: 'modules/MMM-Face-Reco-DNN/dataset/',
                  // How much distance between faces to consider it a match. Lower is more strict.
                  tolerance: 0.6,
                  // allow multiple concurrent user logins, 0=no, any other number is the maximum number of concurrent logins
                  multiUser: 0,
                }
            },
            		{
            			module: "alert",
            		},
            		{
            			module: "updatenotification",
            			position: "top_bar"
            		},
            		{
            			module: "clock",
            			position: "top_left",
            			classes: 'always'
            		},
            		{
            			module: "calendar",
            			header: "Coming Up...",
            			position: "top_left",
            			classes: 'anna julia kathy kelly',
            			config: {
            				calendars: [
            					{
            						symbol: "calendar-check",
            						url: "https://"					}
            				]
            			}
            		},
            
            		{
            			module: "compliments",
            			position: "lower_third",
            			classes: 'kelly'
            		},
            
            		{
            			module: "currentweather",
            			position: "top_right",
            			classes: 'anna julia kathy kelly',
            			config: {
            				location: "Sherwood Park",
            				locationID: "5946768", //ID from http://bulk.openweathermap.org/sample/city.list.json.gz; unzip the gz file and find your city
            				appid: "71ddee6bbdcfb25b97866519bc4a52bc"
            			}
            		},
            	{
            		module: "MMM-weatherforecast",
            		position: "top_right",	// This can be any of the regions.
            					// Best results in bottom_bar region due to horizontal default layout and icon sizes.
            
            			classes: 'anna julia kathy kelly',
            		config: {
            			// See 'Configuration options' for more information.
            			location: "Sherwood Park",
            			locationID: "5946768", //Location ID from http://openweathermap.org/help/city_list.txt
            			appid: "71ddee6bbdcfb25b97866519bc4a52bc" //openweathermap.org API key.
            		}
            	},
            		{
            			module: "newsfeed",
            			position: "bottom_bar",
            			classes: 'anna julia',
            			config: {
            				feeds: [
            					{
            						title: "According to CBC",
            						url: "https://rss.cbc.ca/lineup/canada-edmonton.xml"
            					},
            										{
            						title: "Upcoming Family Opportunities",
            						url: "https://www.raisingedmonton.com/feed/"
            					}
            									],
            				showSourceTitle: true,
            				showPublishDate: true,
            				broadcastNewsFeeds: true,
            				broadcastNewsUpdates: true
            			}
            		},
            			{
            		module: 'MMM-TweetsByTimelineOrList',
            		position: 'bottom_right',
            		classes: 'kathy kelly',
            		config: {
            		// visit the url below for the twitter keys/tokens
            		// https://dev.twitter.com/oauth/overview/application-owner-access-tokens
            			consumer_key: 'XXXXX',
            			consumer_secret: 'XXXXX',
            			access_token_key: 'XXXXX',
            			access_token_secret: 'XXXXX',
            		// set the username and either timeline or listname
            	        screenName: 'XXXXXXXXXXX',
            	        listToShow: 'TIMELINE',
            		}
            	},
            	{
                        module: 'default/MMM-Dad-Jokes',
                        position: 'bottom_bar', // Or wherever you want
            
            		classes: 'anna julia',
                        config: {
                            updateInterval: 600000,
                            fadeSpeed: 4000
                        }
                    },
            		{
                module: 'default/MMM-ATM',
                position: 'bottom_bar',              // Works well anywhere
            	classes: 'anna julia',
                config: {
            	multipleChoice: "Yes",        // No = just the ? then the answer
            	useHeader: true,              // true if you want a header
            	header: "Feed your brain!",   // Any text you want
            	maxWidth: "1250px",             // Stretch or constrain according to region
                }
            }
            	]
            };
            
            /*************** DO NOT EDIT THE LINE BELOW ***************/
            if (typeof module !== "undefined") {module.exports = config;}
            
            
            1 Reply Last reply Reply Quote 0
            • M Offline
              Macboy
              last edited by Macboy Jan 11, 2021, 6:14 PM Jan 11, 2021, 6:04 PM

              ----- Original Post #2 ------

              So I just removed the list of compliments from the compliments.js ‘defaults’ section and pasted the same to config.js as per below. First the new compliments.js

              Module.register("compliments", {
              	// Module config defaults.
              	defaults: {
              		updateInterval: 80000,
              		remoteFile: null,
              		fadeSpeed: 4000,
              		morningStartTime: 3,
              		morningEndTime: 12,
              		afternoonStartTime: 12,
              		afternoonEndTime: 17,
              		random: true,
              		mockDate: null
              	},
              
              

              And the new config.js which disables the Face Reco and shows the compliments as undefined when the mirror loads.

              var config = {
              	address: "localhost", 	// Address to listen on, can be:
              							// - "localhost", "127.0.0.1", "::1" to listen on loopback interface
              							// - another specific IPv4/6 to listen on a specific interface
              							// - "0.0.0.0", "::" to listen on any interface
              							// Default, when address config is left out or empty, is "localhost"
              	port: 8080,
              	basePath: "/", 	// The URL path where MagicMirror is hosted. If you are using a Reverse proxy
              					// you must set the sub path here. basePath must end with a /
              	ipWhitelist: ["127.0.0.1", "::ffff:127.0.0.1", "::1"], 	// Set [] to allow all IP addresses
              															// or add a specific IPv4 of 192.168.1.5 :
              															// ["127.0.0.1", "::ffff:127.0.0.1", "::1", "::ffff:192.168.1.5"],
              															// or IPv4 range of 192.168.3.0 --> 192.168.3.15 use CIDR format :
              															// ["127.0.0.1", "::ffff:127.0.0.1", "::1", "::ffff:192.168.3.0/28"],
              
              	useHttps: false, 		// Support HTTPS or not, default "false" will use HTTP
              	httpsPrivateKey: "", 	// HTTPS private key path, only require when useHttps is true
              	httpsCertificate: "", 	// HTTPS Certificate path, only require when useHttps is true
              
              	language: "en",
              	logLevel: ["INFO", "LOG", "WARN", "ERROR"],
              	timeFormat: 24,
              	units: "metric",
              	// serverOnly:  true/false/"local" ,
              	// local for armv6l processors, default
              	//   starts serveronly and then starts chrome browser
              	// false, default for all NON-armv6l devices
              	// true, force serveronly mode, because you want to.. no UI on this device
              
              	modules: [
              		{
                  module: 'MMM-Face-Reco-DNN',
                  config: {
                    // Logout 15 seconds after user was not detected any more
                    // If they are detected within this period, the delay will start again
                    logoutDelay: 15000,
                    // How often the recognition starts in milliseconds
                    // With a Raspberry Pi 3+ it works well every 2 seconds
                    checkInterval: 2000,
                    // Module set used for when there is no face detected ie no one is in front of the camera
                    noFaceClass: 'noface',
                    // Module set used for when there is an unknown/unrecognised face detected
                    unknownClass: 'unknown',
                    // Module set used for when there is a known/recognised face detected
                    knownClass: 'known',
                    // Module set used for strangers and if no user is detected
                    defaultClass: 'default',
                    // Set of modules which should be shown for any user ie when there is any face detected
                    everyoneClass: 'everyone',
                    // Set of modules that are always shown - show if there is a face or no face detected
                    alwaysClass: 'always',
                    // XML to recognize with haarcascade
                    cascade: 'modules/MMM-Face-Reco-DNN/tools/haarcascade_frontalface_default.xml',
                    // Pre-encoded pickle with the faces
                    encodings: 'modules/MMM-Face-Reco-DNN/tools/encodings.pickle',
                    // Use Raspberry Pi camera or another type
                    // 1 = RasPi camera, 0 = other camera
                    usePiCamera: 1,
                    // If using another type of camera, you can choose
                    // i.e. 0 = /dev/video0 or 'http://link.to/live'
                    source: 0,
                    // Rotate camera
                    rotateCamera: 0,
                    // Method of facial recognition
                    // dnn = deep neural network, haar = haarcascade
                    method: 'dnn',
                    // Which face detection model to use
                    // "hog" is less accurate but faster on CPUs
                    // "cnn" is a more accurate deep-learning model which is GPU/CUDA accelerated
                    detectionMethod: 'hog',
                    // How long in milliseconds modules take to hide and show
                    animationSpeed: 0,
                    // Path to Python to run the face recognition
                    // null or '' means default path
                    pythonPath: null,
                    // Should a welcome message be shown using the MagicMirror alerts module?
                    welcomeMessage: true,
                    // Capture new pictures of recognized people, if unknown we save it in folder "unknown"
                    // So you can extend your dataset and retrain it afterwards for better recognitions
                    extendDataset: false,
                    // If extendDataset is true, you need to set the full path of the dataset
                    dataset: 'modules/MMM-Face-Reco-DNN/dataset/',
                    // How much distance between faces to consider it a match. Lower is more strict.
                    tolerance: 0.6,
                    // allow multiple concurrent user logins, 0=no, any other number is the maximum number of concurrent logins
                    multiUser: 0,
                  }
              },
              		{
              			module: "alert",
              		},
              		{
              			module: "updatenotification",
              			position: "top_bar"
              		},
              		{
              			module: "clock",
              			position: "top_left",
              			classes: 'always'
              		},
              		{
              			module: "calendar",
              			header: "Coming Up...",
              			position: "top_left",
              			classes: 'anna julia kathy kelly',
              			config: {
              				calendars: [
              					{
              						symbol: "calendar-check",
              						url: "https://"					}
              				]
              			}
              		},
              
              		{
              			module: "compliments",
              			position: "lower_third",
              			classes: 'kelly',
              			config: {
              			anytime: ["Hey there, looking good!"],
              			morning: ["Good morning!", "Enjoy your day!", "Attack today!"],
              			afternoon: ["Hello, beauty!", "You look great!", "Looking good today!"],
              			evening: ["You nailed the day!", "What a great day!", "Hi family!"],
              			"....-01-01": ["Happy new year!"]
              		}
              		},
              
              		{
              			module: "currentweather",
              			position: "top_right",
              			classes: 'anna julia kathy kelly',
              			config: {
              				location: "Sherwood Park",
              				locationID: "5946768", //ID from http://bulk.openweathermap.org/sample/city.list.json.gz; unzip the gz file and find your city
              				appid: "71ddee6bbdcfb25b97866519bc4a52bc"
              			}
              		},
              	{
              		module: "MMM-weatherforecast",
              		position: "top_right",	// This can be any of the regions.
              					// Best results in bottom_bar region due to horizontal default layout and icon sizes.
              
              			classes: 'anna julia kathy kelly',
              		config: {
              			// See 'Configuration options' for more information.
              			location: "Sherwood Park",
              			locationID: "5946768", //Location ID from http://openweathermap.org/help/city_list.txt
              			appid: "71ddee6bbdcfb25b97866519bc4a52bc" //openweathermap.org API key.
              		}
              	},
              		{
              			module: "newsfeed",
              			position: "bottom_bar",
              			classes: 'anna julia',
              			config: {
              				feeds: [
              					{
              						title: "According to CBC",
              						url: "https://rss.cbc.ca/lineup/canada-edmonton.xml"
              					},
              										{
              						title: "Upcoming Family Opportunities",
              						url: "https://www.raisingedmonton.com/feed/"
              					}
              									],
              				showSourceTitle: true,
              				showPublishDate: true,
              				broadcastNewsFeeds: true,
              				broadcastNewsUpdates: true
              			}
              		},
              			{
              		module: 'MMM-TweetsByTimelineOrList',
              		position: 'bottom_right',
              		classes: 'kathy kelly',
              		config: {
              		// visit the url below for the twitter keys/tokens
              		// https://dev.twitter.com/oauth/overview/application-owner-access-tokens
              			consumer_key: 'XXXXX',
              			consumer_secret: 'XXXXX',
              			access_token_key: 'XXXXX',
              			access_token_secret: 'XXXXX',
              		// set the username and either timeline or listname
              	        screenName: 'XXXXXXXXXXX',
              	        listToShow: 'TIMELINE',
              		}
              	},
              	{
                          module: 'default/MMM-Dad-Jokes',
                          position: 'bottom_bar', // Or wherever you want
              
              		classes: 'anna julia',
                          config: {
                              updateInterval: 600000,
                              fadeSpeed: 4000
                          }
                      },
              		{
                  module: 'default/MMM-ATM',
                  position: 'bottom_bar',              // Works well anywhere
              	classes: 'anna julia',
                  config: {
              	multipleChoice: "Yes",        // No = just the ? then the answer
              	useHeader: true,              // true if you want a header
              	header: "Feed your brain!",   // Any text you want
              	maxWidth: "1250px",             // Stretch or constrain according to region
                  }
              }
              	]
              };
              
              /*************** DO NOT EDIT THE LINE BELOW ***************/
              if (typeof module !== "undefined") {module.exports = config;}
              
              
              S 1 Reply Last reply Jan 11, 2021, 6:16 PM Reply Quote 0
              • S Offline
                sdetweil @Macboy
                last edited by Jan 11, 2021, 6:16 PM

                @Macboy cause u need to word compliments in the compliments config in config.js

                Sam

                How to add modules

                learning how to use browser developers window for css changes

                1 Reply Last reply Reply Quote 0
                • M Offline
                  Macboy @JerryP
                  last edited by Jan 11, 2021, 6:18 PM

                  @JerryP said in Further personalization with Face-Reco:

                  Luckily @macboy is getting the hint :) :)

                  I don’t want to come across as daft (now or in future posts) so forgive the clarification here. Is the hint I’m getting referring to “Don’t post sensitive info” or is this in reference to “I should read the docs”?

                  Both equally important I agree.

                  I’m new to this forum and through my searches over the past few weeks setting up my mirror I haven’t seen a lot of “Don’t annoy us, read the docs” posts like I’ve seen on other development type forums. But you guys could just have a kinder way about saying the same. I feel like for the most part I’ve followed the docs - hell…I’ve made it THIS far, right?

                  When I set up the compliments module…well, when I customized it I should say, I really didn’t know what I was doing (this was early in the first mirror setup). I looked into config.js AND compliments.js and saw the default compliments there (in compliments.js). So, I edited them there and they worked. Now however when I try to set them up “correctly” in config.js it for some reason disables the Face-Reco setup. I’ll try the above formatting after work and post back if I still can’t figure out what I’ve done wrong to mess up the Face Recognition.

                  I DO appreciate everyone’s help here, don’t think that I’m a “Log in and have people lay it all out for me” kind of guy. Many, many scratches to the head happen before I throw in the towel and ask for help - my wife will be the first to confirm that ; )

                  1 Reply Last reply Reply Quote 0
                  • M Offline
                    Macboy
                    last edited by Jan 11, 2021, 8:59 PM

                    It appears to be working now (snuck to the Pi on my lunch break). I left one compliment in the afternoon class of the defaults list in compliments.js and put one into the instance tagged with my name as the class in config.js using the proper formatting. I now see where I went wrong so thanks for the help. I’ll try making multiple instances in config.js with different users tagged in the classes.

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