import cv2
import numpy as np
import os
import random
from PIL import Image
import matplotlib.pyplot as plt
# https://blog.csdn.net/qq_44886601/article/details/135764589
# 将mask绘制在原图
def draw_image(im, ms, brg, opacity):
image_mask = im.copy()
contours, _ = cv2.findContours(ms, cv2.RETR_TREE, cv2.CHAIN_APPROX_NONE) # 查找轮廓
image_mask = cv2.drawContours(image_mask, contours, -1, (0, 255, 0), 2) # 绘制边界
image_mask = cv2.fillPoly(image_mask, contours, color=brg) # 填充
img_bgr = cv2.addWeighted(im, opacity, image_mask, 1 - opacity, 0)
return im, ms, img_bgr
def main(imagePath, labelPath, bgr, opacity):
image = np.array(Image.open(imagePath).convert('RGB'))
label = np.array(Image.open(labelPath).convert('L'))
a, b, c = draw_image(image, label, bgr, opacity)
plt.figure(figsize=(12, 8))
for index, i in enumerate((a, b, c)):
plt.subplot(1, 3, index + 1)
plt.imshow(i)
plt.savefig('./result.png')
# plt.show()
if __name__ == '__main__':
root = './data/train/images'
images_path = [os.path.join(root, i) for i in os.listdir(root)]
r = random.randint(0, len(images_path) - 1)
img_path = images_path[r] # 随机取出一张图片
mask_path = img_path.replace('images', 'masks')
mask_path = mask_path.replace('.jpg', '_mask.png')
# opacity 越小,掩膜效果越深
main(imagePath=img_path, labelPath=mask_path, bgr=(0, 0, 255), opacity=0.5)
没有合适的资源?快使用搜索试试~ 我知道了~
温馨提示
项目包含:火焰、烟雾分割(3类别分割任务,包含训练集和测试集) 数据集为工厂烟囱火焰烟雾分割数据,加背景的话属于3类别的分割任务。前景区域丰富,可以用于分割数据 数据集总大小:6 MB 数据集介绍:分为训练集、测试集 训练集:images图片目录+masks模板目录,161张图片和161个对应的mask图片 测试集:images图片目录+masks模板目录,40图片和40个对应的mask图片 除此之外,包含一个图像分割的可视化脚本,随机提取一张图片,将其原始图片、GT图像、GT在原图蒙板的图像展示,并保存在当前目录下
资源推荐
资源详情
资源评论
收起资源包目录
图像分割数据集:火焰、烟雾分割(3类别分割任务,包含训练集和测试集) (404个子文件)
flare_0094_jpg.rf.ca15c48a1a94e3aafa09eda64ea01930.jpg 78KB
flare_0165_jpg.rf.59f7bc305d4b52e4ed63b462b85fd747.jpg 72KB
flare_0118_jpg.rf.033779b6a986e640a8f4355cc537d3dc.jpg 62KB
flare_0090_jpg.rf.a32305fea8de497e66cc57c27d9238c8.jpg 57KB
flare_0214_jpg.rf.84f5efecd354edd5c93246a2b365c58b.jpg 56KB
flare_0088_jpg.rf.9b604d6d7b513da230492a84e511b558.jpg 53KB
flare_0105_jpg.rf.911f8dcbe0f9c088fd75ca90b70f15d8.jpg 51KB
flare_0196_jpg.rf.8b1674069e52c54a44c0066f2e7d1418.jpg 50KB
flare_0061_jpg.rf.be4d56d25518cc36c8747f37d49464df.jpg 49KB
flare_0036_jpg.rf.6bdaa6cb2e0bdf879461aa97358199b0.jpg 49KB
flare_0126_jpg.rf.8039c8b3d515c206d99676e2f9aa7c57.jpg 48KB
flare_0122_jpg.rf.1a2eb408a48e6b473ac459672ac5bf33.jpg 48KB
flare_0103_jpg.rf.9ffb6b7bf6401cd686fd0e9ad1acfda8.jpg 47KB
flare_0092_jpg.rf.d16930e9ab8c692a18e3be2b3a0eca61.jpg 46KB
flare_0115_jpg.rf.528e57853629866ce79f718d84db3d9c.jpg 46KB
flare_0188_png_jpg.rf.db4e3d064b8adb39759f2f8922da5422.jpg 45KB
flare_0187_jpg.rf.b446de82d7fadfb50c90ddd8e3b9bb0b.jpg 43KB
flare_0164_jpg.rf.bfa47c18e62dcb338b5b64b1c767d8a8.jpg 42KB
flare_0163_jpg.rf.8532537ca0d69062aa046639136c6aca.jpg 42KB
flare_0125_jpg.rf.f4879c32d0a670a83648d235b144b122.jpg 41KB
flare_0194_jpg.rf.09cec1215227c42f707c84d368dcf14d.jpg 40KB
flare_0130_jpg.rf.92c0466a7f1bc201500e08bdeadd22b9.jpg 39KB
flare_0128_jpg.rf.c398f3bd35a115b13a9ecb5fb5f24e1e.jpg 38KB
flare_0189_jpg.rf.2b2f63dff447bae9f297053947399852.jpg 37KB
flare_0035_jpg.rf.a8fd48373434316a5569a57d0b442529.jpg 37KB
flare_0179_jpg.rf.1b438630bd4035d31ae09700c303956b.jpg 37KB
flare_0153_jpg.rf.a219a0c0949ad622242bffeecbe4b1c9.jpg 36KB
flare_0169_jpg.rf.d98f478ef164f0773458e2626864bf55.jpg 36KB
flare_0162_jpg.rf.8a4844f3aa145a82a21ff79c5ea122fe.jpg 36KB
flare_0183_jpg.rf.3c51da5ff618f858fd56f878a8ebcc20.jpg 36KB
flare_0102_jpg.rf.7275026ecb313830b6dd1577c71759e2.jpg 36KB
flare_0110_jpg.rf.2fc299af019d376014bd84dfcdaef95e.jpg 35KB
flare_0138_jpg.rf.88c01a147292e7ce6248915a4bc62c61.jpg 35KB
flare_0007_jpg.rf.7dadc9b7c0439f6767b831a6e3c6fcee.jpg 35KB
flare_0106_jpg.rf.48b18b85dca450093fbc20b55e230d80.jpg 34KB
flare_0069_jpg.rf.58f251e9066b2752d1ff5c643faca2c7.jpg 33KB
flare_0170_jpg.rf.d9a89c2111aea5a7ccccd11b324edc9c.jpg 33KB
flare_0091_jpg.rf.549eb31caad73b68dcc1b17d76aac511.jpg 33KB
flare_0185_jpg.rf.d88ffed38de027e4e52f295811654e69.jpg 33KB
flare_0120_jpg.rf.699b2a00bcce455f5f9253e6bca42ebb.jpg 33KB
flare_0150_jpg.rf.12e8e49e6793dec0a722217c929512ea.jpg 33KB
flare_0177_jpg.rf.2c468163f63ba3f849c9b3f88d939eda.jpg 33KB
flare_0013_jpg.rf.55208f011cfaa0bbe058e82083dba2ca.jpg 33KB
flare_0178_jpg.rf.c4253410b13ec6d3b811854acc0e9794.jpg 33KB
flare_0180_jpg.rf.0cd00c4b9f1aebc78a185702eb115dc5.jpg 33KB
flare_0127_jpg.rf.97087d0069748097940ce5e57132f282.jpg 33KB
flare_0225_jpg.rf.0f34a78baf7d1c46950f615017f92478.jpg 32KB
flare_0142_jpg.rf.276d94d5268a6b336e323321c22caca0.jpg 32KB
flare_0003_jpg.rf.ec37dbee1c058887c11d085d945258aa.jpg 32KB
flare_0154_jpg.rf.d8458283b31d434353ff12a1f7e62564.jpg 32KB
flare_0192_jpg.rf.acaf39f365112b3ae1c068c7750418e2.jpg 32KB
flare_0158_jpg.rf.d3ec1f3a3269d28e443876e432604775.jpg 32KB
flare_0096_jpg.rf.21e51a58d7bda4dff280b18e8543328c.jpg 32KB
flare_0082_jpg.rf.a5ca8fb156dadb9e4c8a3cdb56ec8927.jpg 31KB
flare_0186_jpg.rf.680e7037bcd20091fd909d01ed3e55df.jpg 31KB
flare_0226_jpg.rf.f617fbfe39a59525a5e73963a0d9df1f.jpg 31KB
flare_0227_jpg.rf.5dd25a53c35fb13a061b5e4e1c127c57.jpg 31KB
flare_0190_jpg.rf.d8d360d29b4362e4d1dacdc5351ba562.jpg 31KB
flare_0139_jpg.rf.84d6570e04bec6da4dde06880dbaca42.jpg 31KB
flare_0022_jpg.rf.c42a69ad9b468962d982ab49b8e76ff7.jpg 31KB
flare_0156_jpg.rf.e573e7db3ec34ce36715f9c701d82106.jpg 30KB
flare_0095_jpg.rf.6bb205f8e563a45b6069f16f784a4c8c.jpg 30KB
flare_0033_jpg.rf.61286b6e881eed001a09d6e6b30f5bb0.jpg 30KB
flare_0005_jpg.rf.5dfa73527242933b29866bed97988f89.jpg 30KB
flare_0223_jpg.rf.f1aa9ce91a104c143425565d033c5ce4.jpg 30KB
flare_0079_jpg.rf.f4610958387f525a5ad067212f9b35c1.jpg 30KB
flare_0213_jpg.rf.00b76497f3f6f2fcb6a542f844c37f99.jpg 30KB
flare_0049_jpg.rf.52937d330bf0148f14583d2849d1123f.jpg 30KB
flare_0059_jpg.rf.0a6fe88fa2f7c1f285c64c488f14084e.jpg 30KB
flare_0034_jpg.rf.8be03de4d4d3e7f34c8f809864ec0df8.jpg 30KB
flare_0197_jpg.rf.afd0269ccfb13e9e74936ae0e30ce62e.jpg 29KB
flare_0008_jpg.rf.b8d1c88180a13b17e497f481f48b4d1e.jpg 29KB
flare_0135_jpg.rf.fbba58cb05e235f3b452eb9601b4e55d.jpg 29KB
flare_0168_jpg.rf.7d38f72c0aaa85e1c375abedf92b1bbd.jpg 29KB
flare_0015_jpg.rf.7128b515c1b386e94e211f8da0a3b21d.jpg 29KB
flare_0149_jpg.rf.4f189b4ae9344a8a1a7ce4d8c272d157.jpg 29KB
flare_0080_jpg.rf.9759224be09afccccb4da4f24d461be9.jpg 29KB
flare_0136_jpg.rf.6d20c9367c9558c216200f119d3d8702.jpg 29KB
flare_0100_jpg.rf.c1d0a66a79c108be6a9457f98a02977b.jpg 28KB
flare_0078_jpg.rf.750a84db5e87c3568e0627d52ebcb588.jpg 28KB
flare_0029_jpg.rf.3d01513983c6a951fadf2c3d8857ae03.jpg 28KB
flare_0141_jpg.rf.48186e13f1cd5d107d0dd0b994152f75.jpg 28KB
flare_0123_jpg.rf.1d2532e56de832c542a2b895a3db296b.jpg 28KB
flare_0047_jpg.rf.d8cc1da08bd00a3f1b13a4f125f94033.jpg 28KB
flare_0114_jpg.rf.3714d309ed3273eb664fba1e3d8d1e96.jpg 28KB
flare_0212_jpg.rf.1045f640bb67cfeb332323eb1f47f065.jpg 28KB
flare_0004_jpg.rf.0b9afe814358790b9aeb9d85a1bc72ca.jpg 27KB
flare_0052_jpg.rf.c99b3d4d8db668ffe571daeb4301dd07.jpg 27KB
flare_0211_jpg.rf.2e718c1ffff6cd9907a8ad389d28924a.jpg 27KB
flare_0058_jpg.rf.cd59c7be85c64ca35094da6194f8f31e.jpg 27KB
flare_0075_jpg.rf.490f1eaef8d63cdc6aca067ec52733d9.jpg 27KB
flare_0152_jpg.rf.8e71e4452190fc257b4cbe6926424ecd.jpg 27KB
flare_0109_jpg.rf.fbfec71eae0ed23514755b627ea07c7a.jpg 27KB
flare_0216_jpg.rf.fa3b5abf3c72ab7be6c5d76d0996fb7d.jpg 27KB
flare_0037_jpg.rf.956509314c5e536662b9fae5811dfaf5.jpg 27KB
flare_0121_jpg.rf.033c32c5817422591275929302f5d853.jpg 26KB
flare_0016_jpg.rf.62a2d16c348680f0f4213c7c4f112401.jpg 26KB
flare_0045_jpg.rf.c1c170689a1a774ab29d7f8c15b85d85.jpg 26KB
flare_0119_jpg.rf.35dfd71b5d3dcd7fcb2b42a866a914c9.jpg 26KB
flare_0060_jpg.rf.a05f562db12fa33b1e09af49dddce29c.jpg 26KB
共 404 条
- 1
- 2
- 3
- 4
- 5
资源评论
Ai医学图像分割
- 粉丝: 2w+
- 资源: 2122
下载权益
C知道特权
VIP文章
课程特权
开通VIP
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功