东张西望

各位观众,大家晚上好。很高兴我又有时间来絮叨了,下面是我来深圳以后的一些见闻。

深圳是一个美丽的城市,与北京相比,它的空气无论是湿度还是清洁度都非常宜人。我到达深圳的那天,穿着厚厚的羽绒服,站在地铁里面,发现周围的人都穿着短袖或单衣……今天,已经有不少女孩子穿裙子了——不是呢子裙,而是真正的夏装。

在这里我要强烈谴责长宇物流,当我收到货物的时候,我的心都碎了。当初他们说要给我的3个塑料整理箱加包装,所以多收了20公斤的费用,而实际上什么包装都没有,还是我最初贴上去的一些胶带。更不用说他们落下一个箱子在广州,从而耽误了3天的事情了。巧妙的包装很重要,这次拆包时我的瓷碗和玻璃杯子都没有碎!但为什么塑料微波炉盒子却碎了呢?囧

说一下我遇到的最不靠谱的面试。我来之前已经约了一个人,说周一下午2点去他们公司谈谈。结果当我坐了40多分钟公车跑到他们公司门口,打电话给对方,对方居然已经忘记了这回事……然后我们只好再约。而另一个人在QQ上高兴地说,他要去北京出差,不如约出来大家先聊下,我悲伤地告诉他我已经在深圳了,所以只能等下周他从北京回来再谈。总的来说,到目前为止也没有什么明确的意向,只能够先做好内务工作了。

老生常谈的话题是,深圳的物价实在太离谱了!日常用品其实我都有托运过来,那么也就买一些杂物吧,花了千把块,好像都没买什么东西。比如饭碗,你见过10块钱一个的碗嘛?只是吃饭的小饭碗哦!而这只是中档价格。然后坐公车,随便一趟都是3块以上。唯一值得欣慰的是手机资费,深圳动感地带音乐卡,本地接听全省范围内全免费,本地拨打本地闲时(零点到下午4点)0.13元/分钟,忙时0.23元/分钟,本地拨打国内长途0.29元/分钟;省际漫游主叫0.39元/分钟,被叫0.29元/分钟。

我所住的地方,属于南山区,优点是生活环境好,交通也很方便,缺点是旁边有很多城中村,走在路上总感觉毛毛的。在北京我住2楼,老担心有人从窗户外面爬进来,现在我住12楼,每天站在阳台上看下面的感觉真好——叫你爬,从管道爬我用撑衣杆戳你哦。

这是一个比较复杂的任务,需要使用深度学习和计算机视觉的技术。以下是一个简单的思路: 1. 使用深度学习的目标检测算法,比如YOLOv3或者Faster R-CNN,来检测视频中的货车和司机。 2. 对于司机,可以使用人体姿态估计算法,比如OpenPose,来识别司机的动作,比如东张西望或者抽烟。 3. 对于司机的动作,可以使用OpenCV来计算动作发生的时间,并将结果导入excel中。 以下是一个示例代码,仅供参考: ```python import cv2 import numpy as np import pandas as pd import time # 加载YOLOv3模型 net = cv2.dnn.readNetFromDarknet('yolov3.cfg', 'yolov3.weights') # 加载类别标签 classes = [] with open('coco.names', 'r') as f: classes = [line.strip() for line in f.readlines()] # 设置输出层 output_layers = [net.getLayerNames()[i[0] - 1] for i in net.getUnconnectedOutLayers()] # 加载OpenPose模型 protoFile = "pose_deploy_linevec.prototxt" weightsFile = "pose_iter_440000.caffemodel" net = cv2.dnn.readNetFromCaffe(protoFile, weightsFile) # 设置身体部位的连接顺序 body_parts = ["Nose", "Neck", "RShoulder", "RElbow", "RWrist", "LShoulder", "LElbow", "LWrist", "RHip", "RKnee", "RAnkle", "LHip", "LKnee", "LAnkle", "REye", "LEye", "REar", "LEar"] pose_pairs = [[1, 2], [1, 5], [2, 3], [3, 4], [5, 6], [6, 7], [1, 8], [8, 9], [9, 10], [1, 11], [11, 12], [12, 13], [1, 0], [0, 14], [14, 16], [0, 15], [15, 17], [2, 17], [5, 16]] # 打开视频文件 cap = cv2.VideoCapture('truck.mp4') # 创建空的DataFrame来存储结果 results = pd.DataFrame(columns=['time', 'action']) while cap.isOpened(): # 读取一帧 ret, frame = cap.read() if not ret: break # 使用YOLOv3模型检测货车和司机 height, width, channels = frame.shape blob = cv2.dnn.blobFromImage(frame, 1/255, (416, 416), (0,0,0), True, crop=False) net.setInput(blob) outs = net.forward(output_layers) class_ids = [] confidences = [] boxes = [] for out in outs: for detection in out: scores = detection[5:] class_id = np.argmax(scores) confidence = scores[class_id] if confidence > 0.5: center_x = int(detection[0] * width) center_y = int(detection[1] * height) w = int(detection[2] * width) h = int(detection[3] * height) x = center_x - w/2 y = center_y - h/2 class_ids.append(class_id) confidences.append(float(confidence)) boxes.append([x, y, w, h]) indices = cv2.dnn.NMSBoxes(boxes, confidences, 0.5, 0.4) for i in indices: i = i[0] if classes[class_ids[i]] == 'truck': truck_box = boxes[i] elif classes[class_ids[i]] == 'person': person_box = boxes[i] # 使用OpenPose模型检测司机的动作 x, y, w, h = person_box person_frame = frame[int(y):int(y+h), int(x):int(x+w)] blob = cv2.dnn.blobFromImage(person_frame, 1.0/255, (368, 368), (0, 0, 0), swapRB=False, crop=False) net.setInput(blob) output = net.forward() points = [] for i in range(len(body_parts)): probMap = output[0, i, :, :] probMap = cv2.resize(probMap, (person_frame.shape[1], person_frame.shape[0])) minVal, prob, minLoc, point = cv2.minMaxLoc(probMap) if prob > 0.1: x = int((person_box[0] + point[0]) * width / person_frame.shape[1]) y = int((person_box[1] + point[1]) * height / person_frame.shape[0]) points.append((x, y)) else: points.append(None) for pair in pose_pairs: partA = pair[0] partB = pair[1] if points[partA] and points[partB]: cv2.line(frame, points[partA], points[partB], (0, 255, 0), 3) # 判断司机的动作 if points[3] and points[4] and points[5]: angle1 = np.arctan2(points[5][1]-points[3][1], points[5][0]-points[3][0]) * 180 / np.pi angle2 = np.arctan2(points[4][1]-points[3][1], points[4][0]-points[3][0]) * 180 / np.pi if abs(angle1-angle2) > 30: action = '东张西望' else: action = '未知' elif points[3] and points[6] and points[7]: angle1 = np.arctan2(points[7][1]-points[3][1], points[7][0]-points[3][0]) * 180 / np.pi angle2 = np.arctan2(points[6][1]-points[3][1], points[6][0]-points[3][0]) * 180 / np.pi if abs(angle1-angle2) > 30: action = '抽烟' else: action = '未知' else: action = '未知' # 将结果记录到DataFrame中 results = results.append({'time': time.time(), 'action': action}, ignore_index=True) # 显示视频和结果 cv2.imshow('frame', frame) if cv2.waitKey(1) & 0xFF == ord('q'): break # 保存结果到Excel文件中 results.to_excel('results.xlsx', index=False) # 清理资源 cap.release() cv2.destroyAllWindows() ```
评论 4
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值