Commit 9cfdec78 authored by V.K Maheswaran IT18085372's avatar V.K Maheswaran IT18085372 💬

car park

parent 6c88c457
# Default ignored files
/shelf/
/workspace.xml
<?xml version="1.0" encoding="UTF-8"?>
<module type="PYTHON_MODULE" version="4">
<component name="NewModuleRootManager">
<content url="file://$MODULE_DIR$" />
<orderEntry type="jdk" jdkName="Python 3.8 (car)" jdkType="Python SDK" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="CodeStream">
<option name="webViewContext" value="{&quot;chatProviderAccess&quot;:&quot;strict&quot;,&quot;currentTeamId&quot;:&quot;&quot;,&quot;currentStreamId&quot;:&quot;&quot;,&quot;pullRequestCheckoutBranch&quot;:false,&quot;isRepositioning&quot;:false,&quot;onboardStep&quot;:0,&quot;panelStack&quot;:[&quot;landing-redirect&quot;],&quot;hasFocus&quot;:false,&quot;channelFilter&quot;:&quot;all&quot;,&quot;channelsMuteAll&quot;:false,&quot;codemarkFileFilter&quot;:&quot;all&quot;,&quot;codemarkTypeFilter&quot;:&quot;all&quot;,&quot;codemarkTagFilter&quot;:&quot;all&quot;,&quot;codemarkBranchFilter&quot;:&quot;all&quot;,&quot;codemarkAuthorFilter&quot;:&quot;all&quot;,&quot;codemarksFileViewStyle&quot;:&quot;inline&quot;,&quot;codemarksShowArchived&quot;:false,&quot;codemarksShowResolved&quot;:false,&quot;codemarksWrapComments&quot;:false,&quot;showFeedbackSmiley&quot;:true,&quot;route&quot;:{&quot;name&quot;:&quot;newUserEntry&quot;,&quot;params&quot;:{}},&quot;spatialViewShowPRComments&quot;:false}" />
</component>
</project>
\ No newline at end of file
<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="2">
<item index="0" class="java.lang.String" itemvalue="imageio" />
<item index="1" class="java.lang.String" itemvalue="torchaudio" />
</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="ProjectRootManager" version="2" project-jdk-name="Python 3.8 (car)" project-jdk-type="Python SDK" />
<component name="PyCharmProfessionalAdvertiser">
<option name="shown" value="true" />
</component>
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/CarPark.iml" filepath="$PROJECT_DIR$/.idea/CarPark.iml" />
</modules>
</component>
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$" vcs="Git" />
</component>
</project>
\ No newline at end of file
import cv2
import flask
import torch
import werkzeug
app = flask.Flask(__name__)
model = torch.hub.load('ultralytics/yolov5', 'custom', path='model/best.pt')
@app.route('/test', methods=['GET', 'POST'])
def test():
img = cv2.imread('upload/2012-12-15_08_10_03_jpg.rf.79ed952a7195142a1e08028ac5938d1a.jpg')
results = model(img)
return results.pandas().xyxy[0].to_json(orient='records')
@app.route('/upload', methods=['POST'])
def upload():
imagefile = flask.request.files['image']
filename = werkzeug.utils.secure_filename(imagefile.filename)
print("\nReceived image File name : " + imagefile.filename)
imagefile.save('Upload/' + filename)
img = cv2.imread('Upload/' + filename)
results = model(img)
return results.pandas().xyxy[0].to_json(orient='records')
@app.route('/cctv', methods=['GET', 'POST'])
def cctv():
cam = cv2.VideoCapture(0)
img = cam.read()[1]
cv2.imwrite('Cctv/snap.jpg', img)
results = model(img)
return results.pandas().xyxy[0].to_json(orient='records')
app.run(host="0.0.0.0", port=5000, debug=True)
\ No newline at end of file
pip install pandas
pip install PyYAML
pip install matplotlib
pip install seaborn
pip install Flask
import torch
import cv2
model = torch.hub.load('ultralytics/yolov5', 'custom', path='model/best.pt')
img = cv2.imread('upload/x.jpg')
results = model(img)
results.print()
results.show()
\ No newline at end of file
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