项目运行
需要先安装Python的相关依赖:pymysql,Django==3.2.8,pillow 使用pip install 安装
第一步:创建数据库
第二步:执行SQL语句,.sql文件,运行该文件中的SQL语句
第三步:修改源代码中的settings.py文件,改成自己的mysql数据库用户名和密码
第四步:运行命令:python manage.py runserver 8000
第五步:打开浏览器查看http://127.0.0.1:8000
毕设帮助,指导,本源码分享(见文末)
系统介绍:
本系统是基于Django框架和Python语言开发的车牌识别系统,旨在通过深度学习技术实现对车牌的快速准确识别。系统通过上传图片,利用深度学习模型进行车牌检测和识别,支持统计分析和车牌管理等功能。
整体功能包含:
车牌识别
统计分析
车牌地图展示
车牌管理
用户管理
前台模块:
登录页面:用户登录系统
车牌识别页面:上传图片,进行车牌识别
统计分析页面:展示车牌识别的统计数据
车牌地图页面:地图形式展示车牌分布
后台模块:
用户管理:管理用户信息
车牌管理:查看和管理识别的车牌信息
系统设置:系统配置和管理员信息管理
功能截图:
代码实现:
python">
def register(request):"""注册账号:return:"""try:name = request.POST.get('username')passwd = request.POST.get('password')phone = request.POST.get('phone')user = User.objects.filter(name=name)if user:return JsonResponse({'message': '用户已存在,请直接登录'}, status=403)User.objects.create(name=name,password=passwd,phone=phone,role=2,description='')response_data = {'message': '注册成功'}return JsonResponse(response_data)except Exception as e:print(e)return JsonResponse({'message': '注册失败'}, status=401)def password(request):username = request.session['username']role = int(request.session['role'])user_id = request.session['user_id']return render(request, 'modify_password.html', locals())def get_user(request):"""获取用户列表信息 | 模糊查询:param request::return:"""keyword = request.GET.get('name')page = request.GET.get("page", '')limit = request.GET.get("limit", '')role_id = request.GET.get('position', '')response_data = {}response_data['code'] = 0response_data['msg'] = ''data = []if keyword is None:results_obj = User.objects.all()else:results_obj = User.objects.filter(name__contains=keyword).all()paginator = Paginator(results_obj, limit)results = paginator.page(page)if results:for user in results:record = {"id": user.id,"name": user.name,"password": user.password,"phone": user.phone,"role": user.role,'create_time': user.create_time.strftime('%Y-%m-%d %H:%m:%S'),"desc": user.description,}data.append(record)response_data['count'] = len(results_obj)response_data['data'] = datareturn JsonResponse(response_data)def user(request):"""跳转用户页面"""username = request.session['username']role = int(request.session['role'])user_id = request.session['user_id']return render(request, 'user.html', locals())def login_check(request):"""登录校验"""response_data = {}name = request.POST.get('username')password = request.POST.get('password')user = User.objects.filter(name=name, password=password).first()info = {}if user:# 将用户名存入session中request.session["username"] = user.namerequest.session["role"] = user.rolerequest.session["user_id"] = user.idresponse_data['message'] = '登录成功'return JsonResponse(response_data, status=201)else:return JsonResponse({'message': '用户名或者密码不正确'}, status=401)def edit_user(request):"""修改用户"""response_data = {}user_id = request.POST.get('id')username = request.POST.get('username')phone = request.POST.get('phone')desc = request.POST.get('desc')User.objects.filter(id=user_id).update(name=username,desc=desc,phone=phone)response_data['msg'] = 'success'return JsonResponse(response_data, status=201)def del_user(request):"""删除用户"""user_id = request.POST.get('id')result = User.objects.filter(id=user_id).first()try:if not result:response_data = {'error': '删除失败!', 'message': '找不到id为%s' % user_id}return JsonResponse(response_data, status=403)result.delete()response_data = {'message': '删除成功!'}return JsonResponse(response_data, status=201)except Exception as e:response_data = {'message': '删除失败!'}return JsonResponse(response_data, status=403)def change_password(request):"""修改密码"""old_pwd = request.POST.get('password1')username = request.session["username"]user_obj = User.objects.filter(name=username).first()if user_obj.password == old_pwd:User.objects.filter(name=username).update(password=request.POST.get('password2'))return JsonResponse({'msg': '修改成功!', 'error': 0})else:return JsonResponse({'msg': '旧密码不正确,请重新输入', 'error': 403})
论文参考:
源码获取:
源码下载