At first, researched and investigated the new ideas and concepts that were available. We chose a method that was both energy efficient and cost effective based on the information we gained. Then, at that point, we recorded our necessities and targets and chose the parts that it required. We decided to try something new with the microcontroller, so instead of sticking with the Arduino, we chose something new like the bolt IoT WIFI module. The next thing we decided to do was design the lock so that it could be attached to the door. We chose a model with a rectangle shape for this project so that it could hold all of the main parts. A real-time environment must be taken into account during simulation after design.

In contrast to the conventional technique, it works directly with the face rather than the key, which allows anyone with the key to enter even if they are not authorised to do so. This technique is regarded as an additional security measure to keep intruders out of a certain area. Face recognition is a method for automatically recognizing, comparing, and matching a human face from a live video feed with other images from a database of authorized individuals. Figure 1 depicts the primary steps involved in putting this concept into action in real time.

At home, the primary computer at the site is a Raspberry Pi model 3B+. It runs Raspbian Stretch OS in the prototype that was shown to you. The Secure Shell (SSH) protocol is used to access Pi before it is used in the development process, and its Virtual Network Computing (VNC) server is enabled. After that, the VNC viewer software is used to access this Pi whenever it is needed for work. The primary benefit of this is that Pi can be utilized with the peripherals of a PC or a PC, without having to remotely join a HDMI screen, a mouse, and a console to it. The Pi performs multiple functions within the security system. It is in charge of keeping an eye on the proximity sensor and triggers that cause the Pi camera to take an image. A suitable cloud service will receive the image. Other than these undertakings, it needs to stand by listening to another cloud administration that illuminates Pi regarding whether to open or close the door‟s lock and on the off chance that the entryway is to be opened, it needs to bring an ID to be shown on the LCD screen message. The Raspberry Pi continually should be associated with the web. A camera module associated with the Pi is liable for catching a picture on both of the two triggers - the first is the squeezing of the doorbell which is likewise interacted with the Raspberry Pi. A push-button doorbell is used to represent the prototype. The second trigger is when someone stays near the house (via a proximity sensor) for more than a certain amount of time. The proximity sensor in the prototype shown here is an infrared sensor. For the entryway exchanging framework, a Drove bulb addresses the exchanging of the entryway that occurs after the order is transferred to the Raspberry Pi from the versatile application through the cloud. Figure 2 depicts an LCD module used to represent the LCD screen.

Raspberry pi, which fills in as the primary gadget regulator in our framework. Raspberry pi arranges the camera to catch and store the picture. Additionally, sensors are directly connected to a door-motion-equipped Raspberry Pi. To comprehend how the facial recognition and alert system works, let's say a person stays in the house for more than ten seconds, which is the predetermined time limit. This is detected by the IR sensor, and the Raspberry Pi checks to see if a presence has been detected for more than ten seconds before activating the camera to take a picture. A Lambda detects this and sends the image to Rekognition as soon as it is uploaded to an S3 bucket called "Visitors." The image is given a name and a time stamp. A second Lambda compares the features extracted by Rekognition to those in the "Known" database. A match is made and the name-tag of the match is extracted if a confidence value of at least 90% is reached. There is no match if the confidence value is less than 90%. One way or the other, the outcomes are shipped off the enlisted email/s. On the application, a warning is sent, and in a window the client can see the photograph taken by the Raspberry Pi camera, as well as the related label which is either „unknown‟ or the ID in the event that the individual external the house is known. The doorbell is rung by the same door. A picture is taken as soon as the doorbell switch is pressed, and a time buffer of five seconds is provided to prevent multiple pictures from being taken during the time the switch is pressed. Now, suppose Mr. X is the person at the door, and the users who were alerted want to let him in. For this, the client switches the slider button on the application. In order to prevent accidental errors, when the user tries to toggle it, a prompt appears asking if they are confident in the operation. Solely after the client consents to the brief, the button flips. A Lambda that takes the status value and updates it in another DynamoDB database with only a key-value pair is triggered when this button is toggled. The value is either 0 or 1, and the key is "door_status." Open means 1, and closed means 0. When this worth update happens, another Lambda takes this worth (1) from the information base and moves it to the Raspberry Pi, which turns the Drove bulb on, implying that the entryway lock is exchanged open. The same Lambda also carries the face-match result, or the string "unknown" if the door is unlocked for a person the system doesn't know. If the door is unlocked for a known person, the Lambda carries a name tag. The LCD module displays "Welcome, Mr. X" because the individual in this instance is known and has a name tag that reads "Mr. X." In the event that the individual at the entryway is obscure to the framework, however the entryway is opened for them, then no hello message would appear on the LCD module.

## 3.1 Distributed encoder Shannon Gaussian Correntropy Bayesian Q-neural networks (DeSGCBQNN) based face detection of anomaly analysis:

While generator reconstructs input data from latent variable z, encoder maps data space X into latent space Z. E (x; E) = f (WE x + bE), where the parameters are the weight matrix W E of size NzNx and offset vector bE of dimension Nz, is an example of an encoder. It consists of a nonlinear activation function f and an affine transformation. The generated latent variable z is mapped back into reconstructed Nx-dimensional vector by generator G. By reducing the reconstruction error Lrec, which measures the predicted separation between the input vector x and its reconstruction x, the Auto-Encoder is trained:\(\widehat{x}:{\mathcal{L}}_{\text{rec }}={\mathbb{E}}_{x\in \mathcal{X}}\parallel x-\widehat{x}{\parallel }^{2}={\mathbb{E}}_{x\in \mathcal{X}}\parallel \varvec{x}-G\left(E\right(x\left)\right){\parallel }^{2}\), where "." stands for L2 norm.

to reduce Jensen Shannon Divergence \(JSD\left(pG\parallel {p}_{{\mathcal{X}}_{\text{nor }}}\right)\), where Xnor is collection of patterns from components operating normally, pXnor is the probability distribution of those patterns, and pG is the probability distribution of generated patterns.

Let's define generator and discriminator parameters, as G = WG, bG and D = W D, bD. D (x; D) = fD(W D x + bD), where W D is a NzNx weight matrix, bD is an offset vector of size Nz, and fD is nonlinear activation function, for example, fD = sigmoid(), is formulated similarly to how the AutoEncoder (Section III-B) does.Prior to generator parameter θG'soptimisation, discriminator parameter θ ∗ D(θG) optimisation is established utilizing gradient-based technique based on Eq. (2).

$${\theta }_{D}^{\left(k\right)}={\theta }_{D}^{(k-1)}+\eta \cdot \text{A}\text{d}\text{a}\text{m}\left({\nabla }_{{\theta }_{D}}\mathcal{F}\left({\theta }_{D}^{(k-1)},{\theta }_{G}\right);{\beta }_{1},{\beta }_{2}\right)$$

1

$${\theta }_{D}^{\text{*}}\left({\theta }_{G}\right)=\underset{k\to {\infty }}{\text{l}\text{i}\text{m}} {\theta }_{D}^{\left(k\right)}$$

2

Additionally, Eq. (3) is used to optimise the generator parameter.

$${\theta }_{E}={\theta }_{E}-\eta \cdot \text{A}\text{d}\text{a}\text{m}\left({\nabla }_{{\theta }_{E}}{\mathcal{L}}_{rec}\left(x;{\theta }_{E},{\theta }_{G}^{\text{*}}\right);{\beta }_{1},{\beta }_{2}\right)$$

3

where gradient of loss function F with respect to G determines the updating term \(\text{A}\text{d}\text{a}\text{m}\left({\nabla }_{{\theta }_{G}}\mathcal{F}\left({\theta }_{D}^{\left(k\right)},{\theta }_{G}\right);{\beta }_{1},{\beta }_{2}\right)\). Due to the fact that θ (k) D depends on θG, there are θk updating steps of θ (k) D for every updating step of θG (Eq. (4)). It is suggested to use an additional auto-encoder to effectively reduce the reconstruction error by Eq. (4):

$${\mathcal{L}}_{\text{rec }}\left(x;{\theta }_{E},{\theta }_{G}^{\text{*}}\right)={\mathbb{E}}_{x\in }{\mathcal{X}}_{\text{nae }}{∥x-G\left(E\left(x;{\theta }_{E}\right);{\theta }_{G}^{\text{*}}\right)∥}^{2}$$

4

from which we obtain by Eq. (5)

$${\theta }_{E}^{\text{*}}=\underset{{\theta }_{E}}{\text{a}\text{r}\text{g}\text{m}\text{i}\text{n}}{\mathcal{L}}_{\text{rec }}\left(x;{\theta }_{E},{\theta }_{G}^{\text{*}}\right)\text{ and }{z}_{\text{oprimal }}=E\left(x;{\theta }_{E}^{\text{*}}\right)$$

5

where θ ∗ E is encoder's ideal parameter. By using Eq. (6), encoder parameter θE is optimised.

$${\theta }_{G}={\theta }_{G}-\eta \cdot \text{A}\text{d}\text{a}\text{m}\left({\nabla }_{{\theta }_{G}}\mathcal{F}\left({\theta }_{D}^{\left(k\right)},{\theta }_{G}\right);{\beta }_{1},{\beta }_{2}\right)$$

6

In order to obtain Eq. (7), we first add a normally distributed adaptive noise, \({ϵ}_{k}\left(i\right)\), to the k-th feature at the i-th time stamp of the r-th healthy components, Xr k (i).

$${\varvec{X}}_{k}^{{\prime }r}\left(i\right)={\varvec{X}}_{k}^{r}\left(i\right)+{ϵ}_{k}\left(i\right)$$

7

We briefly introduced idea of reinforcement learning (RL) based on a Markov decision process (MDP), which forms basis of our proposed method distributional reinforcement learning-based IDS engine, which relies on RL modelling from our earlier work [42]. Quintuple ideas of RL-based IDS by (S, A, R, Pa, γ) are concisely defined as follows: - S stands for the collection of states that IDS has recorded. We assume that S = s0, s1, and s2, where s0 stands for "normal00," s1 for "Detection00," and s2 for "NoDetection00." - A denotes the range of potential responses that IDS may employ. These responses may be classified as low, medium, high, or critical depending on likelihood of an attack.Placement of reward R(s, a) obtained in state s and action a by Eq. (8) allow us to express returns of IDS and to conduct an action immediately. R is objective function to be optimised in system.

$$R(s,a)=\sum _{{s}^{{\prime }}\in S} {P}_{a}\left(s\mid {s}^{{\prime }},a\right)R(s{\prime },a)$$

8

Pa is the probability of changing states. It is represented by an Eq. (9) as a matrix of transition probabilities p(si | sj, a) observed at time t for a ∈ A where i, j = 1, 2, 3 and V = 1(valid), 2(invalid).

$${P}_{a}\left({s}_{t+1}={s}_{j}\mid {s}_{t}={s}_{i},a\right)=\sum _{j=1}^{3} {\alpha }_{i,j}{\beta }_{i,j}^{\left(a\right)},i=\text{1,2},3$$

9

In a \(3\times 3\) matrix \({B}_{a}\) with \({\sum }_{j=1}^{3} {\beta }_{i,j}^{a}=1\), transition probability from state sj observed at t to state si observed at\({s}_{i}\) observed at t+1 is shown, indicating whether the anticipated data is legitimate or incorrect. - The discount factor is in the range of 0 < γ < 1. The agent performs an action in each s, records the reward of that action as well as the following state as s 0, and then updates the estimated value function of Qπ that satisfies the Bellman equation.

$${Q}^{\pi }(s,a)={\mathbb{E}}_{s,a,{s}^{{\prime }}}\left[R(s,a)+\gamma \underset{{a}^{{\prime }}\in A}{\text{m}\text{a}\text{x}} \left(Q\left({s}^{{\prime }},{a}^{{\prime }}\right)\right)\right]$$

10

By modelling all potential returns in a dynamic manner and attempting to learn from their mean, this is done to provide more action predictions. Let R(s,a) be the return calculated by adding discounted rewards that agent has observed starting from state s and taking action an in accordance with the policy π, with random variable \(Z(s,a)=\sum _{i=0}^{{\infty }} \gamma R(s,a)\). As a result, Eq. (11) provides the estimated value function for a given π.

$${Q}^{\pi }(s,a)=\mathbb{E}\left[{Z}^{\pi }(s,a)\right]$$

11

Equation (12) is a representation of the distributional Bellman equation for a specific.

$$Z(s,a)\stackrel{D}{=}{\mathbb{E}}_{s,a,{s}^{{\prime }}}\left[\left(R(s,a)+\gamma \underset{{a}^{{\prime }}\in A}{\text{m}\text{a}\text{x}} {Z}^{\pi }\left({s}^{{\prime }},{a}^{{\prime }}\right)\right)\right]$$

12

$${\tau }^{\text{*}}Z(s,a)\stackrel{D}{=}{\mathbb{E}}_{s,a,{s}^{{\prime }}}\left[\left(R(s,a)+\gamma Z\left({s}^{{\prime }},{\pi }^{\text{*}}\left({s}^{{\prime }}\right)\right)\right)\right]$$

13

$$\text{w}\text{h}\text{e}\text{r}\text{e} {s}^{{\prime }}\sim p(.\mid s,a) \text{a}\text{n}\text{d} {\pi }^{\text{*}}=\text{a}\text{r}\text{g}{\text{m}\text{a}\text{x}}_{{a}^{{\prime }}\in A} \mathbb{E}\left[Z\left({s}^{{\prime }},{a}^{{\prime }}\right)\right]$$

Algorithm for anomaly detection |

Input: Anomaly score valudation set, \(V={\left\{{A}^{2}\right\}}_{z=1},{N}_{{\infty }}\), weak classifier \(h:A\to \{-\text{1,1}\}\), percentile \(c\). Output: Ensembled classifier \(H\left(A\right)=\text{s}\text{g}\text{n}\left(\sum _{m=1}^{{N}_{m}} {a}_{m}\cdot {h}_{m}\left(A\right)\right)\) Initialize: Weights of validation set \(V\) anomaly scores \({w}_{1}^{\left(1\right)},{w}_{2}^{\left(1\right)},\dots ,{w}_{{N}_{1}}^{\left(1\right)}\) set to \(\frac{1}{{N}_{e}}\), initial error rate \({ϵ}_{m},m=1,\dots ,{N}_{m}\) set as \(\frac{1}{2}\). \(/\) * Train AdaBoost Ensemble model // for \(m=1,\dots ,{N}_{m}\) do \({A}_{\text{rhreshold },m}=\) Percentile \({e}_{c}{\left\{{\left({A}^{v}\right)}^{T}\cdot {o}^{\left(m\right)}\right\}}_{0=1,\dots ,{N}_{\epsilon }}\) Obtain error rate \({ϵ}_{m}=\sum _{v,1-{h}_{m}\left({A}^{\text{*}}\right)} {w}_{D}^{\left(m\right)},v=1,\dots ,{N}_{v}\) Obtain weights of classifier \({h}_{m},{\alpha }_{m}=\frac{1}{2}\text{l}\text{n}\left(\frac{1-{ϵ}_{m}}{{\epsilon }_{m}}\right)\) Update weights \({w}_{0}^{(m+1)}={w}_{b}^{\left(m\right)}{e}^{{a}_{m}{h}_{m}\left({A}^{\text{*}}\right)},v=1,\dots ,{N}_{b.}\) 7 Normalize weights \({w}_{\text{v}}^{(m+1)}=\frac{{m}_{1}^{(m+1)}}{\sum ^{{N}_{0}(w+1)} ,},D=1,\dots ,{N}_{0}-\) |