Commit 99bbafcd authored by Alahakoon K.M.R.A.B's avatar Alahakoon K.M.R.A.B

Merge branch 'IT18203004' into 'master'

It18203004 to merge Master

See merge request !7
parents 4fd4466f 80bc90a4
<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
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)
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