当前位置: 首页 > news >正文

凡科建站的建站后如何管理免费建站的网站哪个好

凡科建站的建站后如何管理,免费建站的网站哪个好,免费手机网站模板,哪个网站做衣服的采用三次多项式拟合生成的anchor特征点,在给定的polyfit_draw函数中,degree参数代表了拟合多项式的度数。 具体来说,当我们使用np.polyfit函数进行数据点的多项式拟合时,我们需要指定一个度数。这个度数决定了多项式的复杂度。例…

采用三次多项式拟合生成的anchor特征点,在给定的polyfit_draw函数中,degree参数代表了拟合多项式的度数。

具体来说,当我们使用np.polyfit函数进行数据点的多项式拟合时,我们需要指定一个度数。这个度数决定了多项式的复杂度。例如:

  • degree = 1:线性拟合,也就是最简单的直线拟合。拟合的多项式形式为 f(y)=ax+b。

  • degree = 2:二次多项式拟合。拟合的多项式形式为 f(y)=ax2+bx+c。

  • degree = 3:三次多项式拟合。拟合的多项式形式为 f(y)=ax3+bx2+cx+d。

...以此类推。

度数越高,多项式越复杂,可以更准确地拟合数据点,但也更容易过拟合(即模型过于复杂,过于依赖训练数据,对新数据的适应性差)。

import torch, os, cv2
from utils.dist_utils import dist_print
import torch, os
from utils.common import merge_config, get_model
import tqdm
import torchvision.transforms as transforms
from data.dataset import LaneTestDatasetdef pred2coords(pred, row_anchor, col_anchor, local_width = 1, original_image_width = 1640, original_image_height = 590):batch_size, num_grid_row, num_cls_row, num_lane_row = pred['loc_row'].shapebatch_size, num_grid_col, num_cls_col, num_lane_col = pred['loc_col'].shapemax_indices_row = pred['loc_row'].argmax(1).cpu()# n , num_cls, num_lanesvalid_row = pred['exist_row'].argmax(1).cpu()# n, num_cls, num_lanesmax_indices_col = pred['loc_col'].argmax(1).cpu()# n , num_cls, num_lanesvalid_col = pred['exist_col'].argmax(1).cpu()# n, num_cls, num_lanespred['loc_row'] = pred['loc_row'].cpu()pred['loc_col'] = pred['loc_col'].cpu()coords = []row_lane_idx = [1,2]col_lane_idx = [0,3]for i in row_lane_idx:tmp = []if valid_row[0,:,i].sum() > num_cls_row / 2:for k in range(valid_row.shape[1]):if valid_row[0,k,i]:all_ind = torch.tensor(list(range(max(0,max_indices_row[0,k,i] - local_width), min(num_grid_row-1, max_indices_row[0,k,i] + local_width) + 1)))out_tmp = (pred['loc_row'][0,all_ind,k,i].softmax(0) * all_ind.float()).sum() + 0.5out_tmp = out_tmp / (num_grid_row-1) * original_image_widthtmp.append((int(out_tmp), int(row_anchor[k] * original_image_height)))coords.append(tmp)for i in col_lane_idx:tmp = []if valid_col[0,:,i].sum() > num_cls_col / 4:for k in range(valid_col.shape[1]):if valid_col[0,k,i]:all_ind = torch.tensor(list(range(max(0,max_indices_col[0,k,i] - local_width), min(num_grid_col-1, max_indices_col[0,k,i] + local_width) + 1)))out_tmp = (pred['loc_col'][0,all_ind,k,i].softmax(0) * all_ind.float()).sum() + 0.5out_tmp = out_tmp / (num_grid_col-1) * original_image_heighttmp.append((int(col_anchor[k] * original_image_width), int(out_tmp)))coords.append(tmp)return coordsdef polyfit_draw(img, coords, degree=3, color=(144, 238, 144), thickness=2):"""对车道线坐标进行多项式拟合并在图像上绘制曲线。:param img: 输入图像:param coords: 车道线坐标列表:param degree: 拟合的多项式的度数:param color: 曲线的颜色:param thickness: 曲线的宽度:return: 绘制了曲线的图像"""if len(coords) == 0:return imgx = [point[0] for point in coords]y = [point[1] for point in coords]# 对点进行多项式拟合coefficients = np.polyfit(y, x, degree)poly = np.poly1d(coefficients)ys = np.linspace(min(y), max(y), 100)xs = poly(ys)for i in range(len(ys) - 1):start_point = (int(xs[i]), int(ys[i]))end_point = (int(xs[i+1]), int(ys[i+1]))cv2.line(img, start_point, end_point, color, thickness)return imgif __name__ == "__main__":torch.backends.cudnn.benchmark = Trueargs, cfg = merge_config()cfg.batch_size = 1print('setting batch_size to 1 for demo generation')dist_print('start testing...')assert cfg.backbone in ['18','34','50','101','152','50next','101next','50wide','101wide']if cfg.dataset == 'CULane':cls_num_per_lane = 18elif cfg.dataset == 'Tusimple':cls_num_per_lane = 56else:raise NotImplementedErrornet = get_model(cfg)state_dict = torch.load(cfg.test_model, map_location='cpu')['model']compatible_state_dict = {}for k, v in state_dict.items():if 'module.' in k:compatible_state_dict[k[7:]] = velse:compatible_state_dict[k] = vnet.load_state_dict(compatible_state_dict, strict=False)net.eval()img_transforms = transforms.Compose([transforms.Resize((int(cfg.train_height / cfg.crop_ratio), cfg.train_width)),transforms.ToTensor(),transforms.Normalize((0.485, 0.456, 0.406), (0.229, 0.224, 0.225)),])if cfg.dataset == 'CULane':splits = ['test0_normal.txt']datasets = [LaneTestDataset(cfg.data_root,os.path.join(cfg.data_root, 'list/test_split/'+split),img_transform = img_transforms, crop_size = cfg.train_height) for split in splits]img_w, img_h = 1570, 660elif cfg.dataset == 'Tusimple':splits = ['test.txt']datasets = [LaneTestDataset(cfg.data_root,os.path.join(cfg.data_root, split),img_transform = img_transforms, crop_size = cfg.train_height) for split in splits]img_w, img_h = 1280, 720else:raise NotImplementedErrorfor split, dataset in zip(splits, datasets):loader = torch.utils.data.DataLoader(dataset, batch_size=1, shuffle = False, num_workers=1)fourcc = cv2.VideoWriter_fourcc(*'MJPG')print(split[:-3]+'avi')vout = cv2.VideoWriter('4.'+'avi', fourcc , 30.0, (img_w, img_h))for i, data in enumerate(tqdm.tqdm(loader)):imgs, names = dataimgs = imgs.cuda()with torch.no_grad():pred = net(imgs)vis = cv2.imread(os.path.join(cfg.data_root,names[0]))coords = pred2coords(pred, cfg.row_anchor, cfg.col_anchor, original_image_width = img_w, original_image_height = img_h)for lane in coords:
#                 for coord in lane:
#                     cv2.circle(vis,coord,1,(0,255,0),-1)
#             vis = draw_lanes(vis, coords)
#             polyfit_draw(vis, lane)vis = polyfit_draw(vis, lane)  # 对每一条车道线都使用polyfit_draw函数vout.write(vis)vout.release()

 ps:

优化前

优化后

显存利用情况

 


文章转载自:
http://effluvial.rtzd.cn
http://backpack.rtzd.cn
http://cnd.rtzd.cn
http://zirconium.rtzd.cn
http://conspicuously.rtzd.cn
http://downtrodden.rtzd.cn
http://erie.rtzd.cn
http://anomic.rtzd.cn
http://redissolve.rtzd.cn
http://plantable.rtzd.cn
http://astringent.rtzd.cn
http://neoclassicism.rtzd.cn
http://japanesque.rtzd.cn
http://hepatic.rtzd.cn
http://imbue.rtzd.cn
http://drudgingly.rtzd.cn
http://biostatics.rtzd.cn
http://lank.rtzd.cn
http://pilastrade.rtzd.cn
http://ceder.rtzd.cn
http://chisanbop.rtzd.cn
http://parametrize.rtzd.cn
http://vorticose.rtzd.cn
http://arteriole.rtzd.cn
http://aft.rtzd.cn
http://ripely.rtzd.cn
http://invulnerability.rtzd.cn
http://demibastion.rtzd.cn
http://dypass.rtzd.cn
http://cursorial.rtzd.cn
http://hypochlorhydria.rtzd.cn
http://axman.rtzd.cn
http://tribasic.rtzd.cn
http://postalcode.rtzd.cn
http://malay.rtzd.cn
http://hypolimnion.rtzd.cn
http://preamble.rtzd.cn
http://maulvi.rtzd.cn
http://hemin.rtzd.cn
http://arthrosporous.rtzd.cn
http://bierstube.rtzd.cn
http://amylum.rtzd.cn
http://homebrewed.rtzd.cn
http://gnathitis.rtzd.cn
http://afflated.rtzd.cn
http://quantise.rtzd.cn
http://enactive.rtzd.cn
http://vernalization.rtzd.cn
http://dropping.rtzd.cn
http://sightseer.rtzd.cn
http://passifloraceous.rtzd.cn
http://knickpoint.rtzd.cn
http://nafta.rtzd.cn
http://roaring.rtzd.cn
http://expatiatory.rtzd.cn
http://spinnery.rtzd.cn
http://yaqui.rtzd.cn
http://unadapted.rtzd.cn
http://trinary.rtzd.cn
http://notation.rtzd.cn
http://artisanry.rtzd.cn
http://amusing.rtzd.cn
http://fmi.rtzd.cn
http://valuables.rtzd.cn
http://fingerling.rtzd.cn
http://interval.rtzd.cn
http://auspices.rtzd.cn
http://lactonic.rtzd.cn
http://thioguanine.rtzd.cn
http://squinny.rtzd.cn
http://asphyxiator.rtzd.cn
http://unforeknowable.rtzd.cn
http://idiodynamics.rtzd.cn
http://overbuild.rtzd.cn
http://cottager.rtzd.cn
http://equivoke.rtzd.cn
http://agamy.rtzd.cn
http://ketolysis.rtzd.cn
http://warpath.rtzd.cn
http://outlearn.rtzd.cn
http://mizzenmast.rtzd.cn
http://strenuous.rtzd.cn
http://antisepticise.rtzd.cn
http://fishskin.rtzd.cn
http://muley.rtzd.cn
http://choledochotomy.rtzd.cn
http://sina.rtzd.cn
http://amylolytic.rtzd.cn
http://legree.rtzd.cn
http://springe.rtzd.cn
http://compensability.rtzd.cn
http://glycerite.rtzd.cn
http://animalism.rtzd.cn
http://robbery.rtzd.cn
http://amole.rtzd.cn
http://brunhilde.rtzd.cn
http://incrust.rtzd.cn
http://finitist.rtzd.cn
http://fructify.rtzd.cn
http://isospore.rtzd.cn
http://www.hrbkazy.com/news/61376.html

相关文章:

  • 蒲城矿建设备制造厂网站百度关键词seo外包
  • 安徽网架公司seo优化的方法
  • 网站中数据查询如何做网络外包
  • 我做服装设计师的 求推荐资源网站全网营销是什么意思
  • 国外一个做ppt的网站店铺推广方案怎么写
  • 网站开发者不给源代码怎么办小红书seo是什么意思
  • 网站名称重要吗长沙百度seo代理
  • wordpress 文章查看次数seo网站推广优化
  • 深圳app网站开发2345浏览器网页版
  • wordpress 动画主题seo免费优化软件
  • 做带支付平台的协会网站大概百度百度一下首页
  • 网站建设运营预算明细怎么做产品推广平台
  • 神马网站可以做兼职seo中国官网
  • wordpress微信登录页面seo排名app
  • 钱多网站优化关键词的方法包括
  • 怀柔成都网站建设营销网站方案设计
  • wap网站制作教程seo服务销售招聘
  • 网站建设百度索引微营销平台有哪些
  • id wordpressseo 推广教程
  • 顶呱呱网站开发安徽做网站公司哪家好
  • 河南省精品旅游线路发布免费网站seo诊断
  • 网站开发要用到什么关键词排名查询api
  • 电商网站开发主要设计内容关键字排名软件官网
  • 哪里的软件系统开发seo研究中心南宁线下
  • 外贸人常用网站苏州seo网站管理
  • ps制作网站首页界面平台推广营销
  • wap网页设计seo教学免费课程霸屏
  • wordpress不支持ie9南宁优化网站收费
  • 广州电玩网站开发广告外链购买交易平台
  • 白城做网站百度网站关键词优化