Commit c398f80d authored by Jayashanki T.R.C's avatar Jayashanki T.R.C

Merge branch 'master' into 'IT19013206'

Master merge to IT19013206

See merge request !8
parents a0c10949 99bbafcd
<component name="InspectionProjectProfileManager">
<profile version="1.0">
<option name="myName" value="Project Default" />
<inspection_tool class="PyPackageRequirementsInspection" enabled="true" level="WARNING" enabled_by_default="true">
<option name="ignoredPackages">
<value>
<list size="45">
<item index="0" class="java.lang.String" itemvalue="opencv-python" />
<item index="1" class="java.lang.String" itemvalue="cmake" />
<item index="2" class="java.lang.String" itemvalue="numpy" />
<item index="3" class="java.lang.String" itemvalue="dlib" />
<item index="4" class="java.lang.String" itemvalue="thop" />
<item index="5" class="java.lang.String" itemvalue="scikit-image" />
<item index="6" class="java.lang.String" itemvalue="opencv-contrib-python" />
<item index="7" class="java.lang.String" itemvalue="wincertstore" />
<item index="8" class="java.lang.String" itemvalue="networkx" />
<item index="9" class="java.lang.String" itemvalue="tifffile" />
<item index="10" class="java.lang.String" itemvalue="Flask-Cors" />
<item index="11" class="java.lang.String" itemvalue="PyYAML" />
<item index="12" class="java.lang.String" itemvalue="torch" />
<item index="13" class="java.lang.String" itemvalue="torchvision" />
<item index="14" class="java.lang.String" itemvalue="mysql-connector-python" />
<item index="15" class="java.lang.String" itemvalue="pandas" />
<item index="16" class="java.lang.String" itemvalue="tqdm" />
<item index="17" class="java.lang.String" itemvalue="regex" />
<item index="18" class="java.lang.String" itemvalue="mediapipe" />
<item index="19" class="java.lang.String" itemvalue="seaborn" />
<item index="20" class="java.lang.String" itemvalue="better-profanity" />
<item index="21" class="java.lang.String" itemvalue="colorama" />
<item index="22" class="java.lang.String" itemvalue="PyWavelets" />
<item index="23" class="java.lang.String" itemvalue="imutils" />
<item index="24" class="java.lang.String" itemvalue="pytz" />
<item index="25" class="java.lang.String" itemvalue="torchaudio" />
<item index="26" class="java.lang.String" itemvalue="Flask" />
<item index="27" class="java.lang.String" itemvalue="Pillow" />
<item index="28" class="java.lang.String" itemvalue="flashtext" />
<item index="29" class="java.lang.String" itemvalue="unidecode" />
<item index="30" class="java.lang.String" itemvalue="sklearn" />
<item index="31" class="java.lang.String" itemvalue="nltk" />
<item index="32" class="java.lang.String" itemvalue="beautifulsoup4" />
<item index="33" class="java.lang.String" itemvalue="chardet" />
<item index="34" class="java.lang.String" itemvalue="pdfminer.six" />
<item index="35" class="java.lang.String" itemvalue="six" />
<item index="36" class="java.lang.String" itemvalue="certifi" />
<item index="37" class="java.lang.String" itemvalue="MarkupSafe" />
<item index="38" class="java.lang.String" itemvalue="scipy" />
<item index="39" class="java.lang.String" itemvalue="chumpy" />
<item index="40" class="java.lang.String" itemvalue="matplotlib" />
<item index="41" class="java.lang.String" itemvalue="opendr" />
<item index="42" class="java.lang.String" itemvalue="protobuf" />
<item index="43" class="java.lang.String" itemvalue="grpcio" />
<item index="44" class="java.lang.String" itemvalue="click" />
</list>
</value>
</option>
</inspection_tool>
</profile>
</component>
\ No newline at end of file
<component name="InspectionProjectProfileManager">
<settings>
<option name="USE_PROJECT_PROFILE" value="false" />
<version value="1.0" />
</settings>
</component>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="DesignSurface">
<option name="filePathToZoomLevelMap">
<map>
<entry key="..\:/Users/dilsh/AndroidStudioProjects/VehicleParkingSystem/app/src/main/res/layout/activity_dashboard.xml" value="0.22826086956521738" />
<entry key="..\:/Users/dilsh/AndroidStudioProjects/VehicleParkingSystem/app/src/main/res/layout/activity_login.xml" value="0.22826086956521738" />
<entry key="..\:/Users/dilsh/AndroidStudioProjects/VehicleParkingSystem/app/src/main/res/layout/activity_main.xml" value="0.22826086956521738" />
<entry key="..\:/Users/dilsh/AndroidStudioProjects/VehicleParkingSystem/app/src/main/res/layout/activity_parking_slots.xml" value="0.22826086956521738" />
<entry key="..\:/Users/dilsh/AndroidStudioProjects/VehicleParkingSystem/app/src/main/res/layout/activity_register.xml" value="0.2" />
<entry key="..\:/Users/dilsh/AndroidStudioProjects/VehicleParkingSystem/app/src/main/res/layout/custom_entrance_details.xml" value="0.22826086956521738" />
<entry key="..\:/Users/dilsh/AndroidStudioProjects/VehicleParkingSystem/app/src/main/res/layout/custom_parking_violation.xml" value="0.22826086956521738" />
</map>
</option>
</component>
<component name="ProjectRootManager" version="2" languageLevel="JDK_11" project-jdk-name="1.8" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/build/classes" />
</component>
<component name="ProjectType">
<option name="id" value="Android" />
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.8 (tf_obj_detect)" project-jdk-type="Python SDK" />
<component name="PyCharmProfessionalAdvertiser">
<option name="shown" value="true" />
</component>
</project>
\ No newline at end of file
......@@ -78,4 +78,6 @@ Vehicle Parking System(2022-235)
Objective:-
Ensure the safety of the vehicle while parked in the vehicle-park using image processing and Machine Learning.
Also display of unsecured status by notification.
\ No newline at end of file
Also display of unsecured status by notification.
test
\ No newline at end of file
from flask import Flask, request
from flask_cors import CORS
import json
import cv2
import base64
import component_1.slot_detector as slot_detector
import component_1.waiting_time_pred as waiting_time_pred
import component_2.parking_violation as parking_violation_obj
import component_3.video_tester as number_plate_detector
import component_3.parking_traffic_pred as parking_traffic_pred
import component_4.human_action_detector as human_action_detector
app = Flask(__name__)
CORS(app)
@app.route('/slot_availability', methods=['GET', 'POST'])
def slot_availability():
slot_list = slot_detector.get_number_of_space()
return_str = '{ '
for i in range(0, 12):
return_str += '"' + str(i) + '" : ' + str(slot_list[i]) + ','
return_str += ' "average_waiting_time" : ' + str(waiting_time_pred.get_waiting_time()) + '}'
print(return_str)
return json.loads(return_str)
@app.route('/parking_violation', methods=['GET', 'POST'])
def parking_violation():
if parking_violation_obj.is_vehicle_parked_correctly():
return_str = ' { "status" : 1 }'
else:
return_str = ' { "status" : 0 }'
return json.loads(return_str)
@app.route('/enternce', methods=['GET', 'POST'])
def enternce():
number_plate = number_plate_detector.get_number_plate()
return_str = '{ "number_plate" : "' + str(number_plate) + '", "type" : "car" }'
return json.loads(return_str)
@app.route('/traffic', methods=['GET', 'POST'])
def traffic():
traffic_data = parking_traffic_pred.get_traffic_next_week()
return_str = '{ "parking_traffic_next_week" : ['
for i in range(len(traffic_data)):
if i == len(traffic_data) - 1:
return_str += str(traffic_data[i])
else:
return_str += str(traffic_data[i]) + ', '
return_str += ']}'
return json.loads(return_str)
@app.route('/threat', methods=['GET', 'POST'])
def threat():
if human_action_detector.get_human_thred_temp():
return_str = '{ "status" : 1 }'
else:
return_str = '{ "status" : 0 }'
return json.loads(return_str)
@app.route('/image', methods=['GET', 'POST'])
def image():
return_str = '{ "base64_image" : "' + str(get_base_64()) + '" }'
return json.loads(return_str)
def get_base_64():
img = cv2.imread('test.jpg')
retval, buffer = cv2.imencode('.jpg', img)
jpg_as_text = base64.b64encode(buffer)
return jpg_as_text
if __name__ == '__main__':
app.run(host="0.0.0.0", port=3000, debug=True)
package com.example.vehicleparkingsystem;
import androidx.annotation.NonNull;
import androidx.appcompat.app.AppCompatActivity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
import android.widget.Toast;
import com.example.vehicleparkingsystem.Models.Users;
import com.google.android.gms.tasks.OnCompleteListener;
import com.google.android.gms.tasks.Task;
import com.google.firebase.auth.AuthResult;
import com.google.firebase.auth.FirebaseAuth;
import com.google.firebase.auth.FirebaseUser;
import com.google.firebase.database.DatabaseReference;
import com.google.firebase.database.FirebaseDatabase;
public class Register extends AppCompatActivity {
EditText editText1;
EditText editText2;
EditText editText3;
EditText editText4;
EditText editText5;
EditText editText6;
Button reg;
TextView textView;
FirebaseDatabase rootNode;
DatabaseReference reference;
FirebaseAuth firebaseAuth;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_register);
editText1=(EditText)findViewById(R.id.Uname);
editText2=(EditText)findViewById(R.id.Remail);
editText3=(EditText)findViewById(R.id.Age);
editText4=(EditText)findViewById(R.id.contct);
editText5=(EditText)findViewById(R.id.password);
editText6=(EditText)findViewById(R.id.vehicle);
reg=(Button)findViewById(R.id.register);
textView=(TextView)findViewById(R.id.gotologin);
textView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent = new Intent(Register.this, MainActivity.class);
startActivity(intent);
}
});
firebaseAuth=FirebaseAuth.getInstance();
reg.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
reference = FirebaseDatabase.getInstance().getReference("User");
// reference = rootNode.getReference("Users");
final String namee = editText1.getText().toString();
final String emaill = editText2.getText().toString();
final String age = editText3.getText().toString();
final String phonee = editText4.getText().toString();
final String pass = editText5.getText().toString();
final String vehicle = editText6.getText().toString();
if (!validateUserName() | !validateEmail() | !validateAge() | !validatePhone() | !validatePassword()) {
Toast.makeText(Register.this, "Sign up failed", Toast.LENGTH_SHORT).show();
}
else{
firebaseAuth.createUserWithEmailAndPassword(emaill, pass)
.addOnCompleteListener(Register.this, new OnCompleteListener<AuthResult>() {
@Override
public void onComplete(@NonNull Task<AuthResult> task) {
if (task.isSuccessful()) {
FirebaseUser user = FirebaseAuth.getInstance().getCurrentUser();
String userid = user.getUid();
Users members = new Users(namee,emaill,age,phonee,vehicle,pass);
reference.child(userid).setValue(members);
System.out.println(members);
Toast.makeText(Register.this, "Sign up successfully", Toast.LENGTH_SHORT).show();
Intent intent = new Intent(Register.this, Dashboard.class);
startActivity(intent);
} else {
Toast.makeText(Register.this, "Sign up failed", Toast.LENGTH_SHORT).show();
}
}
});
}
}
});
}
public boolean validateUserName() {
String value = editText1.getText().toString();
String noWhiteSpace = "\\A\\w{4,20}\\z";
if (value.isEmpty()) {
editText1.setError("Field cannot be empty");
return false;
} else if (value.length() >= 15) {
editText1.setError("Username too long. limit to 15 characters");
return false;
} else if (!value.matches(noWhiteSpace)) {
editText1.setError("White Spaces are not allowed");
return false;
} else {
editText1.setError(null);
return true;
}
}
public boolean validateEmail() {
String value = editText2.getText().toString();
String emailPattern = "[a-zA-Z0-9._-]+@[a-z].+[a-z]+\\.+[a-z]+"; //Regex Expression
if (value.isEmpty()) {
editText2.setError("Field cannot be empty");
return false;
} else if (!value.matches(emailPattern)) {
editText2.setError("Invalid email address");
return false;
} else {
editText2.setError(null);
return true;
}
}
public boolean validateAge() {
String value = editText3.getText().toString();
if (value.isEmpty()) {
editText3.setError("Field cannot be empty");
return false;
} else {
editText3.setError(null);
return true;
}
}
public boolean validatePhone() {
String value = editText4.getText().toString();
if (value.isEmpty()) {
editText4.setError("Field cannot be empty");
return false;
} else {
editText4.setError(null);
return true;
}
}
public boolean validatePassword() {
String value = editText5.getText().toString();
String password = "^" +
//"(?=.*[0-9])" + //at least 1 digit
//"(?=.*[a-z])" + //at least 1 lower case letter
//"(?=.*[A-Z])" + //at least 1 upper case letter
"(?=.*[a-zA-Z])" + //any letter
"(?=.*[@#$%^&+=])" + //at least 1 special character
"(?=\\S+$)" + //no white spaces
".{2,}" + //at least 2 characters
"$";
if (value.isEmpty()) {
editText5.setError("Field cannot be empty");
return false;
} else if (!value.matches(password)) {
editText5.setError("Password must have at least 1 special character, 2 numbers and letters");
return false;
} else {
editText5.setError(null);
return true;
}
}
}
\ No newline at end of file
pip install scikit-learn opencv-python mediapipe torch torchvision torchaudio statsmodels pmdarima
pip install opencv-python==4.5.5.64
save.png

129 KB

test.jpg

141 KB

from flask import Flask, request
from flask_cors import CORS
import json
app = Flask(__name__)
CORS(app)
@app.route('/slot_availability', methods=['GET', 'POST'])
def slot_availability():
return_str = '{ "1" : 0, "2" : 1,"3" : 0,"4" : 1,"5" : 1,"6" : 1,"7" : 0,"8" : 1,"9" : 0,"10" : 0, }'
return json.loads(return_str)
@app.route('/parking_violation', methods=['GET', 'POST'])
def parking_violation():
return_str = ' { "status" : 1" }'
return json.loads(return_str)
@app.route('/enternce', methods=['GET', 'POST'])
def enternce():
return_str = '{ "number_plate" : "KS-9908", "type" : "car" }'
return json.loads(return_str)
@app.route('/threat', methods=['GET', 'POST'])
def threat():
return_str = '{ "status" : 1 }'
return json.loads(return_str)
if __name__ == '__main__':
app.run(host="0.0.0.0", port=5000, debug=True)
File added
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment