Skip to content

Commit

Permalink
2024-02-08 19:45:20
Browse files Browse the repository at this point in the history
  • Loading branch information
wizardforcel committed Feb 8, 2024
1 parent fff3208 commit 79f7d07
Show file tree
Hide file tree
Showing 2 changed files with 657 additions and 0 deletions.
21 changes: 21 additions & 0 deletions totrans/prac-dl-cld_15.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -787,6 +787,7 @@
id: totrans-109
prefs: []
type: TYPE_NORMAL
zh: 我们还剩下最后一步:将冻结的图形文件转换为*.TFLite*格式。我们可以使用`tflite_convert`工具来完成这个操作:
- en: '[PRE17]'
id: totrans-110
prefs: []
Expand All @@ -797,12 +798,14 @@
id: totrans-111
prefs: []
type: TYPE_NORMAL
zh: 在这个命令中,请注意我们使用了一些可能一开始不直观的不同参数:
- en: For `--input_arrays`, the argument simply indicates that the images that will
be provided during predictions will be normalized `float32` tensors.
id: totrans-112
prefs:
- PREF_UL
type: TYPE_NORMAL
zh: 对于`--input_arrays`,参数简单地表示在预测期间提供的图像将是归一化的`float32`张量。
- en: 'The arguments supplied to `--output_arrays` indicate that there will be four
different types of information in each prediction: the number of bounding boxes,
detection scores, detection classes, and the coordinates of bounding boxes themselves.
Expand All @@ -812,47 +815,55 @@
prefs:
- PREF_UL
type: TYPE_NORMAL
zh: 提供给`--output_arrays`的参数表明每个预测中将有四种不同类型的信息:边界框的数量、检测分数、检测类别和边界框本身的坐标。这是可能的,因为我们在上一步的导出图脚本中使用了参数`--add_postprocessing_op=true`。
- en: For `--input_shape`, we provide the same dimension values as we did in the *pipeline.config*
file.
id: totrans-114
prefs:
- PREF_UL
type: TYPE_NORMAL
zh: 对于`--input_shape`,我们提供与*pipeline.config*文件中相同的维度值。
- en: The rest are fairly trivial. We should now have a spanking new *cats.tflite*
model file within our *tflite_model/* directory. It is now ready to be plugged
into an Android, iOS, or edge device to do live detection of cats. This model
is well on its way to saving Bob’s garden!
id: totrans-115
prefs: []
type: TYPE_NORMAL
zh: 其余的都相当琐碎。我们现在应该在*tflite_model/*目录中有一个全新的*cats.tflite*模型文件。现在它已经准备好插入到Android、iOS或边缘设备中,以进行猫的实时检测。这个模型正在为拯救鲍勃的花园而努力!
- en: Tip
id: totrans-116
prefs:
- PREF_H6
type: TYPE_NORMAL
zh: 提示
- en: In the floating-point MobileNet model, '`normalized_image_tensor`' has values
between `[-1,1)`. This typically means mapping each pixel (linearly) to a value
between [–1,1]. Input image values between 0 and 255 are scaled by (1/128) and
then a value of –1 is added to them to ensure the range is `[-1,1)`.
id: totrans-117
prefs: []
type: TYPE_NORMAL
zh: 在浮点MobileNet模型中,'`normalized_image_tensor`'的值在`[-1,1)`之间。这通常意味着将每个像素(线性地)映射到一个值在[–1,1]之间。输入图像的值在0到255之间被缩放为(1/128),然后将-1的值添加到它们中以确保范围是`[-1,1)`。
- en: In the quantized MobileNet model, '`normalized_image_tensor`' has values between
`[0, 255]`.
id: totrans-118
prefs: []
type: TYPE_NORMAL
zh: 在量化的MobileNet模型中,'`normalized_image_tensor`'的值在`[0, 255]`之间。
- en: In general, see the `preprocess` function defined in the feature extractor class
in the TensorFlow Models repository at *models/research/object_detection/models*
directory.
id: totrans-119
prefs: []
type: TYPE_NORMAL
zh: 通常,在TensorFlow Models存储库的*models/research/object_detection/models*目录中定义的特征提取器类中查看`preprocess`函数。
- en: Image Segmentation
id: totrans-120
prefs:
- PREF_H1
type: TYPE_NORMAL
zh: 图像分割
- en: Taking a step further beyond object detection, to get more precise locations
of objects, we can perform object segmentation. As we saw earlier in this chapter,
this involves making category predictions for each pixel in an image frame. Architectures
Expand All @@ -866,27 +877,33 @@
id: totrans-121
prefs: []
type: TYPE_NORMAL
zh: 在超越目标检测的基础上,为了获得更精确的物体位置,我们可以执行物体分割。正如我们在本章前面看到的那样,这涉及对图像帧中的每个像素进行类别预测。像U-Net、Mask
R-CNN和DeepLabV3+这样的架构通常用于执行分割任务。与目标检测类似,有一个越来越流行的趋势是在实时运行分割网络,包括在资源受限的设备上,如智能手机上。实时性为许多消费者应用场景打开了大门,比如面部滤镜([图14-19](part0017.html#colorizing_hair_by_accurately_mapping_th)),以及工业场景,比如为自动驾驶汽车检测可行驶道路([图14-20](part0017.html#image_segmentation_performed_on_frames_f))。
- en: '![Colorizing hair with ModiFace app by accurately mapping the pixels belonging
to the hair](../images/00012.jpeg)'
id: totrans-122
prefs: []
type: TYPE_IMG
zh: '![使用ModiFace应用程序为头发上色,准确映射属于头发的像素](../images/00012.jpeg)'
- en: Figure 14-19\. Colorizing hair with ModiFace app by accurately mapping the pixels
belonging to the hair
id: totrans-123
prefs:
- PREF_H6
type: TYPE_NORMAL
zh: 图14-19。使用ModiFace应用程序为头发上色,准确映射属于头发的像素
- en: '![Image segmentation performed on frames from a dashcam (CamVid dataset)](../images/00300.jpeg)'
id: totrans-124
prefs: []
type: TYPE_IMG
zh: '![从行车记录仪(CamVid数据集)的帧上执行的图像分割](../images/00300.jpeg)'
- en: Figure 14-20\. Image segmentation performed on frames from a dashcam (CamVid
dataset)
id: totrans-125
prefs:
- PREF_H6
type: TYPE_NORMAL
zh: 图14-20。从行车记录仪(CamVid数据集)的帧上执行的图像分割
- en: As you might have grown accustomed to hearing in this book by now, you can accomplish
much of this without needing much code. Labeling tools like Supervisely, LabelBox,
and Diffgram can help not just label the data, but also load previously annotated
Expand All @@ -898,21 +915,25 @@
id: totrans-126
prefs: []
type: TYPE_NORMAL
zh: 正如你现在可能已经习惯在这本书中听到的,你可以在不需要太多代码的情况下完成很多工作。像Supervisely、LabelBox和Diffgram这样的标注工具不仅可以帮助标注数据,还可以加载先前注释过的数据并在预训练的对象分割模型上进一步训练。此外,这些工具提供了AI辅助标注,可以大大加快(约10倍)原本费时费力的昂贵标注过程。如果这听起来令人兴奋,那你很幸运!我们在书的GitHub网站上包含了一个额外的资源指南,介绍如何学习和构建分割项目(请参见[*http://PracticalDeepLearning.ai*](http://PracticalDeepLearning.ai))。
- en: Case Studies
id: totrans-127
prefs:
- PREF_H1
type: TYPE_NORMAL
zh: 案例研究
- en: Let’s now look at how object detection is being used to power real-world applications
in the industry.
id: totrans-128
prefs: []
type: TYPE_NORMAL
zh: 现在让我们看看目标检测是如何被用于推动行业中的实际应用的。
- en: Smart Refrigerator
id: totrans-129
prefs:
- PREF_H2
type: TYPE_NORMAL
zh: 智能冰箱
- en: Smart fridges have been gaining popularity for the past few years because they
have started to become more affordable. People seem to like the convenience of
knowing what’s in their fridge even when they are not home to look inside. Microsoft
Expand Down
Loading

0 comments on commit 79f7d07

Please sign in to comment.