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

城乡建设举报网站商业网站设计专业

城乡建设举报网站,商业网站设计专业,建设一个网站所需要注意的,wordpress换不了密码肺炎是一种由感染引起的严重呼吸道疾病#xff0c;特别是在高危人群中#xff0c;可能会出现危及生命的并发症。必须尽快诊断和治疗肺炎#xff0c;以最大限度地提高患者康复的机会。 诊断过程并不容易#xff0c;需要一些医学实验室工具和先进的医疗技能#xff0c;但我们… 肺炎是一种由感染引起的严重呼吸道疾病特别是在高危人群中可能会出现危及生命的并发症。必须尽快诊断和治疗肺炎以最大限度地提高患者康复的机会。 诊断过程并不容易需要一些医学实验室工具和先进的医疗技能但我们可以使用深度学习和计算机视觉来构建一个快速简便的工具帮助医生检测肺炎。 我们可以使用称为OpenCV(https://opencv.org/)开源计算机视觉的开源计算机视觉和机器学习软件库创建用于图像和视频分析的应用程序例如 X 射线结果。Open CV 是一个用于执行计算机视觉、机器学习和图像处理的开源库。 在本课中我们将了解如何使用 OpenCV 识别胸部 X 光图像中的肺炎。 安装 OpenCV 安装 OpenCV 是初始阶段。根据你的操作系统有多种安装 OpenCV 的方法。以下是一些受欢迎的选择 Windows在OpenCV (https://opencv.org/releases/) 主网站上使用预构建的二进制文件。 Linux可以使用 Linux 发行版中包含的包管理器安装 OpenCV。在终端中运行以下指令例如在 Ubuntu 上 Install libopencv-dev with sudo apt-get Mac OS可以使用 Homebrew 设置 OpenCV应在终端中输入以下代码。 Brew install opencv 加载 OpenCV 后你可以使用以下 Python 代码检查它是否正常工作。 import cv2 print(cv2.__version__) 如果正确安装了 OpenCV你应该会在终端中看到版本号。 下载数据集 接下来可以下载将用于训练我们的肺炎检测算法的数据集。在本练习中我们将使用来自 Kaggle 的胸部 X 光图片肺炎数据集。 数据集https://www.kaggle.com/paultimothymooney/chest-xray-pneumonia 数据集中共有 5,856 张胸部 X 光图像分为肺炎和正常两类。 你必须注册 Kaggle 帐户并同意数据集的条款才能获取数据集。完成后在终端中键入以下命令以获取数据集 kaggle datasets download -d paultimothymooney/chest-xray-pneumonia 将下载包含信息的 ZIP 文件。在你的本地计算机上创建一个子文件夹并提取 ZIP 文件。 准备数据 然后必须为我们的肺炎识别模型的训练准备数据。为了从当前样本中创建更多训练样本我们将采用一种称为数据增强的方法。 这样做是为了提高模型的性能并更快地构建模型。为了创建同一图片的不同版本数据增强涉及对图像应用随机变换例如旋转、缩放和翻转。 我们将制作两个目录来准备数据一个用于训练图片一个用于验证图像。80%的图片将用于训练20%用于验证。 这是准备信息的代码 import os import shutil import random# Define the paths input_dir  path/to/input/dir train_dir  path/to/train/dir val_dir  path/to/val/dir# Create the directories os.makedirs(train_dir, exist_okTrue) os.makedirs(val_dir, exist_okTrue)# Get the list of images image_paths  [] for root, dirs, files in os.walk(input_dir):for file in files:if file.endswith(.jpeg):image_paths.append(os.path.join(root, file))# Shuffle the images random.shuffle(image_paths)# Splitsplit_idx  int(0.8 * len(image_paths)) train_image_paths  image_paths[:split_idx] val_image_paths  image_paths[split_idx:] 现在将图像复制到目录中。将“path/to/input/dir”更改为你在此代码中提取信息的目录路径。要分别保存训练和验证图像的目录的路径应替换为“path/to/train/dir”和“path/to/val/dir”。 努力跟踪和重现复杂的实验参数工件是 Comet 工具箱中帮助简化模型管理的众多工具之一。 阅读我们的 PetCam 场景以了解更多信息https://www.comet.com/site/blog/debugging-your-machine-learning-models-with-comet-artifacts/?utm_sourceheartbeatutm_mediumreferralutm_campaignAMS_US_EN_AWA_heartbeat_CTA 训练模型 使用我们在前一阶段创建的训练图像我们现在必须训练肺炎检测模型。我们模型的核心将是一个名为 VGG16 的预训练卷积神经网络 (CNN) 。 流行的 CNN 架构 VGG16 在经过大量图像数据集的训练后在众多图像识别任务上取得了最先进的成功。 下面是训练模型的代码 from tensorflow.keras.models import Model from tensorflow.keras.layers import Dense, GlobalAveragePooling2D from tensorflow.keras.applications import VGG16 from tensorflow.keras.preprocessing.image import ImageDataGenerator# Define the input shape of the images input_shape  (224, 224, 3)# Load the VGG16 model base_model  VGG16(weightsimagenet, include_topFalse, input_shapeinput_shape)# Add a global average pooling layer x  base_model.output x  GlobalAveragePooling2D()(x)# Add a fully connected layer x  Dense(128, activationrelu)(x)# Add the output layer output  Dense(1, activationsigmoid)(x)# Define the model model  Model(inputsbase_model.input, outputsoutput)# Freeze the layers of the VGG16 model for layer in base_model.layers:layer.trainable  False# Compile the model model.compile(optimizeradam, lossbinary_crossentropy, metrics[accuracy])# Define the data generators for training and validation train_datagen  ImageDataGenerator(rescale1./255,rotation_range10,width_shift_range0.1,height_shift_range0.1,shear_range0.1,zoom_range0.1,horizontal_flipTrue,fill_modenearest)val_datagen  ImageDataGenerator(rescale1./255)train_generator  train_datagen.flow_from_directory(train_dir,target_sizeinput_shape[:2],batch_size32,class_modebinary)val_generator  val_datagen.flow_from_directory(val_dir,target_sizeinput_shape[:2],batch_size32,class_modebinary)# Train the model model.fit(train_generator,steps_per_epochlen(train_generator),epochs10,validation_dataval_generator,validation_stepslen(val_generator)) 首先我们将 ImageNet 数据集中的预训练权重加载到 VGG16 模型中。我们还包括一个具有 sigmoid 激活函数的输出层、一个具有 128 个神经元的完全连接层和一个全局平均池化层。VGG16 模型的层被冻结使用 Adam 算法和二元交叉熵损失来构建模型。之后我们指定用于训练和验证的数据生成器以扩充数据并将像素值重新缩放到 [0, 1] 范围。 使用拟合方法以及训练和验证数据生成器我们训练模型 10 个时期。 评估模型 为了确定模型在训练后对新数据的泛化能力如何我们必须评估其在测试集上的表现。为了评估模型我们将使用数据集的测试集。此外我们将显示一些正确和错误分类图像的插图。 使用下面的代码评估模型并显示一些实例。 import numpy as np import matplotlib.pyplot as plt# Define the path to the test directory test_dir  path/to/input/dir/chest_xray/test# Define the data generator for test test_datagen  ImageDataGenerator(rescale1./255)test_generator  test_datagen.flow_from_directory(test_dir,target_sizeinput_shape[:2],batch_size32,class_modebinary,shuffleFalse)# Evaluate the model on the test set loss, accuracy  model.evaluate(test_generator, stepslen(test_generator)) print(fTest accuracy: {accuracy:.2f})# Get the predictions and true labels predictions  model.predict(test_generator, stepslen(test_generator)) predictions  np.squeeze(predictions) true_labels  test_generator.labels# Get the image filenames filenames  test_generator.filenames# Find the indices of the correctly and incorrectly classified images correct_indices  np.where((predictions  0.5)  true_labels)[0] incorrect_indices  np.where((predictions  0.5) ! true_labels)[0]# Plot some correctly classified images plt.figure(figsize(10, 10)) for i, idx in enumerate(correct_indices[:9]):plt.subplot(3, 3, i1)img  plt.imread(os.path.join(test_dir, filenames[idx]))plt.imshow(img, cmapgray)plt.title(PNEUMONIA if predictions[idx]  0.5 else NORMAL)plt.axis(off)# Plot some incorrectly classified images plt.figure(figsize(10, 10)) for i, idx in enumerate(incorrect_indices[:9]):plt.subplot(3, 3, i1)img  plt.imread(os.path.join(test_dir, filenames[idx]))plt.imshow(img, cmapgray)plt.title(PNEUMONIA if predictions[idx]  0.5 else NORMAL)plt.axis(off)plt.show() 在这段代码中我们创建了一个测试和评估集数据生成器来评估模型。我们还获得了测试集的预测和真实标签并找到了正确和错误分类图像的索引。然后使用 Matplotlib我们绘制了一些正确和错误分类图像的实例。 结论 在本教程中我们使用 OpenCV 和 TensorFlow 构建了一个肺炎检测模型。我们使用 OpenCV 读取、处理和可视化图像并使用 TensorFlow 训练和测试模型。该模型成功地以高精度对大多数测试集的图像进行了分类。 计算机视觉可以成为医疗诊断的巨大资产。虽然它们不能替代训练有素的医疗保健提供者但它们可以缩短诊断时间并提高诊断准确性。你可以在此处查看更多 CV 医疗用例https://arxiv.org/pdf/2203.15269.pdf ☆ END ☆ 如果看到这里说明你喜欢这篇文章请转发、点赞。微信搜索「uncle_pn」欢迎添加小编微信「 woshicver」每日朋友圈更新一篇高质量博文。 ↓扫描二维码添加小编↓
http://www.hkea.cn/news/14286331/

相关文章:

  • 潍坊高级网站建设推广wordpress仿36kr主题
  • 可以打开所有网站的浏览器网站建设目标定位
  • 西安建设局官方网站网络营销渠道策略分析
  • 个人网站备案时间中国空间站简介100字
  • 网站的页面布局是什么样的建立网站赚钱 优帮云
  • 西安网站建设行业公司自建网站
  • pc网站增加手机站如何登录wordpress
  • 公众号链接电影网站怎么做10大免费软件下载网站
  • 网站设置二级域名好吗瑞安做企业网站找哪家
  • wordpress改动立马生效做企业网站排名优化要多少钱
  • 美工网站模板如何做网站的线下推广
  • 个人网站备案icp邯郸建设网站的公司
  • 宿迁哪里有做网站开发的营销网站运营的基本环节
  • 深圳市制作网站企业网站设计模板
  • 网站建设vipjiuselu枣庄市建设项目环评备案网站
  • 建设营销型网站服务网站建设网络推广的好处
  • 网站建设含义怎么提升网站收录
  • 中山微网站建设报价什么软件可以找客户资源
  • 上海嘉定做网站公司网站seo外链接
  • 企业门户网站主要功能个人域名备案网站名称例子
  • 微信对接网站泰安房产网0538
  • 商城网站平台怎么做阳江房产网二手房林夏婷经纪人
  • 免费建网站最新视频教程2m带宽可以做音乐网站
  • jsp做的当当网站的文档长春房产网
  • 西安网站建设交易百度指数购买
  • 做自行车车队网站的名字东莞室内设计公司
  • 自助建站编辑器比较好的做外贸网站
  • 求一个dw做的网站长春专业网站推广
  • 不同类型网站栏目设置区别企业网站建设平台
  • 百度网站前面的图片qq是用什么开发的