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

沈阳和平三好街做网站全球设计学院排名

沈阳和平三好街做网站,全球设计学院排名,网站权重能带来什么作用,雷山网站建设文章目录 1. 任务目标1.1 issue1.2 原理相关资料#xff08;论文讲解#xff09;InverseFormSTN(Spatial Transformer Networks) 1.3 实现相关资料#xff08;相关PR#xff09; 2. 理解原理3. 代码实现3.X checklist3.0 Issue中的有效内容3.1 MMSegmentation支持multiple … 文章目录 1. 任务目标1.1 issue1.2 原理相关资料论文讲解InverseFormSTN(Spatial Transformer Networks) 1.3 实现相关资料相关PR 2. 理解原理3. 代码实现3.X checklist3.0 Issue中的有效内容3.1 MMSegmentation支持multiple loss3.2 北京超级云计算中心-环境配置3.3 创建分支3.4 执行官方repo的推理3.5 自己写代码3.6 报错 ImportError: cannot import name InverseFormLoss from mmseg.models.losses3.7 RuntimeError: Attempting to deserialize object on a CUDA device but torch.cuda.is_available() is False. If you are running on a CPU-only machine, please use torch.load with map_locationtorch.device(cpu) to map your storages to the CPU.3.8 pytest.raises Failed: DID NOT RAISE with try/except3.9 构建文档报错 1. 任务目标 时间8.3~8.31 1.1 issue 提出需求的 issue: https://github.com/open-mmlab/mmsegmentation/issues/3159参考 repo : https://github.com/Qualcomm-AI-research/InverseForm用到的文件 https://github.com/NVIDIA/semantic-segmentation/blob/main/network/attnscale.pyhttps://github.com/zijundeng/pytorch-semantic-segmentation/tree/master/utils 参考论文https://arxiv.org/abs/2104.02745论文Appendixhttps://openaccess.thecvf.com/content/CVPR2021/supplemental/Borse_InverseForm_A_Loss_CVPR_2021_supplemental.pdfdiscussionshttps://github.com/open-mmlab/OpenMMLabCamp/discussions/522 1.2 原理相关资料论文讲解 InverseForm 【论文笔记】InverseForm: A Loss Function for Structured Boundary-Aware SegmentationInverseForm结构边缘感知的损失函数【图像分割】InverseForm: A Loss Function for Structured Boundary-Aware SegmentationTransformer在3D语义分割中的应用碎碎念B站上好像也没有讲这个论文的教程是因为很简单吗 STN(Spatial Transformer Networks) 理论上来说InverseForm所依赖的网络是STN的逆操作 李宏毅老师的视频Spatial Transformer NetworksSTN(Spatial Transformer Networks)Spatial Transformer NetworksSTN详解 pytorch的教程https://pytorch.org/tutorials/intermediate/spatial_transformer_tutorial.html这两个的代码实现是类似的github上也有相关的repohttps://github.com/fxia22/stn.pytorch Spatial Transformer Networks这个人的专栏写的很好可以参考学习大学课件pdfSpatial Transformer NetworksReview: STN — Spatial Transformer Network (Image Classification) 1.3 实现相关资料相关PR https://github.com/open-mmlab/mmsegmentation/pull/3242https://github.com/open-mmlab/mmsegmentation/pull/3237/fileshttps://github.com/open-mmlab/mmsegmentation/pull/3002/files#diff-6b13122fc8d4a0c49faf7c7052dbf6ff6e9287d96ecf84f1f7d3959c935b0348https://github.com/open-mmlab/mmsegmentation/pull/2791/files 根据以上PR确定要改的文件是 mmsegmentation/mmseg/models/lossesmmsegmentation/tests/test_models/test_losses/ 关于单元测试除了看现有脚本也可以看看这个教程单元测试贡献指南(建设中) 2. 理解原理 3. 代码实现 源码中最重要的几个文件 https://github.com/Qualcomm-AI-research/InverseForm/blob/main/models/InverseForm.pyhttps://github.com/Qualcomm-AI-research/InverseForm/blob/main/models/loss/utils.pyhttps://github.com/Qualcomm-AI-research/InverseForm/blob/main/utils/trnval_utils.py训练时很多内容是参考了这两个项目代码是直接搬过来的没有修改。 NVIDIA的项目https://github.com/NVIDIA/semantic-segmentation/blob/main/network/attnscale.py 3.X checklist 实现inverseformlossinverseformloss的单元测试提供一个整合了inverseformloss架构的分割网络初步定为orcnet 3.0 Issue中的有效内容 2021年论文刚发布的时候很多issue是回复了后面的就没有什么回复了。。。还是有一些是有价值的信息。 Design question #6 问 为什么b_gt是通过对真实seg图像进行sobel处理得到而b_pred不是通过类似方式即对预测seg图像进行sobel处理得到答不好收敛实验效果不好所以采取了通过对预测seg添加约束即将y_pred送入一个boundary head来生成b_pred。 Questions about the test dataset #5 问训练时的edge_gts inputs[edge]是怎么得到的答是从y_gt中提取的可以在gt map上使用sobel/laplacian然后再threshold得到一个二值图。 Training the Inverseform Net on custom dataset #7 问为什么要对每个数据集分别训练InverseForm Net数据集的边界变换的差异有这么大吗答一开始只是在Imagenet上训练了一个IF module并将其用于所有的数据集这个方式和现在论文里显示的对每个数据集都单独训练一个IF module效果是类似的。 坚持当前的策略在同一数据集上进行训练是为了说明改进并非来自辅助数据集Imagenet。 因此实际使用的时候可以用任意一个数据集训练的IF module问Imagenet没有提供b_gt(边界map)你是如何在ImageNet上训练IF module的呢答可以直接从seg mask提取或者直接从原图提取也可以问如何得到 transformed GT masksSTN的pipeline是什么答直接用pytorch的STN: https://pytorch.org/tutorials/intermediate/spatial_transformer_tutorial.html问在单个数据集上训练的IF module当插入分割网络后可以适应不同数据集的边缘map的单应性变换答我们的实验和观测结果是支持这个观点的 Two confusions about the code #1 问按照论文InverseFormNet应该会输出6个或者8个值但是代码里实际只输出了4个值这4个值代表什么答上传的是最近开发的InverseFormNet的轻量化版本输出的4个值是normalized后的shift和scale提供的代码里使用的是Euclidian距离。你也可以按照论文里说的用欧氏距离的6个参数或者测地距离的8个参数随意进行实验在使用测地距离的时候确实会有搜索空间受到严重限制的问题。 Confuse about predict scales and shifts and the loss #9 问上一个问题里提到InverseFormNet输出的四个参数分别是shift和scale因此如果要优化InverseForm loss应该是让scale接近1让shift接近0但是在InverseTransform2D的代码中有mean_square_inverse_loss (((distance_coeffs*distance_coeffs).sum(dim1))**0.5).mean()这会让4个值都朝着向0的方向优化。答如果使用的损失函数是欧式距离那么提前归一化是为了减少对任意一个参数的偏差。这个问题不对shift和scale参数可以放在一个 3 × 3 3\times 3 3×3的矩阵里如果InverseFormNet输出的矩阵越靠近单位矩阵预测的边界越接近真实边界则预测的转换矩阵与单位矩阵相减之后shift和scale减法之后那个位置的值都是朝着0优化的 3.1 MMSegmentation支持multiple loss How to combine multiple loss functions? #779Docs Basic Concepts Training Tricks Multiple Losses 3.2 北京超级云计算中心-环境配置 访问https://cloud.blsc.cn直接使用用户名密码无法成功登录需要关注北京超级云计算中心微信扫码登录在微信的页面里填写邮件里给的用户和密码。 然后就可以看到控制台了在资源管理-SSH直连管理中配置密钥或者密码 配置好之后复制下面给的ssh命令 可以视情况选择接入网络我用Hong Kong不行但是用Zhongwei可以 直接用vscode登录打开文件夹或者用MobaXTerm等你习惯的终端连接软件去ssh连接输入密码就行默认用户名已经在了ssh命令中你只需要输入你上面创建的密码的值即可 配置python环境 # 查看可用软件module avail [scw6886ln01 run]$ module avail------------------------------------------------------------- /data/apps_4090/modulefiles ------------------------------------------------------------- alphafold/2.3.1 gdb/7.6.1 openblas/0.3.22 amber/22_ambertools23 go/1.18.2 opencv/3.4.16 anaconda/2020.11 gromacs/2022.5_nompi_cuda11.8 opencv/4.5.5 anaconda/2021.05 hdf5/1.12.1 OpenMMLab/MMDetection3.1.0_py38 anaconda/2022.10 hwloc/2.1.0 OpenMMLab/MMDetection_base_py38 arias/1.36.0 intel/parallelstudio/2017.1.5 openmpi/4.1.1 blas/3.10.0 intel/parallelstudio/2019.3.0 openmpi/4.1.5_gcc11.2_ucx1.14.1_cuda11.8 cmake/3.22.0 intel/parallelstudio/2021.1.1 openmpi/4.1.5_ucx1.14.1_nvhpc23.5_cuda12.1 complier/gcc/12.2.0 jupyter/lab p7zip/16.02 cuda/11.7 jupyter/notebook p7zip/21.02 cuda/11.8 lapack/3.10.1 plumed/2.7.2 cuda/12.1 libevent/2.1.12 pmix/3.2.2 cuda/12.2 namd/2.14-verbs-linux-x86_64-gcc-smp-CUDA pnetcdf/1.12.2/openmpi_gcc9.3 cudnn/8.2.1_cuda11.x namd/2.15_2022-07-21_multicore_CUDA qflow/1.0 cudnn/8.5.0_cuda11.x namd/3.0b3_multicore_CUDA rar/611 cudnn/8.6.0_cuda11.x nccl/2.11.4-1_RTX4090-cuda11.8 relion/3.0.8 cudnn/8.7.0_cuda11.x nccl/2.18.1-1_RTX4090-cuda11.8 relion/3.1.3 cudnn/8.9.3.28_cuda12.x netcdf-c/4.8.1/openmpi_gcc9.3 singularity/2.6.0 dos2unix/6.0.3 nvhpc/nvhpc/23.7 singularity/3.10.0 fftw/3.3.9 nvhpc/nvhpc-byo-compiler/22.11 singularity/3.9.9 fftw/3.3.9-ompi-float nvhpc/nvhpc-byo-compiler/23.5 tensorboard/2.3.0 gcc/11.2 nvhpc/nvhpc-byo-compiler/23.7 ucx/1.14.1_gcc11.2_cuda11.8 gcc/5.4 nvhpc/nvhpc-hpcx/23.7 ucx/1.14.1_nvhpc23.5_cuda12.1 gcc/6.3 nvhpc/nvhpc-hpcx-cuda12/23.7 ucx/1.8 gcc/7.3 nvhpc/nvhpc-nompi/22.11 ucx/1.9 gcc/8.3 nvhpc/nvhpc-nompi/23.5 xesces/3.2.0 gcc/9.3 nvhpc/nvhpc-nompi/23.7 zlib/1.2.11该有的基本都有还算比较全 安装anacondamodule load anaconda/2021.05 # anaconda/2022.10 这个版本会报错 conda init source ~/.bashrc修改~/.bashrc脚本 module加载的软件环境只在当前登录窗口有效退出登录后软件环境就会失效。用户如果需要经常使用一个软件可以把load命令放在~/.bashrc或者提交脚本中 vim ~/.bashrc module load anaconda/2021.05 module load jupyter/lab module load jupyter/notebook module load cuda/11.8 module load cudnn/8.7.0_cuda11.x module load gcc/8.3 根据目的创建不同的虚拟环境我默认base是py38所以就不创建了就直接在base上安装软件了。# 根据自己的module avail中显示的cuda版本找对应的pytorch版本 # https://pytorch.org/get-started/previous-versions/ conda create -n mmseg python3.8 conda activate mmseg # 安装torch pip3 install torch2.0.0cu118 torchvision0.15.1cu118 torchaudio2.0.1 --index-url https://download.pytorch.org/whl/cu118 |█████▏ | 369.2 MB 607 kB/s eta 0:52:05|████████████████▍ | 1160.7 MB 31.4 MB/s eta 0:00:36 # 下载速度很好 # 安装mmseg需要的包 pip3 install openmim pip3 install mmengine # mmcv需要编译需要gcc 5.4的版本 module load gcc/8.3 pip3 install mmcv# 安装之后确认下版本 pip show mmcv # Version: 2.0.1 pip show mmengine # Version: 0.8.4# 还可以看见安装位置 Location: /data/run01/scw6886/.local/lib/python3.7/site-packages # 运行期间的所以会话关闭之后就会消失。。由于每次ssh连接到bash会话都要重新手动安装一遍很麻烦所以也可以把你想要在开机时就执行的命令全都写到.bashrc文件中可以启动时执行命令关于这个文件的作用可以自行搜索。 但是也不一定每次都是要使用cuda所以看自己选择吧是每次连接时都要等差不多10分钟但是不需要手动输入还是每次都手动输入可以根据任务是否需要使用cuda来选择不等待 pip3 install torch2.0.0cu118 torchvision0.15.1cu118 torchaudio2.0.1 --index-url https://download.pytorch.org/whl/cu118 pip3 install openmim pip3 install mmengine pip3 install mmcv 目录问题 默认ssh登录后位于家目录home用于存放用户环境设置等文件不要在此目录下安装软件及存放文件默认配额为1GB作业运行数据存放目录~/run用于存放计算所需或者访问频次较高的数据读写性能较好请将计算时需要使用的数据存储到该目录下并在此目录进行计算 参考 北京超算云计算平台深度学习环境配置Linux必备技能轻松编辑bashrc配置文件配置开机自启命令文件~/.bashrc、/etc/profile、/etc/bash.bashrc的异同bashrcBash Run Commands环境变量、~/.bash_profile 3.3 创建分支 # fetch把upstream上最新的所有内容都拉到本地 # 但是注意需要保证本地没有什么冲突,当前处在任意分支都没问题 git fetch upstream然后就可以基于远程最新的dev-1.x来创建自己的开发分支了 git checkout -b SupportInverseFormLoss upstream/dev-1.x3.4 执行官方repo的推理 根据https://github.com/Qualcomm-AI-research/InverseForm 参考 Nvidia Apex简介 3.5 自己写代码 主要参考的两个已有的loss是 https://github.com/open-mmlab/mmsegmentation/blob/main/mmseg/models/losses/tversky_loss.pyhttps://github.com/open-mmlab/mmsegmentation/blob/main/mmseg/models/losses/cross_entropy_loss.py 1. 网络作为损失函数 Pytorch-DCGAN TUTORIALhttps://www.run.ai/guides/deep-learning-for-computer-vision/pytorch-gan对抗神经网络二——DCGAN 2. XXX.cuda() Using CUDA with pytorch?How to run PyTorch on GPU by default? 3. XX_loss类的参数与config文件的对应关系 如下例子所示损失函数的参数就是config文件中部分的参数 class CrossEntropyLoss(nn.Module):def __init__(self,use_sigmoidFalse,use_maskFalse,reductionmean,class_weightNone,loss_weight1.0,loss_nameloss_ce,avg_non_ignoreFalse):loss_decodedict( # Config of loss function for the decode_head.typeCrossEntropyLoss, # Type of loss used for segmentation.use_sigmoidFalse, # Whether use sigmoid activation for segmentation.loss_weight1.0)), # Loss weight of decode_head.mmsegmentation/mmseg/models/losses/cross_entropy_loss.pyhttps://mmsegmentation.readthedocs.io/en/latest/user_guides/1_config.html 4. 函数的一些默认值设置 这里用的是Cityscapes数据集所以基本都是针对这个数据集进行的设置https://github.com/Qualcomm-AI-research/InverseForm/blob/main/utils/config.py#L223 5. upper_bound参数 boundarylossBoundary loss for highly unbalanced segmentation 『paddle』paddleseg 学习笔记损失函数 PaddleSeg/paddleseg/models/losses/decoupledsegnet_relax_boundary_loss.pyOHEM: Training Region-based Object Detectors with Online Hard Example Mininghttps://mmsegmentation.readthedocs.io/en/latest/advanced_guides/training_tricks.html#online-hard-example-mining-ohem manager.LOSSES.add_component class RelaxBoundaryLoss(nn.Layer):Implements the ohem cross entropy loss function.Args:border (int, optional): The value of border to relax. Default: 1.calculate_weights (bool, optional): Whether to calculate weights for every classes. Default: False.upper_bound (float, optional): The upper bound of weights if calculating weights for every classes. Default: 1.0.ignore_index (int64): Specifies a target value that is ignoredand does not contribute to the input gradient. Default: 255.def __init__(self,border1,calculate_weightsFalse,upper_bound1.0,ignore_index255):super(RelaxBoundaryLoss, self).__init__()self.border borderself.calculate_weights calculate_weightsself.upper_bound upper_boundself.ignore_index ignore_indexself.EPS 1e-5def calculate_weights(self, label):hist paddle.sum(label, axis(1, 2)) * 1.0 / label.sum()hist ((hist ! 0) * self.upper_bound * (1 - hist)) 16. torch.where() https://pytorch.org/docs/stable/generated/torch.where.html torch.where(edge.max(1)[0] 0.8, target, filler) x torch.randn(3, 2)y torch.ones(3, 2)x tensor([[-0.4620, 0.3139],[ 0.3898, -0.7197],[ 0.0478, -0.1657]])torch.where(x 0, 1.0, 0.0) tensor([[0., 1.],[1., 0.],[1., 0.]])torch.where(x 0, x, y) # 满足条件的就用x的值不满足的就用y的值 tensor([[ 1.0000, 0.3139],[ 0.3898, 1.0000],[ 0.0478, 1.0000]])7. 预测的分割边界图来源- b p r e d b_{pred} bpred​来源 论文中提到 我们工作的主要不同点在于推理时候不会引入额外开销下面这个框架图已经很明显了说明问题了 推理的时候关闭那个Boundary head只使用上面的Segmentation head只生成 y p r e d y_pred yp​red就可以训练的时候才会使用Boundary head来生成 b p r e d b_{pred} bpred​ 所以想要使用这个InverseFormLoss是需要修改网络结构的 8. 如何把InverseForm插入现有网络 https://github.com/Qualcomm-AI-research/InverseForm/blob/main/models/ocrnet.pyhttps://github.com/NVIDIA/semantic-segmentation/blob/main/network/ocrnet.py HRnetOCR https://arxiv.org/abs/1904.04514https://github.com/HRNet/HRNet-Semantic-Segmentation/pullshttps://github.com/open-mmlab/mmsegmentation/tree/main/configs/ocrnethttps://github.com/open-mmlab/mmsegmentation/tree/main/configs/hrnet 9. 单元测试 https://github.com/open-mmlab/mmsegmentation/tree/main/tests/test_models/test_losses 10. 实现多头 mmpretrain-issue: multi task 多任务训练[Feature] #481https://mmsegmentation.readthedocs.io/zh_CN/latest/advanced_guides/add_models.html#headhttps://github.com/open-mmlab/mmsegmentation/blob/main/mmseg/models/decode_heads/ocr_head.pyhttps://github.com/Qualcomm-AI-research/InverseForm/blob/main/models/ocrnet.py 11. bce2d和boundary_loss https://github.com/Qualcomm-AI-research/InverseForm/blob/main/models/loss/utils.py#L123C11-L123C11其实和这个是一样的 https://github.com/CastleDream/mmsegmentation/blob/main/mmseg/models/losses/boundary_loss.py参考自PIDNet https://github.com/XuJiacong/PIDNet/blob/main/utils/criterion.py#L122 有些写法上的区别(重点关注continuous的问题) PyTorch 两大转置函数 transpose() 和 permute(), 以及RuntimeError: invalid argument 2: view size is not compatiDifferent between permute, transpose, view? Which should I use?TORCH.TENSOR.VIEW 12. ImageBasedCrossEntropyLoss2d semantic-segmentation/loss/utils.py直接用的NVIDIA的这里的实现也是页面搜索ImageBasedCrossEntropyLoss2dhttps://gitee.com/mindspore/mindspore/issues/I55C9U页面内搜索class ImageBasedCrossEntropyLoss2d, 这个实现和这个github的repo是一样的https://github.com/lxtGH/SFSegNets/blob/master/loss.py 3.6 报错 ImportError: cannot import name ‘InverseFormLoss’ from ‘mmseg.models.losses’ Traceback (most recent call last):File ../tests/test_models/test_losses/test_inverseform_loss.py, line 9, in modulefrom mmseg.models.losses import InverseFormLoss ImportError: cannot import name InverseFormLoss from mmseg.models.losses (mmsegmentation/mmseg/models/losses/__init__.py)这是因为默认from mmseg.models.losses import InverseFormLoss这句其实是引用的当前python环境中已经安装的mmsegmation其实是旧的是之前安装的版本不是你自己改动过的版本。因此可以卸载这个版本pip uninstall mmsegmentation。然后把自己当前的这个mmsegmentation的文件夹的路径添加到python的系统路径中具体如下import sys sys.path.append(yourDir/mmsegmentation) # 一定要确定是把这个目录添加到系统目录之后再去import刚刚ImportError的内容 # 或者你可以直接把这个路径写到python的系统路径中上面这种方式只是运行时生效 from mmseg.models.losses import InverseFormLoss我用的 import sys sys.path.append(/Users/huangshan/Documents/DailyStudy/mmsegmentation) print(sys.path)if __name__ __main__:test_inverseform_loss()3.7 RuntimeError: Attempting to deserialize object on a CUDA device but torch.cuda.is_available() is False. If you are running on a CPU-only machine, please use torch.load with map_locationtorch.device(‘cpu’) to map your storages to the CPU. 根据pytest.raises Failed: DID NOT RAISE with try/except只需要在模型加载的时候torch.load(path, map_locationcpu)用map_location指明是cpu就行 3.8 pytest.raises Failed: DID NOT RAISE with try/except # Test loss forward with pred.shape!target.shapepred_wrong torch.zeros(2, 1, 4, 4)target_wrong torch.zeros(3, 1, 4, 4)with pytest.raises(AssertionError):loss loss_class(pred_wrong, target_wrong)print(loss)这个pytest.raises(AssertionError)本身就是判断如果错了会不会报错出来所以with里面是可以抛出错误的代码 3.9 构建文档报错 https://docs.readthedocs.io/en/stable/config-file/v2.html#build-os 提交PR在测试的时候第一次遇到构建文档报错。。。 这次写注释的时候唯一的一个异常就是某行超过72个字符的时候把and换成了然后就出现了上面这个错误。。 改了之后就没有了。 但是没有找到相关的资料不确定真的是因为这个符号还是说可能刚刚测试环境坏了
http://www.zqtcl.cn/news/32489/

相关文章:

  • 定制网站建设电话WordPress开发微信支付
  • 众筹网站建设在线高清观看免费ppt
  • 网站建设网络科技公司加盟中国十大公司排行榜
  • 网页转向功能网站如何做网站链接使用
  • 杭州自适应网站建设网页设计软件vscode
  • 湖北微网站建设报价换服务器后网站首页不收录
  • 学习网站导航公司网页免费制作
  • 怎么做网站旅游宣传商城网站开发文档
  • 网站赚钱思路网站seo与网站没关
  • 做网站公司天津淘宝联盟网站推广位怎么做
  • 网站空间可以自己做吗东莞网上推广教程
  • 鹰潭做网站公司昆明中小企业网站建设
  • 竞价推广怎样管理聊城宏远网站建设优化
  • 爱站网关键词查询网站c 做网站加载多个图片
  • ftp怎么重新上传网站龙岩seo
  • 推广电子商务网站的案例企业网站建设的要求
  • 网站会员发展计划网站建设方案服务器
  • 高端网站制作网站设计典型的o2o平台有哪些
  • 智能做网站网站建设条件
  • 转运公司网站建设南平市建设局网站
  • 网站空间备案广州网站建设的地方推荐
  • 惠州住房和建设局网站百度首页纯净版
  • 建设网站报价单网店货源一件代发货
  • wordpress网站如何app网易邮箱账号注册
  • 网站维护提示怎么做坂田杨美企业网站建设
  • 翻译公司网站建设多少钱高端网站建设推广
  • 一个公司的网站怎么做湖南seo优化报价
  • dedecms手机网站制作南昌做网站排名
  • 海珠免费网站建设名聚优品 一家只做正品的网站
  • 微网站什么意思自己做的网站访问速度慢