Detector AppLast Updated on May 3, 2021
Detects face and outputs a message corresponding to the facial expression detected. Build using Android Studio and by converting the machine learning model to Tensorflow lite.
Share with someone who needs it
Python Snake GameLast Updated on May 3, 2021
This game reminds everyone their childhood memories.
In this snake game, the player has to move the snake to the fruit in order to eat it. The score will increase once the fruit is eaten. Also, the length of the snake will increase if the snake eats the fruit. The game will get over if the snake touches itself.
The turtle and random modules are used in this game project. So as to install these libraries, simply type “pip install turtle” and “pip install random” on the command prompt.
Turtle library allows us to create pictures, diagrams in a virtual form whereas random module gives the value between the given range of it.
There are 3 functions defined in this game which is “change”, “inside function”, and “move” function. In change function, the x-axis and y-axis are defined. In inside function, the logic of the game is written and in the move function, movement to the snake is given.
There are 4 keys mentioned in the code “right, left, up, down”.
If the player presses the right key, the snake will move to right direction, If the player presses the left key , the snake will move to left direction, If the player presses the up key , the snake will move to upward direction, If the player presses the down key , the snake will move to downward direction and if the snake touches itself the game will get over.
Vehicle Density Based Traffic Optimization/ Management (Ml And Iot)Last Updated on May 3, 2021
As the vehicle population is rapidly increasing day by day, the cities are facing a huge traffic issue. We know how a traffic system work in current days. Even though there are no vehicles on the green side at the junction, a vehicle on the red side has to wait till the given time. This system has a drawback of traffic delay. On an average most of the junctions in the cities and towns facing this issue
To overcome this problem of over delaying in the traffic, IoT plays a major role. Our idea is: placing IoT sensors at a distance of 100 meters range from the junction we can calculate an average count of vehicles on all the sides. Using this count as main characteristic the traffic light works dynamically that is the roads having high to low count of vehicles has green signal in decreasing order. To increase efficiency of vehicle count we implemented vehicle count using image processing
1. Raspberry Pi
2. Camera (web cam)
Vehicle count using image processing
• At the junction the vehicles coming from different directions may face traffic issues.
• By image processing technique we can capture the video of number of vehicles coming in different directions.
• By connecting raspberry pi we can get the count of vehicles in different directions at the junction.
• Based on the count obtained from different directions the traffic is cleared as per the maximum count of vehicles.
• The traffic system is prioritized in decreasing order of the count of vehicles ie, the road with high vehicle count will be given first priority and so on.
• The input in the form of video is captured by web cam, After the vehicle count is done, the control of traffic lights is done using Raspberry Pi
Advantages in real life:
1.Optimizing traffic inconsistency
2.Reducing air pollution
3.Reducing noise pollution
4.Priority traffic control
My role in the project:
This is a project for HACKATHON where we team of 8 members worked for 2 days. I worked mostly on the coding part for video processing in the project, I also developed an optimized code for prioritizing the traffic lights, this project contains various code segments one for image processing using cv module in python, one for vehicle count and other for prioritization.
Web Base Application Heart Failure Prediction SystemLast Updated on May 3, 2021
In this situation, approximately 17 million people kill globally per year in the whole world because of cardiovascular disease, and they mainly exhibit myocardial-exhibit myocardial infarction and heart failure. Heart failure (HF) occurs when the heart cannot pump enough blood to meet the needs of the body.
In this heart prediction problem statement, we are trying to predict whether the patient's heart muscle pumps blood properly or not using Logistic Regression. In this project, a dataset is downloaded from the UCI repository and this dataset is real. this dataset is collected from one of the most famous hospitals is in the United Kingdom (UK) in 2015 and there are 299 patient records and 12 features(attribute) and one label. Based on that 12 features, we will predict whether the patient's heart working properly or not.
In this problem statement, we analyze a dataset of 299 patients with heart failure collected in 2015. We apply several machine learning & classifiers to both predict the patient’s survival, and rank the features corresponding to the most important risk factors. We also perform an alternative feature ranking analysis by employing traditional biostatistics tests and compare these results with those provided by the machine learning algorithms. Since both feature ranking approaches clearly identify serum creatinine and ejection fraction as the two most relevant features, we then build the machine learning survival prediction models on these two factors alone.
For model building we use various library packages like Pandas, Scikit learns (sklearn), matplotlib, Seaborn, Tensorflow, Keras, etc., then we will use data description, Data description involves carrying out initial analysis on the data to understand more about the data, its source, volume, attributes, and relationships. Once these details are documented, any shortcomings if noted should be informed to relevant personnel. after that, we use the data cleaning method for cleaning the dataset to check if there are any missing values or not and we split the dataset into training & testing purposes with 70%, 30% criteria. Then the next step is Model Building, The process of model building is also known as training the model using data and features from our dataset. A combination of data (features) and Machine Learning algorithms together give us a model that tries to generalize on the training data and give necessary results in the form of insights and/or predictions. Generally, various algorithms are used to try out multiple modeling approaches on the same data to solve the same problem to get the best model that performs and gives outputs that are the closest to the business success criteria. Key things to keep track of here are the models created, model parameters being used, and their results. And the last step is to analyze the result in this step we check our model score or accuracy by using Confusion Matrix and Model Score. For this model, we got 80% accuracy. In the future, we try to improve that accuracy. For model deployment, we use the python flask and based on that we build the web-based application.
Covid-19Last Updated on May 3, 2021
# coding: utf-8
import datetime as dt
from datetime import datetime, timedelta
import numpy as np
import pandas as pd
import time as tm
import matplotlib.pyplot as plt
today = dt.date.today()
country = requests.get('https://api.coronatracker.com/v3/stats/worldometer/topCountry')
world = json.loads(country.text)
world = pd.io.json.json_normalize(world)
cases_world = pd.pivot_table(world,index=['country'],columns=None,
cases_world['last_update'] = dt.datetime.now()
incases = cases_world[cases_world['country']=='India'].reset_index().drop(columns=['index'])
incr = incases['totalConfirmed']
inre = incases['totalRecovered']
inde = incases['totalDeaths']
india_datewise = requests.get('https://api.covid19india.org/data.json')
in_date = json.loads(india_datewise.text)['cases_time_series']
in_date = pd.io.json.json_normalize(in_date)
in_date = in_date.iloc[0:len(in_date),[3,0,2,1,4,6,5]]
in_date['day'] = in_date['date'].str.split(" ",expand=True)
in_date['months'] = in_date['date'].str.split(" ",expand=True)
in_date['year'] = 2020
for x in range(len(in_date['months'])):
in_date['month'][x] = str(1)
in_date['month'][x] = str(2)
in_date['month'][x] = str(3)
in_date['month'][x] = str(4)
in_date['month'][x] = str(5)
in_date['month'][x] = str(6)
in_date['month'][x] = str(7)
in_date['month'][x] = str(8)
in_date['month'][x] = str(9)
in_date['month'][x] = str(10)
in_date['month'][x] = str(11)
in_date['month'][x] = str(12)
in_date['year'] = in_date['year'].astype(str)
in_date['month'] = in_date['month'].astype(str)
in_date['day'] = in_date['day'].astype(str)
in_date['Date'] = in_date['year'].astype(str)+'-'+in_date['month']+'-'+in_date['day']
in_date['Date'] = pd.to_datetime(in_date['Date'])
in_date['Date'] = in_date['Date'].astype(str)
in_date = in_date[['Date','dailyconfirmed','dailyrecovered','dailydeceased','totalconfirmed','totalrecovered','totaldeceased']]
in_date = in_date.sort_values(by='Date',ascending=False)
last7 = str(today - dt.timedelta(days=+7))
last7days = in_date[in_date['Date']>=last7]
india_statewise = requests.get('https://api.covid19india.org/data.json')
in_state = json.loads(india_statewise.text)['statewise']
in_state = pd.io.json.json_normalize(in_state)
in_state = in_state.iloc[0:len(in_state),[9,6,0,2,1,4,5,7,8,10,11]]
from flask import Flask, render_template
app = Flask(__name__)
return render_template('index.html', total=incr, recovered=inre, death=inde,
if __name__ == "__main__":
details of project:-
•Python is a general purpose, dynamic, high-level, and interpreted programming language. It supports Object Oriented programming approach to develop applications. It is simple and easy to learn and provides lots of high-level data structures.
•Python is not intended to work in a particular area, such as web programming. That is why it is known as multipurpose programming language because it can be used with web, enterprise, 3D CAD, etc.
•Python laid its foundation in the late 1980s.
•The implementation of Python was started in December 1989 by Guido Van Rossum at CWI in Netherland.
•In February 1991, Guido Van Rossum published the code (labeled version 0.9.0) to alt.sources.
In 1994, Python 1.0 was released with new features like lambda, map, filter, and reduce
•Python provides many useful features which make it popular and valuable from the other programming languages. It supports object-oriented programming, procedural programming approaches and provides dynamic memory allocation. We have listed below a few essential features.
•Easy to Learn and Use
•Free and Open Source
• Large Standard Library
•GUI Programming Support
•Dynamic Memory Allocation
•Python is known for its general-purpose nature that makes it applicable in almost every domain of software development. Python makes its presence in every emerging field. It is the fastest-growing programming language and can develop any application.
•Numpy:-Numpy is considered as one of the most popular machine learning library in Python.
•Features Of Numpy:-
•Interactive: Numpy is very interactive and easy to use.
•Mathematics: Makes complex mathematical implementations very simple.
•Intuitive: Makes coding real easy and grasping the concepts is easy.
•Lot of Interaction: Widely used, hence a lot of open source contribution.
•Pandas:-Pandas is a machine learning library in Python that provides data structures of high-level and a wide variety of tools for analysis. One of the great feature of this library is the ability to translate complex operations with data using one or two commands.
•Features Of Pandas:-Pandas make sure that the entire process of manipulating data will be easier. Support for operations such as Re-indexing, Iteration, Sorting, Aggregations, Concatenations and Visualizations are among the feature highlights of Pandas.
•Matplotlibraries:-Matplotlib is an amazing visualization library in Python for 2D plots of arrays. Matplotlib is a multi-platform data visualization library built on NumPy arrays and designed to work with the broader SciPy stack. It was introduced by John Hunter in the year 2002. Matplotlib consists of several plots like line, bar, scatter, histogram etc.
•Datetime:-A date in Python is not a data type of its own, but we can import a module named datetime to work with dates as date objects.
•Import the datetime module and display the current date: import datetime. ...
•Return the year and name of weekday: import datetime. ...
•Create a date object: import datetime. ...
•Display the name of the month:
•Warnings:-The warnings module was introduced in PEP 230 as a way to warn programmers about changes in language or library features in anticipation of backwards incompatible changes coming with Python 3.0. Since warnings are not fatal, a program may encounter the same warn-able situation many times in the course of running.
•Json:-The json library can parse JSON from strings or files. The library parses JSON into a Python dictionary or list. It can also convert Python dictionaries or lists into JSON strings.
•Flask is a web application framework written in Python. Armin Ronacher, who leads an international group of Python enthusiasts named Pocco, develops it. Flask is based on Werkzeug WSGI toolkit and Jinja2 template engine. Both are Pocco projects.
•Getting Started With Flask:
Python 2.6 or higher is required for the installation of the Flask. You can start by import Flask from the flask package on any python IDE
Interact With Quantum Computing Hardware Devices Using Amazon BracketLast Updated on May 3, 2021
The Amazon Braket Python SDK is an open source library that provides a framework that you can use to interact with quantum computing hardware devices through Amazon Braket.
Before you begin working with the Amazon Braket SDK, make sure that you've installed or configured the following prerequisites.
Python 3.7.2 or greater
Download and install Python 3.7.2 or greater from Python.org.
Install Git from https://git-scm.com/downloads. Installation instructions are provided on the download page.
IAM user or role with required permissions
As a managed service, Amazon Braket performs operations on your behalf on the AWS hardware that is managed by Amazon Braket. Amazon Braket can perform only operations that the user permits. You can read more about which permissions are necessary in the AWS Documentation.
The Braket Python SDK should not require any additional permissions aside from what is required for using Braket. However, if you are using an IAM role with a path in it, you should grant permission for iam:GetRole.
To learn more about IAM user, roles, and policies, see Adding and Removing IAM Identity Permissions.
Boto3 and setting up AWS credentials
Follow the installation instructions for Boto3 and setting up AWS credentials.
Note: Make sure that your AWS region is set to one supported by Amazon Braket. You can check this in your AWS configuration file, which is located by default at ~/.aws/config.
Configure your AWS account with the resources necessary for Amazon Braket
If you are new to Amazon Braket, onboard to the service and create the resources necessary to use Amazon Braket using the AWS console.
Installing the Amazon Braket Python SDK
The Amazon Braket Python SDK can be installed with pip as follows:
pip install amazon-braket-sdk
You can also install from source by cloning this repository and running a pip install command in the root directory of the repository:
git clone https://github.com/aws/amazon-braket-sdk-python.git cd amazon-braket-sdk-python pip install .
Check the version you have installed
You can view the version of the amazon-braket-sdk you have installed by using the following command:
pip show amazon-braket-sdk
You can also check your version of amazon-braket-sdk from within Python:
>>> import braket._sdk as braket_sdk >>> braket_sdk.__version__
Running a circuit on an AWS simulator
import boto3 from braket.aws import AwsDevice from braket.circuits import Circuit device = AwsDevice("arn:aws:braket:::device/quantum-simulator/amazon/sv1") s3_folder = ("amazon-braket-Your-Bucket-Name", "folder-name") # Use the S3 bucket you created during onboarding bell = Circuit().h(0).cnot(0, 1) task = device.run(bell, s3_folder, shots=100) print(task.result().measurement_counts)
The code sample imports the Amazon Braket framework, then defines the device to use (the SV1 AWS simulator). The s3_folder statement defines the Amazon S3 bucket for the task result and the folder in the bucket to store the task result. This folder is created when you run the task. It then creates a Bell Pair circuit, executes the circuit on the simulator and prints the results of the job.