商汤科技(上海)自动驾驶计算机视觉算法实习生面经-2020年10月
今天参加了商汤的初面,商汤是我最想去的一个公司了,技术很强,paper也多(mmdetection作者),记录一下本次面试。
本次面试是用小鱼易连面试的,面试分为两部分:自我介绍提问+算法编程。
前面一部分就是常规的项目,被问了
- 两个模块的具体做法;
- cv的其他方面还了解过哪些?
编程部分:
两道题:
1.找出二叉树中任意两个节点的最低公共父节点。
我的代码:
# 思路1:
# 从根节点根据DFS找到此两个节点,把路径存到队列中,再比较两个队列遇到同一个value的位置...
class Node():
def __init__(self, val=None, left=None, right=None):
self.val = val
self.left = left
self.right = right
def dfs(root, s, val1, val2):
if(root.value == val1):
s.append(root)
return s
elif(root.value == val2)::
s.append(root)
return s
else:
s.append(root)
dfs(root.left, s, val1, val2)
dfs(root.right, s, val1, val2)
def findDepth(s1, s2):
s1 = Array(s1)
s2 = Array(s2)
len1 = len(s1)
len2 = len(s2)
for i in range(len1):
for j in range(len2):
if(s1[len1-1-i] == s2[len2-1-j]):
return s1.index(i)
def find_common_parent(root: Node, val1, val2):
"""
Input:
root (Node): root node of a tree. Assume that the node of the tree has unique value.
val1, val2: the values of target nodes.
Output:
parent (Node): the common parent node with largest depth
"""
# [123775]
# [1236]
s1 = List()
s2 = List()
s1 = dfs(root, s1, val1, val2)
s1 = dfs(root, s2, val1, val2)
depth = findDepth(s1, s2)
print(depth)
pass
2.设计图片匹配的网络。这个真不太会,他举了例子,譬如说要对两张人脸图片做match,需要对两个特征向量怎么做?这是一个开放性的题目,我觉得我知识储备不够,回答得不是很好。
思路1:
from torch import nn
class ImageMatcher(nn.Module):
def __init__(self, backbone):
super(ImageMatcher, self).__init__()
self.backbone = backbone
def forward(self, x1, x2):
"""
Input:
x1 (Tensor, [N, C, H, W]): input image tensor
x2 (Tensor, [N, C, H, W]): input image tensor
Output:
matching_score (Tensor, [N,]): matching score of each image pair x1[i] and x2[i]
"""
raise NotImplementedError
def get_loss(self, x1, x2, y):
"""
Input:
x1, x2: same as above
y (Tensor, [N,]): binary label of each image pair. 0 for unmatched and 1 for matched.
Output:
loss (Tensor, [N,], [](scalar)): loss for model optimization
"""
raise NotImplementedError
最后,他和我介绍了一下,目前他们的工作主要是3D人体检测与类似mmdetection的平台搭建,有发paper的潜力。
我最后问了关于工作的具体内容,实习是否有leader带的问题,以后最好还要问一下,他们部分人数的多少(这一点我觉得很重要),他这边是10多个全职+十多个实习生。
最后的最后!
简单问题关注我后可以帮忙解答,
祝关注+点赞的小可爱找工作顺利,获得心仪的offer