来源:投稿 作者:LSC
编辑:学姐
面试时间45分钟
1.自我介绍
2.手撕代码
反转链表
创建一个链表,然后把它反转出来,输出
#define _CRT_SECURE_NO_WARNINGS
#include<iostream>
#include<cstdio>
#include<set>
#include<vector>
#include<algorithm>
#include<map>
#include<string>
#include<stdlib.h>
#include<ctime>
#include<queue>
using namespace std;
int n, x;
struct ListNode
{
int val;
ListNode *next;
ListNode() : val(0), next(nullptr) {}
ListNode(int x) : val(x), next(nullptr) {}
ListNode(int x, ListNode *next) : val(x), next(next) {}
};
ListNode* reverseList(ListNode* head)
{
ListNode *prev = nullptr;
ListNode *curr = head;
while (curr)
{
ListNode *next = curr->next;
curr->next = prev;
prev = curr;
curr = next;
}
return prev;
}
ListNode *create(int a[], int n) // 创建链表
{
ListNode *pre, *p, *head;
head = new ListNode;
head->next = nullptr;
pre = head;
for (int i = 0; i < n; ++i)
{
p = new ListNode;
p->val = a[i];
p->next = nullptr;
pre->next = p;
pre = p;
}
return head;
}
int main()
{
int a[10], n;
scanf("%d", &n);
for (int i = 0; i < n; ++i) { scanf("%d", &a[i]); }
ListNode *head = create(a, n);
ListNode *p = head->next;
while (p != nullptr) { printf("%d ", p->val); p = p->next; }
printf("\n");
ListNode *rhead = reverseList(head->next);
while (rhead != nullptr) { printf("%d ", rhead->val); rhead = rhead->next; }
printf("\n");
return 0;
}
连通块
输入一张图,判断里面几个连通块,上下左右四个方向连在一起的就是连通块。
dfs或者bfs模板题
「核心代码」:
int dir[4][2] = { {-1, 0}, {1, 0}, {0,-1},{0,1} }; // 上下左右四个方向
int vis[105][105]; //标记是否已遍历
int block_num = 0;
void dfs(int x, int y)
{
for (int i = 0; i < 4; ++i)
{
int xx = x + dir[i][0], yy = y + dir[i][1];
if (check(xx, yy) && vis[xx][yy] == 0) // 判断没越界并且没被遍历过
{
dfs(xx, yy);
}
}
}
int main()
{
for (int i = 0; i < n; ++i)
{
for (int j = 0; j < m; ++j)
{
if (g[i][j] == 1)
{
dfs(i, j);
block_num++;
}
}
}
return 0;
}
3.项目介绍
4.项目的难点以及如何解决的
5.yolov5比yolov4的改进/不同
-
(1) 输入端增加Focus结构
-
(2) Neck和yolov4一样采用FPN+PAN,但将卷积变成了CSP
-
(3) 输入端自适应锚框计算、自适应图片缩放
-
(4) 输出端采用GIOU_Loss
6.yolov5的损失函数
Yolo的损失函数都分为三个部分: 边框损失、置信度损失和分类损失
。
注意两个参数是用来调节各部分损失比重的占比,其中大部分边框会没有对象,存在较大的负样本淹没问题,这个损失会比较大,所以它前面的系数=0.5
设置小一点,降低它的比重,对于位置比较难回归,所以前面的系数比较大设置为5
。
但是边框损失在yolov4的时候是采用DIou_loss
,yolov5是采用GIou_loss
。
7.提问环节,有什么想了解的
面试官建议可以补充一下「数学基础,多做项目」
关注下方《学姐带你玩AI》🚀🚀🚀
回复“简历”领取算法工程师万能简历公式
更多大牛面经持续更新中...
码字不易,欢迎大家点赞评论收藏!