当前位置: 首页 > news >正文

ftp 网站 怎么上传文件自己的电脑做服务器 并建网站

ftp 网站 怎么上传文件,自己的电脑做服务器 并建网站,如何做公司网站空间,网站推广怎么样对象检测是一种计算机视觉技术#xff0c;它使软件系统能够从给定的图像或视频中检测、定位并跟踪物体。对象检测的一个特殊属性是它能识别对象的类别#xff08;如人、桌子、椅子等#xff09;并在给定图像中指出其具体位置坐标。这个位置通常通过在物体周围绘制一个边界框…对象检测是一种计算机视觉技术它使软件系统能够从给定的图像或视频中检测、定位并跟踪物体。对象检测的一个特殊属性是它能识别对象的类别如人、桌子、椅子等并在给定图像中指出其具体位置坐标。这个位置通常通过在物体周围绘制一个边界框来指出。边界框可能会也可能不会准确地定位物体的位置。在图像内定位物体的能力定义了用于检测的算法的性能。人脸检测就是对象检测的一个例子。 通常对象检测任务分为三个步骤 生成输入的小片段如下图所示。你可以看到大量的边界框覆盖了整个图像。对每个分割的矩形区域进行特征提取以预测矩形是否包含有效物体。将重叠的框合并成一个单一的边界矩形非极大值抑制。 TensorFlow是一个用于数值计算和大规模机器学习的开源库它简化了获取数据、训练模型、提供预测和完善未来结果的过程。TensorFlow集合了机器学习和深度学习模型与算法使用Python作为方便的前端并在优化的C中高效运行。 使用TensorFlow进行对象检测如上所述使用这个API不一定需要了解神经网络和机器学习的知识因为我们主要使用API中提供的文件。我们需要的只是一些Python知识和完成这个项目的热情。 按照以下步骤进行 第1步创建一个名为ObjectDetection的文件夹并用VS Code打开。 第2步通过在VS Code的终端输入以下命令从Github仓库下载Tensorflow API git clone https://github.com/tensorflow/models第3步设置虚拟环境 python -m venv --system-site-packages .\venv激活环境 .\venv\Scripts\activate将pip版本升级到最新 python -m pip install --upgrade --ignore-installed第4步安装依赖项 安装并升级tensorflow pip install tensorflow pip install --upgrade tensorflow安装matplotlib pip install pillow Cython lxml jupyter matplotlib导航到models文件夹中的research子文件夹。 cd \models\research\第5步现在我们需要下载Protocol BuffersProtobuf这是谷歌的一种语言中立、平台中立的扩展机制用于序列化结构化数据可以想象成XML但更小、更快、更简单。 在models文件夹的research子文件夹中提取从上述链接下载的zip的内容并访问bin文件夹复制那里的protoc.exe的路径。然后打开“编辑系统环境变量”并点击“环境变量”。 (i) 在系统变量下选择’path’并点击编辑。 (ii) 点击新建并粘贴’protoc.exe’的复制路径。 第6步然后在VS Code的终端运行这个命令 protoc object_detection/protos/*.proto --python_out.第7步在同一文件夹中创建一个名为detect.py的新Python文件并粘贴下面给出的代码 import numpy as np import os import six.moves.urllib as urllib import sys import tarfile import tensorflow as tf import zipfile import pathlib from collections import defaultdict from io import StringIO from matplotlib import pyplot as plt from PIL import Image from IPython.display import display from object_detection.utils import ops as utils_ops from object_detection.utils import label_map_util from object_detection.utils import visualization_utils as vis_util# 当前目录不是models时改变当前工作目录 while models in pathlib.Path.cwd().parts:os.chdir(..)# 加载模型函数 def load_model(model_name):base_url http://download.tensorflow.org/models/object_detection/model_file model_name .tar.gzmodel_dir tf.keras.utils.get_file(fnamemodel_name, originbase_url model_file,untarTrue)model_dir pathlib.Path(model_dir)/saved_modelmodel tf.saved_model.load(str(model_dir))return model# 路径到标签文件 PATH_TO_LABELS models/research/object_detection/data/mscoco_label_map.pbtxt # 创建类别索引 category_index label_map_util.create_category_index_from_labelmap(PATH_TO_LABELS, use_display_nameTrue)# 模型名称 model_name ssd_inception_v2_coco_2017_11_17 # 加载检测模型 detection_model load_model(model_name)# 为单个图像运行推理的函数 def run_inference_for_single_image(model, image):image np.asarray(image)# 输入需要是张量使用tf.convert_to_tensor进行转换。input_tensor tf.convert_to_tensor(image)# 模型期望图像的批量所以使用tf.newaxis添加一个轴。input_tensor input_tensor[tf.newaxis,...]# 运行推理model_fn model.signatures[serving_default]output_dict model_fn(input_tensor)# 所有输出都是批量张量。# 转换为numpy数组并取索引[0]来去除批量维度。# 我们只对前num_detections个检测感兴趣。num_detections int(output_dict.pop(num_detections))output_dict {key:value[0, :num_detections].numpy() for key,value in output_dict.items()}output_dict[num_detections] num_detections# detection_classes应该是整数。output_dict[detection_classes] output_dict[detection_classes].astype(np.int64)# 处理带有掩模的模型if detection_masks in output_dict:# 将边框掩模调整到图像大小。detection_masks_reframed utils_ops.reframe_box_masks_to_image_masks(output_dict[detection_masks], output_dict[detection_boxes],image.shape[0], image.shape[1]) detection_masks_reframed tf.cast(detection_masks_reframed 0.5,tf.uint8)output_dict[detection_masks_reframed] detection_masks_reframed.numpy()return output_dict# 展示推理的函数 def show_inference(model, frame):# 从摄像头获取画面并将其转换为数组image_np np.array(frame)# 实际检测。output_dict run_inference_for_single_image(model, image_np)# 对检测结果进行可视化。vis_util.visualize_boxes_and_labels_on_image_array(image_np,output_dict[detection_boxes],output_dict[detection_classes],output_dict[detection_scores],category_index,instance_masksoutput_dict.get(detection_masks_reframed, None),use_normalized_coordinatesTrue,line_thickness5)return(image_np)# 现在我们打开摄像头并开始检测物体 import cv2 video_capture cv2.VideoCapture(0) while True:# 逐帧捕获re,frame video_capture.read()Imagenpshow_inference(detection_model, frame)cv2.imshow(object detection, cv2.resize(Imagenp, (800,600)))if cv2.waitKey(1) amp; 0xFF ord(q):break video_capture.release() cv2.destroyAllWindows()第7步对于实时对象检测我们还需要一个额外的依赖库OpenCV。因此要安装OpenCV请在终端运行以下命令。 pip install opencv-python第8步现在我们已经准备就绪可以执行设置并进行对象检测了。执行’detect.py’文件。 python detect.py
http://www.pierceye.com/news/523008/

相关文章:

  • 精品资料网站网站建立
  • 网站开发印花税营销咨询
  • 马鞍山建设集团有限公司网站找工程项目上哪个平台好呢
  • 网站建设发货流程图电子商务是什么
  • 与有权重网站做友链软件开发可以做网站么
  • html网站开发代码专业的网站开发团队
  • 聚美优品的网站建设状况wordpress 微商城
  • 网络营销型网站律师做推广的网站
  • 网站建设公司排行济南网页制作设计营销
  • 网站功能建设与栏目划分wordpress 系统需求
  • 做网络推广要做网站吗wordpress中对视频排序
  • 三合一网站怎么建立如何做网站规范
  • 浙江网站改版设计公司网站建设实训目的
  • 建设网站装配式建筑楼房东莞网站建设php方案
  • 宜昌网站制作公司排名眉山招聘网站建设
  • 网站开发项目经理工资公司网站建设管理
  • 大良o2o网站建设百度手机卫士下载安装
  • 张家界市网站建设设计简单的php购物网站源码
  • 网站的流量检测怎么做禹州做网站的公司
  • 百度网站录入北京到安阳高铁
  • 去马来西亚做网站网站安卓网站开发平台
  • jsp 哪些网站利用技术搭建网站做网站代理
  • 网站建设 分类广告html做网站自适应宽度
  • 鄂州市建设局网站佰牛网站建设
  • 织梦网站上传及安装步骤农畜产品销售平台的网站建设
  • 网站续费如何做分录做交互设计的网站
  • 国家网站备案查询系统安丘网站建设多少钱
  • 长沙公司网站设计鹤壁建设网站推广公司电话
  • 电子商务网站建设与管理实务电子商务网站的构建
  • 做网站的集团用什么自己做网站