| |
model = torchvision.models.alexnet(pretrained=False) |
| |
model.classifier[6] = torch.nn.Linear(model.classifier[6].in_features, 2) |
| |
Sequential( (0): Dropout(p=0.5, inplace=False) (1): Linear(in_features=9216, out_features=4096, bias=True) (2): ReLU(inplace=True) (3): Dropout(p=0.5, inplace=False) (4): Linear(in_features=4096, out_features=4096, bias=True) (5): ReLU(inplace=True) (6): Linear(in_features=4096, out_features=1000, bias=True) ) |
| |
model.load_state_dict(torch.load('best_model.pth')) device = torch.device('cuda') model = model.to(device) |
| |
x = cv2.cvtColor(x, cv2.COLOR_BGR2RGB) |
| |
x = x.transpose((2, 0, 1)) |
| |
mean = 255.0 * np.array([0.485, 0.456, 0.406]) stdev = 255.0 * np.array([0.229, 0.224, 0.225]) |
| |
blocked_slider = widgets.FloatSlider(description='blocked', min=0.0, max=1.0, orientation='vertical') |
| |
speed_slider = widgets.FloatSlider(description='speed', min=0.0, max=0.5, value=0.0, step=0.01, orientation='horizontal') |
| |
camera_link = traitlets.dlink((camera, 'value'), (image, 'value'), transform=bgr8_to_jpeg) |
| |
def update(change): x = change['new'] x = preprocess(x) y = model(x) 。。。 update({'new': camera.value}) |
| |
y = F.softmax(y, dim=1) prob_blocked = float(y.flatten()[0]) blocked_slider.value = prob_blocked |
| |
if prob_blocked < 0.5: robot.forward(speed_slider.value) else: robot.left(speed_slider.value) |
| |
camera.observe(update, names='value') |
机器人 MulitCuber 999 利用三星 Galaxy S3 智能手机以 34 分钟 25.89 秒的成绩成为了世界首个破解 9x9x9 魔方的机器人!
Tinkercad通过Codeblock的发布将编程引入其3D建模平台。跟其他普通图形环境中那样绘制设计不一样,这是面向对象的编程,这意味着您将预定义的物体放在工作平面上,然后对其进行修改。
Arduino集成开发环境(或是Arduino IDE)包含了一个用于写代码的文本编辑器、一个消息区、一个文本控制台以及一个带有常用功能按钮和文本菜单的工具栏。
本文介绍ESP32中的中断机制,以及如何通过GPIO中断实现按钮控制。重点讲解了如何设置中断服务例程、处理中断抖动问题,并提供了消除中断抖动的示例代码。
5月12日21:07,在包括上海在内的全球各地同时召开的新闻发布会上,天文学家向人们展示了位于我们银河系中心的超大质量黑洞的首张照片!
Jetbot 系统上只使用一个 CSI 摄像头,而没有其他任何距离传感设备(sensor),便能实现“避障”、“循路”与“遇障停止”等功能。