tensorflow2的U
Licensed under the Apache License, Version 2.0 (the “License”);
#@title Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. 1234567891011
Image segmentation
This tutorial focuses on the task of image segmentation, using a modified U-Net.
What is image segmentation?
So far you have seen image classification, where the task of the network is to assign a label or class to an input image. However, suppose you want to know where an object is located in the image, the shape of that object, which pixel belongs to which object, etc. In this case you will want to segment the image, i.e., each pixel of the image is given a label. Thus, the task of image segmentation is to train a neural network to output a pixel-wise mask of the image. This helps in understanding the image at a much lower level, i.e., the pixel level. Image segmentation has many applications in medical imaging, self-driving cars and satellite imaging to name a few.
The dataset that will be used for this tutorial is the Oxford-IIIT Pet Dataset, created by Parkhi et al. The dataset consists of images, their corresponding labels, and pixel-wise masks. The masks are basically labels for each pixel. Each pixel is given one of three categories :
Class 1 : Pixel belonging to the pet. Class 2 : Pixel bordering the pet. Class 3 : None of the above/ Surrounding pixel.!pip install -q git+https://github.com/tensorflow/examples.git !pip install -q -U tfds-nightly 12
import tensorflow as tf 1
from tensorflow_examples.models.pix2pix import pix2pix import tensorflow_datasets as tfds tfds.disable_progress_bar() from IPython.display import clear_output import matplotlib.pyplot as plt 1234567
Download the Oxford-IIIT Pets dataset
The dataset is already included in TensorFlow datasets, all that is needed to do is download it. The segmentation masks are included in version 3+.
dataset, info = tfds.load('oxford_iiit_pet:3.*.*', with_info=True) 1
[1mDownloading and preparing dataset oxford_iiit_pet/3.2.0 (download: 773.52 MiB, generated: 774.69 MiB, total: 1.51 GiB) to C:UsersAdministratortensorflow_datasetsoxford_iiit_pet3.2.0...[0m Shuffling and writing examples to C:UsersAdministratortensorflow_datasetsoxford_iiit_pet3.2.0.incompleteUGR50Noxford_iiit_pet-train.tfrecord Shuffling and writing examples to C:UsersAdministratortensorflow_datasetsoxford_iiit_pet3.2.0.incompleteUGR50Noxford_iiit_pet-test.tfrecord [1mDataset oxford_iiit_pet downloaded and prepared to C:UsersAdministratortensorflow_datasetsoxford_iiit_pet3.2.0. Subsequent calls will reuse this data.[0m 1234
The following code performs a simple augmentation of flipping an image. In addition, image is normalized to [0,1]. Finally, as mentioned above the pixels in the segmentation mask are labeled either {1, 2, 3}. For the sake of convenience, let’s subtract 1 from the segmentation mask, resulting in labels that are : {0, 1, 2}.
def normalize(input_image, input_mask): input_image = tf.cast(input_image, tf.float32) / 255.0 input_mask -= 1 return input_image, input_mask 1234
@tf.function def load_image_train(datapoint): input_image = tf.image.resize(datapoint['image'], (128, 128)) input_mask = tf.image.resize(data123
相关知识
TensorFlow2实战
深度学习—利用TensorFlow2实现狗狗品种品种(resnet50实现)
根据U=U的意思是不是可以不用戴安全套了?
Bhiva强调U=U在性传播中为“零风险”或“无风险”
HIV病毒 U=U测不出=不具传染力 在2017年起飞
U爱宠最新版下载
电路如图所示,二极管为同一型号的理想元件, u A =4sinωt V, u B
2023北京U熊评判标准出炉
U爱宠宠物社交APP下载
U Y
网址: tensorflow2的U https://www.mcbbbk.com/newsview843057.html
上一篇: 兽用X射线机 |
下一篇: 宠物医院DR |
推荐分享

- 1我的狗老公李淑敏33——如何 5096
- 2南京宠物粮食薄荷饼宠物食品包 4363
- 3家养水獭多少钱一只正常 3825
- 4豆柴犬为什么不建议养?可爱的 3668
- 5自制狗狗辅食:棉花面纱犬的美 3615
- 6狗交配为什么会锁住?从狗狗生 3601
- 7广州哪里卖宠物猫狗的选择性多 3535
- 8湖南隆飞尔动物药业有限公司宠 3477
- 9黄金蟒的价格 3396
- 10益和 MATCHWELL 狗 3352