OpenMMLab MMDetectionV3.1.0-SAM(环境安装、模型测试、训练以及模型后处理工具)
OpenMMLab Playground
概况
当前通用目标检测的研究方向正在朝着大型多模态模型发展。除了图像输入之外,最近的研究成果还结合了文本模式来提高性能。添加文本模态后,通用检测算法的一些非常好的属性开始出现,例如:
可以利用大量易于访问的文本数据进行联合训练。
轻松实现开放集目标检测,从而实现真正通用的检测任务。
可以与 NLP 中的优秀模型一起使用来创建一些有趣且有用的功能。
从目前来看,通用物体检测可以分为两大类:
(1)闭集目标检测,只能检测训练集中出现的固定数量类别的目标
(2)开放集目标检测,还可以检测不在训练集中的对象和类别
随着多模态算法的流行,开放集目标检测成为一个新的研究领域,其中有三个热门方向:
(1)零样本目标检测(Zero-Shot Object Detection),也称为零样本目标检测,强调测试集中的目标类别不在训练集中。
(2)开放词汇对象检测(Open-Vocabulary Object Detection),检测目标图像中出现的具有给定类别列表的所有对象。
(3)接地对象检测(Grounding Object Detection),通过目标图像中出现的给定文本描述来预测对象的位置。
这三个方向在实践中并不能完全区分,只是一般意义上的不同。基于以上描述,我们提供了多种模型的推理和评估脚本,与Segment Anything配合使用,实现了以下功能:
(1)支持 MMDet 中经典的 Closed-Set 对象检测模型,与 SAM 模型配合使用,以进行自动检测和实例分割,例如 Faster R-CNN 和 DINO。
(2)支持 Open-Vocabulary 检测模型(如 Detic)与 SAM 模型配合使用,以进行自动检测和实例分割。
(3)支持 Grounding 物体检测模型与 SAM 模型配合使用,进行自动检测和实例分割,例如 Grounding DINO 和 GLIP。
(4)支持跨所有模型的分布式检测和分段评估以及自动 COCO JSON 导出,以实现用户友好的自定义数据评估。
File Introduction(代码介绍)
(1)detector_sam_demo.py:用于对单个图像和图像文件夹进行检测和实例分割。
(2)coco_style_eval.py:用于对给定的 COCO JSON 进行推理、评估和导出。
(3)browse_coco_json.py:用于可视化导出的 COCO JSON。
(4)images2coco.py:用于基于用户自己的图像文件夹的自定义和未注释的 COCO 风格 JSON。此 JSON 可以用作coco_style_eval.py.
环境搭建
conda create -n mmdetsam python=3.8 -y
conda activate mmdetsampip install torch==1.9.1+cu111 torchvision==0.10.1+cu111 -f https://download.pytorch.org/whl/torch_stable.htmlpip install torch==1.9.1+cu102 torchvision==0.10.1+cu102 torchaudio===0.9.1 -f https://download.pytorch.org/whl/torch_stable.html -i http://mirrors.aliyun.com/pypi/simple/ --trusted-host mirrors.aliyun.com# CUDA 10.2
conda install pytorch==1.9.1 torchvision==0.10.1 torchaudio==0.9.1 cudatoolkit=10.2 -c pytorchpip3 install torch==1.8.2+cu102 torchvision==0.9.2+cu102 torchaudio===0.8.2 -f https://download.pytorch.org/whl/lts/1.8/torch_lts.html -i http://mirrors.aliyun.com/pypi/simple/ --trusted-host mirrors.aliyun.compip install torch==1.10.0+cu102 torchvision==0.11.0+cu102 torchaudio==0.10.0 -f https://download.pytorch.org/whl/torch_stable.html
mport torchif torch.cuda.is_available():print("GPU 可用")
else:print("GPU 不可用")
pip install mmengine -i http://mirrors.aliyun.com/pypi/simple/ --trusted-host mirrors.aliyun.comgit clone https://github.com/open-mmlab/playground.git
cd playground
功能介绍
该项目包含了许多优秀的开源算法,以减轻环境安装的负担。如果您不想使用某部分功能,可以跳过相应部分。我们的项目可以分为以下三个部分。
1 开放词汇+SAM(Open-Vocabulary + SAM)
将开放词汇目标检测器与 SAM 模型结合使用。目前我们支持 Detic。
依赖安装
pip install -U openmim -i http://mirrors.aliyun.com/pypi/simple/ --trusted-host mirrors.aliyun.com
mim install "mmcv>=2.0.0" -i http://mirrors.aliyun.com/pypi/simple/ --trusted-host mirrors.aliyun.com# build from source
git clone https://github.com/open-mmlab/mmdetection.git
cd mmdetection;
pip install -e .; cd ..pip install git+https://github.com/facebookresearch/segment-anything.git
pip install git+https://github.com/openai/CLIP.git
验证mmdetection安装成功
python demo/image_demo.py demo/demo.jpg rtmdet_tiny_8xb32-300e_coco.py --weights rtmdet_tiny_8xb32-300e_coco_20220902_112414-78e30dcc.pth --device cpu
Demonstration
cd mmdet_sam# download weights
mkdir ../models
wget -P ../models/ https://download.openmmlab.com/mmdetection/v3.0/detic/detic_centernet2_swin-b_fpn_4x_lvis-coco-in21k/detic_centernet2_swin-b_fpn_4x_lvis-coco-in21k_20230120-0d301978.pth
wget -P ../models/ https://dl.fbaipublicfiles.com/segment_anything/sam_vit_h_4b8939.pth####input a single image
python detector_sam_demo.py ../images/cat_remote.jpg \configs/Detic_LI21k_CLIP_SwinB_896b32_4x_ft4x_max-size.py \../models/detic_centernet2_swin-b_fpn_4x_lvis-coco-in21k_20230120-0d301978.pth \-t cat \--sam-device cpu
python detector_sam_demo.py ../images/cat_remote.jpg configs/Detic_LI21k_CLIP_SwinB_896b32_4x_ft4x_max-size.py ../models/detic_centernet2_swin-b_fpn_4x_lvis-coco-in21k_20230120-0d301978.pth -t cat
我们还可以通过编辑–test-prompt来检测遥控器。请注意,您必须使用空白区域并.分隔不同的类别。
# input a single image
python detector_sam_demo.py ../images/cat_remote.jpg \configs/Detic_LI21k_CLIP_SwinB_896b32_4x_ft4x_max-size.py \../models/detic_centernet2_swin-b_fpn_4x_lvis-coco-in21k_20230120-0d301978.pth \-t "cat . remote" \--sam-device cpu
python detector_sam_demo.py ../images/cat_remote.jpg configs/Detic_LI21k_CLIP_SwinB_896b32_4x_ft4x_max-size.py ../models/detic_centernet2_swin-b_fpn_4x_lvis-coco-in21k_20230120-0d301978.pth -t "cat . remote" --sam-device cpu
python detector_sam_demo.py ../images/hengxuhe-20190411___1920___1920_24.jpg configs/Detic_LI21k_CLIP_SwinB_896b32_4x_ft4x_max-size.py ../models/detic_centernet2_swin-b_fpn_4x_lvis-coco-in21k_20230120-0d301978.pth -t ship
您还可以使用以下命令对文件夹运行推理:
# input a folder
python detector_sam_demo.py ../images configs/Detic_LI21k_CLIP_SwinB_896b32_4x_ft4x_max-size.py ../models/detic_centernet2_swin-b_fpn_4x_lvis-coco-in21k_20230120-0d301978.pth -t "cat . remote" --sam-device cpu
如果您的 GPU 的显存只能支持运行一种模型,您可以使用以下方法–cpu-off-load来确保每次 GPU 上都只运行一种模型:
# input a folder
python detector_sam_demo.py ../images \configs/Detic_LI21k_CLIP_SwinB_896b32_4x_ft4x_max-size.py \../models/detic_centernet2_swin-b_fpn_4x_lvis-coco-in21k_20230120-0d301978.pth \-t "cat . remote" \--cpu-off-load
我们还通过使用支持 CPU 推理–det-device cpu 。
由于 Detic 包含掩模结果,因此我们添加了一个附加参数–use-detic-mask。这允许我们只运行 Detic,而不运行 SAM 模型。
# input a folder
python detector_sam_demo.py ../images \configs/Detic_LI21k_CLIP_SwinB_896b32_4x_ft4x_max-size.py \../models/detic_centernet2_swin-b_fpn_4x_lvis-coco-in21k_20230120-0d301978.pth \-t "cat . remote" \--det-device cpu \--use-detic-mask
# input a folder
python detector_sam_demo.py ../images configs/Detic_LI21k_CLIP_SwinB_896b32_4x_ft4x_max-size.py ../models/detic_centernet2_swin-b_fpn_4x_lvis-coco-in21k_20230120-0d301978.pth -t "cat . remote" --det-device cpu --use-detic-mask
如果您只想可视化结果,可以使用 set–only-det来运行而不使用 SAM 模型。
# input a sinle image
python detector_sam_demo.py ../images/cat_remote.jpg \configs/Detic_LI21k_CLIP_SwinB_896b32_4x_ft4x_max-size.py \../models/detic_centernet2_swin-b_fpn_4x_lvis-coco-in21k_20230120-0d301978.pth \-t "cat" \--only-det
2 MMdet models + SAM
将 MMDet 模型与 SAM 模型结合使用来执行实例分割任务。目前支持所有 MMDet 模型。
依赖安装
pip install -U openmim
mim install "mmcv>=2.0.0"# build from source(安装的是v3.1.0)
git clone https://github.com/open-mmlab/mmdetection.git
cd mmdetection; pip install -e .; cd ..
Demonstration
您可以运行我们在上面的 Detic 部分中介绍的所有功能。唯一的区别是您不需要设置–text-prompt。这里我们演示一些经典用法。
Faster R-CNN models
cd mmdet_sammkdir ../models
wget -P ../models/ https://download.openmmlab.com/mmdetection/v2.0/faster_rcnn/faster_rcnn_r50_fpn_2x_coco/faster_rcnn_r50_fpn_2x_coco_bbox_mAP-0.384_20200504_210434-a5d8aa15.pth# input a single image
python detector_sam_demo.py ../images/cat_remote.jpg \../mmdetection/configs/faster_rcnn/faster-rcnn_r50_fpn_2x_coco.py \../models/faster_rcnn_r50_fpn_2x_coco_bbox_mAP-0.384_20200504_210434-a5d8aa15.pth \--sam-device cpu
python detector_sam_demo.py ../images/cat_remote.jpg ../mmdetection/configs/faster_rcnn/faster-rcnn_r50_fpn_2x_coco.py ../models/faster_rcnn_r50_fpn_2x_coco_bbox_mAP-0.384_20200504_210434-a5d8aa15.pth --sam-device cpu
运行结果:目前看来先检测后分割会存在分割目标不全的问题。
DINO models
cd mmdet_sammkdir ../models
wget -P ../models/ https://download.openmmlab.com/mmdetection/v3.0/dino/dino-5scale_swin-l_8xb2-12e_coco/dino-5scale_swin-l_8xb2-12e_coco_20230228_072924-a654145f.pth# input a single image
python detector_sam_demo.py ../images/cat_remote.jpg \../mmdetection/configs/dino/dino-5scale_swin-l_8xb2-12e_coco.py \dino-5scale_swin-l_8xb2-12e_coco_20230228_072924-a654145f.pth \--sam-device cpu
python detector_sam_demo.py ../images/cat_remote.jpg ../mmdetection/configs/dino/dino-5scale_swin-l_8xb2-12e_coco.py ../models/dino-5scale_swin-l_8xb2-12e_coco_20230228_072924-a654145f.pth --sam-device cpu
3 Grounding models + SAM
将接地物体检测器与 SAM 模型结合使用来执行实例分割任务。目前我们支持 Grounding DINO 和 GLIP。
依赖安装
Grounding DINO:
cd playground
pip install git+https://github.com/facebookresearch/segment-anything.git
pip install git+https://github.com/IDEA-Research/GroundingDINO.git -i http://mirrors.aliyun.com/pypi/simple/ --trusted-host mirrors.aliyun.com
# Please make sure your PyTorch, GCC and NVCC are all compatible to build CUDA ops successfully
GLIP:
cd playgroundpip install git+https://github.com/facebookresearch/segment-anything.git
pip install einops shapely timm yacs tensorboardX ftfy prettytable pymongo transformers nltk inflect scipy pycocotools opencv-python matplotlibgit clone https://github.com/microsoft/GLIP.git
cd GLIP;
python setup.py build develop --user # Please make sure your PyTorch, GCC and NVCC are all compatible to build CUDA ops successfully
Demonstration
不过,用法与 Detic 部分相同,我们在这里仅演示部分功能。
cd mmdet_sammkdir ../models
wget -P ../models/ https://github.com/IDEA-Research/GroundingDINO/releases/download/v0.1.0-alpha/groundingdino_swint_ogc.pth# input a single image
python detector_sam_demo.py ../images/cat_remote.jpg \configs/GroundingDINO_SwinT_OGC.py \../models/groundingdino_swint_ogc.pth \-t "cat . remote" \--sam-device cpu
python detector_sam_demo.py ../images/cat_remote.jpg configs/GroundingDINO_SwinT_OGC.py ../models/groundingdino_swint_ogc.pth -t "cat . remote" --sam-device cpu
结果将outputs/cat_remote.jpg如下生成:
cd mmdet_sammkdir ../models
wget -P ../models/ https://penzhanwu2bbs.blob.core.windows.net/data/GLIPv1_Open/models/glip_a_tiny_o365.pth# input a single image
python detector_sam_demo.py ../images/cat_remote.jpg \configs/glip_A_Swin_T_O365.yaml \../models/glip_a_tiny_o365.pth \-t "cat . remote" \--sam-device cpu
python detector_sam_demo.py ../images/cat_remote.jpg configs/glip_A_Swin_T_O365.yaml ../models/glip_a_tiny_o365.pth -t "cat . remote" --sam-device cpu
4 COCO JSON评估
我们支持coco_style_eval.py分布式和非分布式方式运行。默认情况下,该脚本在按如下格式组织的 COCO Val2017 数据集上运行:
├── ${COCO_DATA_ROOT}
│ ├── annotations
│ ├──── instances_val2017.json
│ ├── val2017
cd mmdet_sam# non-distributed
python coco_style_eval.py ${COCO_DATA_ROOT} \configs/Detic_LI21k_CLIP_SwinB_896b32_4x_ft4x_max-size.py \../models/detic_centernet2_swin-b_fpn_4x_lvis-coco-in21k_20230120-0d301978.pth \-t coco_cls_name.txt# distributed on eight cards on one machine
bash ./dist_coco_style_eval.sh 8 ${COCO_DATA_ROOT} \configs/Detic_LI21k_CLIP_SwinB_896b32_4x_ft4x_max-size.py \../models/detic_centernet2_swin-b_fpn_4x_lvis-coco-in21k_20230120-0d301978.pth \-t coco_cls_name.txt
6 Custom dataset
Data prepare
使用以下命令下载 cat 数据集:
cd playgroundwget https://download.openmmlab.com/mmyolo/data/cat_dataset.zip
mkdir data
unzip cat_dataset.zip -d data/cat
rm cat_dataset.zip
Note:,Need to replace 1 cat with cat in cat/class_with_id.txt
使用images2coco.py脚本生成无标签的json文件:
cd mmdet_sam
python images2coco.py ../data/cat/images ../data/cat/class_with_id.txt cat_coco.json
推理
这里我们以GroundingDINO和SAM模型为例进行推理,得到预测json文件:
python coco_style_eval.py ../data/cat/ \configs/GroundingDINO_SwinT_OGC.py \../models/groundingdino_swint_ogc.pth \-t ../data/cat/class_with_id.txt \--data-prefix images \--ann-file annotations/cat_coco.json \--out-dir ../cat_pred \--sam-device cpu
MMRotate-SAM概况
在这里插入图片描述
我们提供了一套基于MMRotate和SAM的应用程序。其特点包括:
在这里插入图片描述
支持使用 SAM 进行零样本目标检测。
在单个图像上执行基于 SAM 的零样本面向对象检测推理。
eval_zero-shot-oriented-detection_dota.py使用 SAM 实施面向零样本的目标检测。它向 SAM 提示来自水平物体检测器的预测框。
demo_zero-shot-oriented-detection.py使用 SAM 进行零样本定向物体检测的推理单图像。
data_builder保存数据集、数据加载器的配置信息和进程。
pip install opencv-python pycocotools matplotlib onnxruntime onnx -i http://mirrors.aliyun.com/pypi/simple/ --trusted-host mirrors.aliyun.com
您还可以选择从源代码安装MMRotate
git clone https://github.com/open-mmlab/mmrotate.git
cd mmrotate; pip install -e .; cd ..
用法
用单张图像推理MMRotate-SAM并获得可视化结果。
# download weights
cd mmrotate_sammkdir ../models
wget -P ../models https://dl.fbaipublicfiles.com/segment_anything/sam_vit_b_01ec64.pth
wget -P ../models https://download.openmmlab.com/mmrotate/v0.1.0/rotated_fcos/rotated_fcos_sep_angle_r50_fpn_1x_dota_le90/rotated_fcos_sep_angle_r50_fpn_1x_dota_le90-0be71a0c.pth# demo
python demo_zero-shot-oriented-detection.py \../mmrotate/data/split_ss_dota/test/images/P0006__1024__0___0.png \../mmrotate/configs/rotated_fcos/rotated-fcos-hbox-le90_r50_fpn_1x_dota.py \../models/rotated_fcos_sep_angle_r50_fpn_1x_dota_le90-0be71a0c.pth \--sam-type "vit_b" --sam-weight ../models/sam_vit_b_01ec64.pth --out-path output.png
在这里插入图片描述
评估DOTA数据集上的定量评价指标。
python eval_zero-shot-oriented-detection_dota.py \../mmrotate/configs/rotated_fcos/rotated-fcos-hbox-le90_r50_fpn_1x_dota.py \../models/rotated_fcos_sep_angle_r50_fpn_1x_dota_le90-0be71a0c.pth \--sam-type "vit_b" --sam-weight ../models/sam_vit_b_01ec64.pth
Open-Tracking概况
我们提供了一种基于开放对象检测并利用运动信息(卡尔曼滤波器)进行多对象跟踪的方法。
借助开放对象检测和利用运动信息(卡尔曼滤波器),可以执行多对象跟踪。由于时间限制,目前仅支持GroundingDINO、GLIP、Detic结合ByteTrack进行追踪。
参数说明
tracking_demo.py:用于视频或图像文件夹上的多对象跟踪推理。
基础开发环境设置
pip install -U openmim
mim install "mmcv>=2.0.0"# build from source
cd playground
git clone -b tracking https://github.com/open-mmlab/mmdetection.git
cd mmdetection; pip install -e .; cd ..
pip install lap seaborn
Grounding Dino Dependencies Installation
cd playground
pip install git+https://github.com/IDEA-Research/GroundingDINO.git
如果由于网络原因无法使用pip下载,可以选择以下方法代替。
git clone git+https://github.com/IDEA-Research/GroundingDINO.git
cd GroundingDINO
python setup.py install
GLIP 依赖项安装
cd playground
pip install einops shapely timm yacs tensorboardX ftfy prettytable pymongo transformers nltk inflect scipy pycocotools opencv-python matplotlibgit clone https://github.com/microsoft/GLIP.git
cd GLIP; python setup.py build develop --user; cd ..
SAM Dependencies Installation
pip install git+https://github.com/facebookresearch/segment-anything.git
If you can’t use pip to download due to network reasons, you can choose the following method instead.
git clone git+https://github.com/facebookresearch/segment-anything.git
cd segment-anything
python setup.py install
获取演示视频和图片
cd playground
wget https://download.openmmlab.com/playground/mmtracking/tracking_demo.zip
unzip tracking_demo.zip
下载权重
mkdir ../models
wget -P ../models/ https://download.openmmlab.com/mmdetection/v3.0/detic/detic_centernet2_swin-b_fpn_4x_lvis-coco-in21k/detic_centernet2_swin-b_fpn_4x_lvis-coco-in21k_20230120-0d301978.pth
wget -P ../models/ https://dl.fbaipublicfiles.com/segment_anything/sam_vit_h_4b8939.pth
wget -P ../models/ https://penzhanwu2bbs.blob.core.windows.net/data/GLIPv1_Open/models/glip_a_tiny_o365.pth
wget -P ../models/ https://github.com/IDEA-Research/GroundingDINO/releases/download/v0.1.0-alpha2/groundingdino_swinb_cogcoor.pth
模型推理演示
仅使用 GroundingDINO 作为示例。
MOT
cd mmtracking_open_detection# input a video
python tracking_demo.py "../tracking_demo/mot_challenge_track.mp4" "configs/GroundingDINO_SwinB.cfg.py" "../models/groundingdino_swinb_cogcoor.pth" --text-prompt "person . rider . car . truck . bus . train . motorcycle . bicycle ." --out-dir "outputs/mot_challenge" --init_track_thr 0.35 --obj_score_thrs_high 0.3# input a images folder
python tracking_demo.py "../tracking_demo/bdd_val_track" "configs/GroundingDINO_SwinB.cfg.py" "../models/groundingdino_swinb_cogcoor.pth" --text-prompt "person . rider . car . truck . bus . train . motorcycle . bicycle ." --out-dir "outputs/bdd100k" --fps 30
MOTS
cd mmtracking_open_detection# input a images folder
python tracking_demo.py "../tracking_demo/bdd_val_track" "configs/GroundingDINO_SwinB.cfg.py" "../models/groundingdino_swinb_cogcoor.pth" --text-prompt "person . rider . car . truck . bus . train . motorcycle . bicycle ." --out-dir "outputs/bdd100k" --fps 30 --mots
MMagic-SAM概述
我们提供了一套基于MMEditing和SAM的应用程序。其特点包括:
使用 MMEditing 界面生成图像。
将 SAM 生成的蒙版与 MMEditing 的图像编辑功能相结合,创建新图片。
# create env and install torch
conda create -n mmedit-sam python=3.8 -y
conda activate mmedit-sam
pip install torch==1.12.1+cu113 torchvision==0.13.1+cu113 --extra-index-url https://download.pytorch.org/whl/cu113# install mmagic
pip install openmim
mim install mmengine "mmcv>=2.0.0"
git clone -b dev-1.x https://github.com/open-mmlab/mmagic.git
pip install -e ./mmagic# install sam
pip install git+https://github.com/facebookresearch/segment-anything.git# you may need ffmpeg to get frames or make video
sudo apt install ffmpeg
使用 SAM 播放 controlnet 动画
找到您要编辑的视频剪辑并获取帧
mkdir -p inputs/demo_video
ffmpeg -i your_video.mp4 inputs/demo_video/%04d.jpg
运行脚本。
python play_controlnet_animation_sam.py
使用输出帧制作视频。
ffmpeg -r 10 -i results/final_frames/%04d.jpg -b:v 30M -vf fps=10 results/final_frames.mp4
我们通过以下步骤得到最终的视频:
(1)将输入视频分割成帧
(2)通过MMagic的推理API调用controlnet动画模型修改视频的每一帧,使其成为AI动画
(3)使用MMagic中的稳定扩散生成符合动画内容语义的背景图像
(4)使用SAM预测动画中人物的面具
(5)将动画中的背景替换为我们生成的背景图片
MMOCR-SAM概述
该项目是从OCR-SAM迁移而来的,它结合了 MMOCR 和 Segment Anything。我们提供了一套基于MMOCR和SAM的应用程序。其特点包括:
支持端到端文本检测和识别,能够分割每个文本字符。
由扩散模型和 Gradio 驱动的引人注目的文本删除和文本修复 WebUI 演示。
安装
conda create -n ocr-sam python=3.8 -y
conda activate ocr-sam
pip install torch==1.12.1+cu113 torchvision==0.13.1+cu113 --extra-index-url https://download.pytorch.org/whl/cu113pip install -U openmim
mim install mmengine
mim install mmocr
mim install 'mmcv==2.0.0rc4'
mim install 'mmdet==3.0.0rc5'
mim install 'mmcls==1.0.0rc5'pip install git+https://github.com/facebookresearch/segment-anything.git
pip install -r requirements.txtpip install gradio
pip install diffusers
pip install pytorch-lightning==2.0.1.post0
下载检查点
我们以 Swin Transformer V2 作为骨干,结合多个场景文本数据集(例如 HierText、TextOCR)重新训练 DBNet++。Google Drive (1G)上的 DBNet++ 检查点。
mkdir checkpoints
mkdir checkpoints/mmocr
mkdir checkpoints/sam
mkdir checkpoints/ldm
mv db_swin_mix_pretrain.pth checkpoints/mmocr
将其余检查点下载到相关路径(如果已完成,请忽略以下内容):
# mmocr recognizer ckpt
wget -O checkpoints/mmocr/abinet_20e_st-an_mj_20221005_012617-ead8c139.pth https://download.openmmlab.com/mmocr/textrecog/abinet/abinet_20e_st-an_mj/abinet_20e_st-an_mj_20221005_012617-ead8c139.pth# sam ckpt, more details: https://github.com/facebookresearch/segment-anything#model-checkpoints
wget -O checkpoints/sam/sam_vit_h_4b8939.pth https://dl.fbaipublicfiles.com/segment_anything/sam_vit_h_4b8939.pth# ldm ckpt
wget -O checkpoints/ldm/last.ckpt https://heibox.uni-heidelberg.de/f/4d9ac7ea40c64582b7c9/?dl=1
相关文章:
![](https://img-blog.csdnimg.cn/dc3ef45a3e5a4b09a98f8328c765ec8b.png)
OpenMMLab MMDetectionV3.1.0-SAM(环境安装、模型测试、训练以及模型后处理工具)
OpenMMLab Playground 概况 当前通用目标检测的研究方向正在朝着大型多模态模型发展。除了图像输入之外,最近的研究成果还结合了文本模式来提高性能。添加文本模态后,通用检测算法的一些非常好的属性开始出现,例如: 可以利用大量…...
![](https://img-blog.csdnimg.cn/a9373228c4f647798c5e364935cee3a8.png)
ios_base::out和ios::out、ios_base::in和ios::in、ios_base::app和ios::app等之间有什么区别吗?
2023年8月2日,周三晚上 今天我看到了这样的两行代码: std::ofstream file("example.txt", std::ios_base::out);std::ofstream file("example.txt", std::ios::out);这让我产生了几个疑问: 为什么有时候用ios_base::o…...
![](https://www.ngui.cc/images/no-images.jpg)
PostgreSQL 使用SQL
发布主题 设置发布为true 这个语句是针对 PostgreSQL 数据库中的逻辑复制功能中的逻辑发布(Logical Publication)进行设置的。 PostgreSQL 中,逻辑复制是一种基于逻辑日志的复制方法,允许将数据更改从一个数据库实例复制到另一…...
![](https://www.ngui.cc/images/no-images.jpg)
Shell编程基础(十四)文本三剑客(grep)
文本三剑客(grep) 使用场景基本使用返回值参数 使用场景 主要用于查找,过滤文本数据;该数据可以来自文件,也可以来自管道流等等。 grep除了原有的实现,后来还出现了以下扩展实现 egrep:支持扩展…...
![](https://img-blog.csdnimg.cn/95325321e56b48f09f669e7328146538.png)
Linux root用户执行修改密码命令,提示 Permission denied
问题 linux系统中(ubuntu20),root用户下执行passwd命令,提示 passwd: Permission denied ,如下图: 排查 1.执行 ll /usr/bin/passwd ,查看文件权限是否正确,正常情况是 -rwsr-xr…...
![](https://img-blog.csdnimg.cn/eacafa161a0c4ef7af192c653c8416db.png)
Java面向对象学习第三部分
一、Static修饰符 static是静态的意思,基本概念如下: Static分类: 一般我们分类都是按照是否使用static修饰进行分类。分为静态变量(类变量)、实例变量。 静态变量和实例变量的比较: 比较,…...
![](https://img-blog.csdnimg.cn/eba6a102a2654811a6f8d3260b88d0e4.png)
python+vue生成条形码码并展示
需求 最近想做一个小工具,大概要实现这样的效果:后端生成条形码后,不保存到服务器,直接返回给前端展示。 大概思路是,通过 python-barcode库 生成条码的字节流,生成字节流后直接编码成base64格式返回给前…...
![](https://img-blog.csdnimg.cn/img_convert/20a0f2a197eea336efacdf9ffff49cd6.png)
在线高精地图生成算法调研
1.HDMapNet 整体的网络架构如图所示,最终的Decoder输出三个分支,一个语义分割,一个embedding嵌入分支,一个方向预测。然后通过后处理将这些信息处理成向量化的道路表示。 img2bev的方式之前有IPM,通过假设地面的高度都…...
![](https://img-blog.csdnimg.cn/8eea622ef0054d7db93d7b52bc1e716e.png)
【干货】商城系统的重要功能特性介绍
电子商务的快速发展,商城系统成为了企业开展线上销售的重要工具。一款功能强大、用户友好的商城系统能够有效提升企业的销售业绩,提供良好的购物体验。下面就商城系统的重要功能特性作一些简单介绍,帮助企业选择合适的系统,打造成…...
![](https://img-blog.csdnimg.cn/96f3390a51cc49a2953bfed8a07f8655.png)
MYSQL06高级_为什么使用索引、优缺点、索引的设计、方案、聚簇索引、联合索引、注意事项
文章目录 ①. 为什么使用索引②. 索引及其优缺点③. InnoDb - 索引的设计④. InnoDb中的索引方案⑤. 索引 - 聚簇索引⑥. 索引 - 二级索引⑦. B树索引的注意事项⑧. MyISAM中索引方案 ①. 为什么使用索引 ①. 索引是存储引擎用于快速找到数据记录的一种数据结构,就好比去图书馆…...
![](https://img-blog.csdnimg.cn/b77d184d1d7a489c8f7ded3b8b7efb39.png#pic_center)
LeetCode 130. 被围绕的区域
题目链接:130. 被围绕的区域 题目描述 给你一个 m x n 的矩阵 board ,由若干字符 ‘X’ 和 ‘O’ ,找到所有被 ‘X’ 围绕的区域,并将这些区域里所有的 ‘O’ 用 ‘X’ 填充。 示例1: 输入:board [[“…...
![](https://img-blog.csdnimg.cn/img_convert/62e9b2d7bfbe412f0fc281de1869ffba.png)
python中2等于2.0吗,python中【1:2】
本篇文章给大家谈谈python中2等于2.0吗,以及python中【1:2】,希望对各位有所帮助,不要忘了收藏本站喔。 变量和赋值 Python中的变量不需要声明, 直接定义即可. 会在初始化的时候决定变量的 “类型” 使用 来进行初始化和赋值操作 定义变量时…...
![](https://www.ngui.cc/images/no-images.jpg)
【2023年11月第四版教材】《第2章-信息技术发展(第一部分)》
《第2章-信息技术发展(第一部分)》 章节说明1 计算机软硬件2 计算机网络2.1 网络的作用范围2.2 OSI模型2.3 广域网协议2.4 网络协议2.5 TCP/IP2.6 软件定义网络(SDN)2.7 第五代移动通信技术 章节说明 大部分为新增内容࿰…...
![](https://img-blog.csdnimg.cn/21d1b54e782e446ab8f455caa2adff57.png)
【CSS】说说对BFC的理解
目录 一、概念 二、BFC的布局规则 三、设置BFC的常用方式 四、BFC的应用场景 1、解决浮动元素令父元素高度坍塌的问题 2、解决非浮动元素被浮动元素覆盖问题 3、解决外边距垂直方向重合的问题 五、总结 一、概念 我们在页面布局的时候,经常出现以下情况&am…...
![](https://www.ngui.cc/images/no-images.jpg)
ES6学习-Class类
class constructor 构造方法 this 代表实例对象 方法之间不需要逗号分隔,加了会报错。 typeof Point // "function" Point Point.prototype.constructor // true类的数据类型就是函数,类本身就指向构造函数。 类的所有方法都定义在类的pr…...
![](https://img-blog.csdnimg.cn/3b30f16555d0438a97bd43ef48049e4d.png#pic_center)
C语言经典小游戏之扫雷(超详解释+源码)
“少年气,是历尽千帆举重若轻的沉淀,也是乐观淡然笑对生活的豁达!” 今天我们学习一下扫雷游戏怎么用C语言来实现! 扫雷小游戏 1.游戏介绍2.游戏准备3.游戏实现3.1生成菜单3.2游戏的具体实现3.2.1初始化棋盘3.2打印棋盘3.3布置雷…...
![](https://www.ngui.cc/images/no-images.jpg)
算法leetcode|67. 二进制求和(rust重拳出击)
文章目录 67. 二进制求和:样例 1:样例 2:提示: 分析:题解:rust:go:c:python:java: 67. 二进制求和: 给你两个二进制字符串 a 和 b &a…...
![](https://img-blog.csdnimg.cn/46f3fc3ad86240b2a3117668e86c4dc3.png)
【ASP.NET MVC】第一个登录页面(8)
一、准备工作 先从网上(站长之家、模板之家,甚至TB)下载一个HTML模板,要求一整套的CSS和必要的JS,比如下图: 登录页面的效果是: 首页: 利用这些模板可以减少前台网页的设计——拿来…...
![](https://img-blog.csdnimg.cn/45be7b61ad3746fe88098ad6c879b474.png)
使用Openoffice或LibreOffice实现World、Excel、PPTX在线预览
使用Openoffice或LibreOffice实现World、Excel、PPTX在线预览 预览方案使用第三方服务使用前端库转换格式 jodconverterjodconverter概述主要特性OpenOfficeLibreOffice jodconverter的基本使用添加依赖配置创建DocumentConverter实例上传与转换预览启动上传与预览World 与Spri…...
![](https://www.ngui.cc/images/no-images.jpg)
20天学会rust(三)没有object的rust怎么面向对象?
面向对象我们都很熟悉,可以说它是一种软件开发最重要的编程范式之一,它将程序中的数据和操作数据的方法组织成对象。面向对象有几个重要特性: 封装、继承和多态,基于这些特性带来了在可重用性、可维护性、扩展性、可靠性的优点。 …...
![](https://img-blog.csdnimg.cn/a642359a43bf4fb586b7df2770e7e875.png)
整数规划——第三章 全单模矩阵
整数规划——第三章 全单模矩阵 若线性规划问题的约束矩阵为全单模矩阵,则该问题可行域的顶点都是整数点,从而线性规划与整数规划的最优解相同。 3.1 全单模性与最优性 考虑线性整数规划问题: (IP) min c T x , s . t . A x ≤ b , x …...
![](https://www.ngui.cc/images/no-images.jpg)
数据结构和算法
数据结构和算法目录表 CCJava线性结构 1. 数组、单链表和双链表 2. Linux内核中双向链表的经典实现 数组、单链表和双链表 数组、单链表和双链表 栈 栈 栈 队列 队列 队列树形结构 二叉查找树 二叉查找树 二叉查找树 AVL树 AVL树 AVL树 伸展树 伸展树 伸展树 1. 红黑树(一)之…...
![](https://img-blog.csdnimg.cn/6bb50b412e3b4591bf8f5912922a1c38.png)
[Vulnhub] matrix-breakout-2-morpheus
目录 <1> 信息收集 <2> getshell <3> Privilege Escalation(提权) <1> 信息收集 nmap -sP 192.168.236.0/24 扫描一下靶机ip 靶机ip: 192.168.236.154 nmap -A -p 1-65535 192.168.236.154 扫描一下靶机开放哪些服务 开放…...
![](https://img-blog.csdnimg.cn/e493eab42722457aae4d65103f0f60e4.png)
JDK, JRE和JVM之间的区别和联系
JDK, JRE和JVM是与Java编程语言相关的三个重要的概念,它们分别代表Java Development Kit(Java开发工具包)、Java Runtime Environment(Java运行时环境)和Java虚拟机(Java Virtual Machine)。它们…...
![](https://img-blog.csdnimg.cn/d6bf43a01a4b4cf299aca29e7a088bd1.jpeg)
mac电脑访问windows共享文件夹连接不上(设置445端口)
前提:首先需要保证mac和windows都在同一局域网内,如果不在肯定是连不上的,就不用往下看了。 事情是这样的,公司入职发了mac电脑,但是我是window重度用户,在折腾mac的过程中,有许多文件需要从wi…...
![](https://img-blog.csdnimg.cn/775632765b6744fbbecbd8fdd097d1ab.png)
metersphere性能压测执行过程
(1) 首先在controller层,通过RunTestPlanRequest接收请求参数 PostMapping("/run")public String run(RequestBody RunTestPlanRequest request) (2) 在PerformanceTestService中的run中进行具体的逻辑处理, 首先根据请求中ID来获取库中存储…...
![](https://img-blog.csdnimg.cn/img_convert/e39556d42f3b4d42f4941b0e76d7692c.jpeg)
揭秘Word高级技巧:事半功倍的文字处理策略
Microsoft Word是一款广泛使用的文字处理软件,几乎每个人都有使用过它的经历。但是,你是否知道Word中隐藏着许多高级技巧和功能,可以帮助你事半功倍地处理文字?在本文中,我们将揭秘一些Word的高级技巧,让你…...
![](https://img-blog.csdnimg.cn/9fbb03e0ce714de89bdbc79d7df1950d.png)
06-1_Qt 5.9 C++开发指南_对话框与多窗体设计_标准对话框
在一个完整的应用程序设计中,不可避免地会涉及多个窗体、对话框的设计和调用,如何设计和调用这些对话框和窗体是搞清楚一个庞大的应用程序设计的基础。本章将介绍对话框和多窗体设计、调用方式、数据传递等问题,主要包括以下几点。 Qt 提供的…...
![](https://img-blog.csdnimg.cn/6315b86774c64fac8f0cede7910f5ef6.png)
模拟实现消息队列项目(系列7) -- 实现BrokerServer
目录 前言 1. 创建BrokerServer类 1.1 启动服务器 1.2 停止服务器 1.3 处理一个客户端的连接 1.3.1 解析请求得到Request对象 1.3.2 根据请求计算响应 1.3.3 将响应写回给客户端 1.3.4 遍历Session的哈希表,把断开的Socket对象的键值对进行删除 2. 处理订阅消息请求详解(补充) …...
![](https://img-blog.csdnimg.cn/b037a55c7de24729bd1858df8315b861.png)
vscode插件不能搜索安装
1 现象 vscode搜索自己的插件,报错: Error while fetching extensions. HXR failed2 原因 之前用vscode开发golang语言,设置了proxy代理,所以导致错误,删除即可 重启vscode 3 结果...
![](/images/no-images.jpg)
我想给别人做网站/网站排名优化专业定制
Hibernate中的一对一映射关系有两种实现方法(单向一对一,和双向一对一)(一对一关系:例如一个department只能有一个manager) 单向和双向有什么区别呢??例如若是单向一对一,比如在depa…...
![](https://images.cnblogs.com/cnblogs_com/flyingis/updatecache1.jpg)
网站做长尾词好还是单个词好/ai智能搜索引擎
作者:Flyingis 提升ArcGIS Server访问速度最佳的方式是Cache,将所有图层切片保存在服务器,客户端请求时直接访问cache好的图片,这里分为两种情况,一是所有图层都做cache,二是部分图层做cache࿰…...
![](https://images0.cnblogs.com/blog/705575/201503/012125201597047.png)
网站后台怎么/站长网站优化公司
一、方法重载: 1.两个函数同名,就互相构成方法的重载关系 2.重载的函数,必须跟其他函数之间具有不同的参数类型或参数个数 二、字段与属性 类的字段: 类里面是可以直接定义变量的,这些变量就叫类的字段,也叫…...
![](https://images0.cnblogs.com/blog/565803/201412/301819461065131.png)
用虚拟机做网站服务器吗/做市场推广应该掌握什么技巧
最近项目中需要在SQL SERVER中进行分页,需要编写分页查询语句。之前也写过一些关于分页查询的语句,但是性能不敢恭维。于是在业务时间,在微软社区Bing了一篇老外写的关于SQL SERVER分页的文章。看过之后,感觉自己之前写的语句&…...
![](/images/no-images.jpg)
哈尔滨一恒建设/济南网站seo优化
介绍 Go 的 slice 类型提供了一种方便有效的方法来处理类型化数据序列。切片类似于其他语言中的数组,但具有一些不寻常的属性。本文将介绍切片是什么以及它们的使用方法。 数组 切片类型是建立在 Go 的数组类型之上的抽象,因此要理解切片我们必须首先理解数组。 数组类型定义…...
![](https://yqfile.alicdn.com/f20c8a7ae7e38c9cb81574fd9279a569505f14a2.png)
网站建设烟台/北京疫情太严重了
出品丨Docker公司(ID:docker-cn)编译丨小东每周一、三、五 与您不见不散! 早前,我们分享了一篇名为“镜像扫描基于策略的镜像提升”,打造安全的 Kubernetes 供应链!的文章,它主要介绍…...