1.简介
道路基础设施是一项重要的公共资产,因为它有助于经济发展和增长,同时带来重要的社会效益。路面检查主要基于人类的视觉观察和使用昂贵机器的定量分析。这些方法的最佳替代方案是智能探测器,它使用记录的图像或视频来检测损坏情况。除了道路infr一个结构,道路破损检测器也将在自主驾驶汽车,以检测他们的方式有些坑洼或其他干扰,尽量避免他们有用。
2.数据集
本项目中使用的数据集是从这里收集的。该数据集包含不同国家的道路图像,它们是日本、印度、捷克。对于图像,标签的注释是在 xml 文件中,即标签是 pascal voc 格式。由于数据集包含来自日本的大部分图像(在以前的版本中,它仅包含来自日本的图像),因此根据数据来源,根据日本道路指南确定了标签。
但是最新的数据集现在包含其他国家的图像,因此为了概括我们只考虑以下标签的损害。d00:垂直裂缝,d10:水平裂缝,d20:鳄鱼裂缝,d40:坑洼
3.基于深度学习得目标检测
cnn 或卷积神经网络是所有计算机视觉任务的基石。即使在物体检测的情况下,从图像中提取物体的模式到特征图(基本上是一个比图像尺寸小的矩阵)卷积操作也被使用。现在从过去几年开始,已经对对象检测任务进行了大量研究,我们得到了大量最先进的算法或方法,其中一些简而言之,我们在下面进行了解释。
4.eda
数据集中的图像总数:26620
标签分布
每个班级的计数d00 : 6592 d10 : 4446 d20 : 8381 d40 : 5627
各国标签分布(全数据分析)
捷克数据分析0 图像数量 2829 1 d00 988 2 d10 399 3 d20 161 4 d40 197 5 标签数量 1745 ************************ **********************************************印度数据分析 类别计数6 图像数量 7706 7 d00 1555 8 d10 68 9 d20 2021 10 d40 3187 11 标签数量 6831 **************************** ******************************************日本数据分析12 图像数量 10506 13 d00 404914 d10 3979 15 d20 6199 16 d40 2243 17 标签数量 16470 ************************************ ************************************
图像中标签大小的分布
标签最小尺寸:0x1 标签最大尺寸:704x492
5.关键技术
对象检测现在是一个庞大的主题,相当于一个学期的主题。它由许多算法组成。因此,为了使其简短,目标检测算法被分为各种类别,例如基于区域的算法(rcnn、fast-rcnn、faster-rcnn)、两级检测器、一级检测器,其中基于区域的算法本身是两级检测器的一部分,但我们将在下面简要地解释它们,因此我们明确地提到了它们。让我们从rcnn(基于区域的卷积神经网络)开始。
目标检测算法的基本架构由两部分组成。该部分由一个 cnn 组成,它将原始图像信息转换为特征图,在下一部分中,不同的算法有不同的技术。因此,在 rcnn 的情况下,它使用选择性搜索来获得 roi(感兴趣区域),即在那个地方有可能有不同的对象。从每个图像中提取大约 2000 个区域。它使用这些 roi 对标签进行分类并使用两种不同的模型预测对象位置。因此这些模型被称为两级检测器。
rcnn 有一些限制,为了克服这些限制,他们提出了 fast rcnn。rcnn 具有很高的计算时间,因为每个区域都分别传递给 cnn,并且它使用三种不同的模型进行预测。因此,在 fast rcnn 中,每个图像只传递一次到 cnn 并提取特征图。在这些地图上使用选择性搜索来生成预测。将 rcnn 中使用的所有三个模型组合在一起。
但是 fast rcnn 仍然使用缓慢的选择性搜索,因此计算时间仍然很长。猜猜他们想出了另一个名字有意义的版本,即更快的 rcnn。faster rcnn 用区域提议网络代替了选择性搜索方法,使算法更快。现在让我们转向一些一次性检测器。yolo 和 ssd 是非常著名的物体检测模型,因为它们在速度和准确性之间提供了非常好的权衡
yolo:单个神经网络在一次评估中直接从完整图像中预测边界框和类别概率。由于整个检测管道是一个单一的网络,因此可以直接在检测性能上进行端到端的优化
ssd(single shot detector):ssd 方法将边界框的输出空间离散为一组不同纵横比的默认框。离散化后,该方法按特征图位置进行缩放。single shot detector 网络结合了来自具有不同分辨率的多个特征图的预测,以自然地处理各种大小的对象。
6.型号
作为深度学习的新手,或者准确地说是计算机视觉,为了学习基础知识,我们尝试了一些基本且快速的算法来实现如下数据集:
efficientdet_d0ssd_mobilenet_v2yolov3
对于第一个和第二个模型,我们使用了tensorflow 模型 zoo并且为了训练 yolov3 引用了this。用于评估 map(平均平均精度),使用 effectivedet_d0 和 ssd_mobilenet_v2 得到的 map 非常低,可能是因为没有更改学习率、优化器和数据增强的一些默认配置。
7.结果
使用 efficicentdet_d0 进行推导
import tensorflow as tffrom object_detection.utils import label_map_utilfrom object_detection.utils import config_utilfrom object_detection.utils import visualization_utils as viz_utilsfrom object_detection.builders import model_builder# load pipeline config and build a detection modelconfigs = config_util.get_configs_from_pipeline_file('/content/efficientdet_d0_coco17_tpu-32/pipeline.config')model_config = configs['model']detection_model = model_builder.build(model_config=model_config, is_training=false)# restore checkpointckpt = tf.compat.v2.train.checkpoint(model=detection_model)ckpt.restore('/content/drive/mydrive/efficientdet/checkpoints/ckpt-104').expect_partial()@tf.functiondef detect_fn(image):detect objects in image. image, shapes = detection_model.preprocess(image) prediction_dict = detection_model.predict(image, shapes) detections = detection_model.postprocess(prediction_dict, shapes)return detectionscategory_index = label_map_util.create_category_index_from_labelmap('/content/data/label_map.pbtxt', use_display_name=true)for image_path in image_paths: print('running inference for {}... '.format(image_path), end='') image_np = load_image_into_numpy_array(image_path) input_tensor = tf.convert_to_tensor(np.expand_dims(image_np, 0), dtype=tf.float32) detections = detect_fn(input_tensor) num_detections = int(detections.pop('num_detections')) detections = {key: value[0, :num_detections].numpy()for key, value in detections.items()} detections['num_detections'] = num_detections# detection_classes should be ints. detections['detection_classes'] = detections['detection_classes'].astype(np.int64) label_id_offset = 1 image_np_with_detections = image_np.copy() viz_utils.visualize_boxes_and_labels_on_image_array( image_np_with_detections, detections['detection_boxes'], detections['detection_classes']+label_id_offset, detections['detection_scores'], category_index, use_normalized_coordinates=true, max_boxes_to_draw=200, min_score_thresh=.30, agnostic_mode=false) %matplotlib inline fig = plt.figure(figsize = (10,10)) plt.imshow(image_np_with_detections) print('done') plt.show() 使用 ssd_mobilenet_v2 进行推导
(与efficientdet 相同的代码)
yolov3 的推导
def func(input_file):classes = ['d00', 'd10', 'd20', 'd40']alt_names = {'d00': 'lateral_crack', 'd10': 'linear_cracks', 'd20': 'aligator_crakcs', 'd40': 'potholes'} # initialize a list of colors to represent each possible class labelnp.random.seed(42)colors = np.random.randint(0, 255, size=(len(classes), 3),dtype=uint8) # derive the paths to the yolo weights and model configurationweightspath = /content/drive/mydrive/yolo/yolo-obj_final.weightsconfigpath = /content/yolov3.cfg # load our yolo object detector trained on coco dataset (80 classes) # and determine only the *output* layer names that we need from yolo #print([info] loading yolo from disk...)net = cv2.dnn.readnetfromdarknet(configpath, weightspath)ln = net.getlayernames()ln = [ln[i[0] - 1] for i in net.getunconnectedoutlayers()] # read the next frame from the fileframe = cv2.imread(input_file)(h, w) = frame.shape[:2] # construct a blob from the input frame and then perform a forward # pass of the yolo object detector, giving us our bounding boxes # and associated probabilitiesblob = cv2.dnn.blobfromimage(frame, 1 / 255.0, (416, 416),swaprb=true, crop=false)net.setinput(blob)start = time.time()layeroutputs = net.forward(ln)end = time.time() # initialize our lists of detected bounding boxes, confidences, # and class ids, respectivelyboxes = []confidences = []classids = [] # loop over each of the layer outputsfor output in layeroutputs: # loop over each of the detectionsfor detection in output: # extract the class id and confidence (i.e., probability) # of the current object detectionscores = detection[5:]classid = np.argmax(scores)confidence = scores[classid] # filter out weak predictions by ensuring the detected # probability is greater than the minimum probabilityif confidence > 0.3: # scale the bounding box coordinates back relative to # the size of the image, keeping in mind that yolo # actually returns the center (x, y)-coordinates of # the bounding box followed by the boxes' width and # heightbox = detection[0:4] * np.array([w, h, w, h])(centerx, centery, width, height) = box.astype(int) # use the center (x, y)-coordinates to derive the top # and and left corner of the bounding boxx = int(centerx - (width / 2))y = int(centery - (height / 2)) # update our list of bounding box coordinates, # confidences, and class idsboxes.append([x, y, int(width), int(height)])confidences.append(float(confidence))classids.append(classid) # apply non-maxima suppression to suppress weak, overlapping # bounding boxesidxs = cv2.dnn.nmsboxes(boxes, confidences, 0.3,0.25) # ensure at least one detection existsif len(idxs) > 0: # loop over the indexes we are keepingfor i in idxs.flatten(): # extract the bounding box coordinates(x, y) = (boxes[i][0], boxes[i][1])(w, h) = (boxes[i][2], boxes[i][3]) # draw a bounding box rectangle and label on the framecolor = [int(c) for c in colors[classids[i]]]cv2.rectangle(frame, (x, y), (x + w, y + h), color, 2)label = classes[classids[i]]text = {}: {:.4f}.format(alt_names[label],confidences[i])cv2.puttext(frame, text, (x, y - 5),cv2.font_hershey_simplex, 0.5, color, 2) cv2_imshow(frame)
自动驾驶使得毫米波雷达迎来百亿市场 中小厂商如何抢夺市场
家用电器背后连接和传感技术终极资源
数字电源与 GaN 相结合可实现 99% 的效率
紫光DRAM事业群将发力存储芯片领域
MAX1811 USB供电、Li+充电器芯片(应用电路)
通过利用深度学习对道路损坏进行检测分析
带你了解如何设计USB协议接口
扬尘在线监测系统助力工地管理“智慧化”
三星双折叠、外对折手机新专利曝光,展开后可达8、13英寸
如何定义一个“机器人”
基于飞腾开发板使用单目摄像头完成了完成了全息影像的展示
一种自旋阀GMR隔离放大器的设计方案
传输介质
医疗设备对高速连接器的应用考量
西门子电动汽车充电设施产品已覆盖了欧美和亚太多数新能源汽车市场
央视新闻直播现场:消防处置演练,HMT鹰眼大显身手
苹果2018年度满意度报告出炉 AppleWatch成最令人满意的产品
传苹果iWatch专用1.5英寸屏正测试 或今年年内发布
创新领航:软通保险荣膺2023年金i奖“数字化转型创新奖”
固态硬盘涨价狂潮,囤货时代已来临!