Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
QKForex
TensorFlow-Course
提交
c919445c
T
TensorFlow-Course
项目概览
QKForex
/
TensorFlow-Course
与 Fork 源项目一致
从无法访问的项目Fork
通知
2
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
TensorFlow-Course
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
c919445c
编写于
10月 31, 2020
作者:
A
Amirsina Torfi
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
data augmentation
上级
367dd6a7
变更
11
展开全部
隐藏空白更改
内联
并排
Showing
11 changed file
with
449 addition
and
0 deletion
+449
-0
codes/ipython/basics_in_machine_learning/dataaugmentation.ipynb
...ipython/basics_in_machine_learning/dataaugmentation.ipynb
+373
-0
codes/python/basics_in_machine_learning/dataaugmentation.py
codes/python/basics_in_machine_learning/dataaugmentation.py
+76
-0
codes/python/basics_in_machine_learning/linear_regression/README.rst
...n/basics_in_machine_learning/linear_regression/README.rst
+0
-0
codes/python/basics_in_machine_learning/linear_regression/code/linear_regression.py
...hine_learning/linear_regression/code/linear_regression.py
+0
-0
codes/python/basics_in_machine_learning/linear_regression/updating_model.gif
..._in_machine_learning/linear_regression/updating_model.gif
+0
-0
codes/python/basics_in_machine_learning/linear_svm/README.rst
...s/python/basics_in_machine_learning/linear_svm/README.rst
+0
-0
codes/python/basics_in_machine_learning/linear_svm/code/linear_svm.py
.../basics_in_machine_learning/linear_svm/code/linear_svm.py
+0
-0
codes/python/basics_in_machine_learning/logistic_regression/README.rst
...basics_in_machine_learning/logistic_regression/README.rst
+0
-0
codes/python/basics_in_machine_learning/logistic_regression/code/logistic_regression.py
..._learning/logistic_regression/code/logistic_regression.py
+0
-0
codes/python/basics_in_machine_learning/multiclass_svm/README.rst
...thon/basics_in_machine_learning/multiclass_svm/README.rst
+0
-0
codes/python/basics_in_machine_learning/multiclass_svm/code/multiclass_svm.py
...in_machine_learning/multiclass_svm/code/multiclass_svm.py
+0
-0
未找到文件。
codes/ipython/basics_in_machine_learning/dataaugmentation.ipynb
0 → 100644
浏览文件 @
c919445c
此差异已折叠。
点击以展开。
codes/python/basics_in_machine_learning/dataaugmentation.py
0 → 100644
浏览文件 @
c919445c
# -*- coding: utf-8 -*-
"""dataaugmentation.ipynb
Automatically generated by Colaboratory.
Original file is located at
https://colab.research.google.com/drive/1ibfKtpxC_hIhZlPbefCoqpAS7jTdyiFw
"""
import
tensorflow
as
tf
import
tensorflow_datasets
as
tfds
# Import TensorFlow datasets
import
urllib
import
tensorflow_datasets
as
tfds
import
matplotlib.pyplot
as
plt
import
numpy
as
np
# Necessary for dealing with https urls
import
ssl
ssl
.
_create_default_https_context
=
ssl
.
_create_unverified_context
# We read only the first 10 training samples
ds
,
ds_info
=
tfds
.
load
(
'colorectal_histology'
,
split
=
'train'
,
shuffle_files
=
True
,
with_info
=
True
,
download
=
True
)
assert
isinstance
(
ds
,
tf
.
data
.
Dataset
)
print
(
ds_info
)
# Visualizing images
fig
=
tfds
.
show_examples
(
ds
,
ds_info
)
# Reading all images (remove break point to read all)
for
example
in
tfds
.
as_numpy
(
ds
):
image
,
label
=
example
[
'image'
],
example
[
'label'
]
break
# take one sample from data
one_sample
=
ds
.
take
(
1
)
one_sample
=
list
(
one_sample
.
as_numpy_iterator
())
image
=
one_sample
[
0
][
'image'
]
label
=
one_sample
[
0
][
'label'
]
print
(
image
.
shape
,
label
.
shape
)
# Side by side visualization
def
visualize
(
im
,
imAgmented
,
operation
):
fig
=
plt
.
figure
()
plt
.
subplot
(
1
,
2
,
1
)
plt
.
title
(
'Original image'
)
plt
.
imshow
(
im
)
plt
.
subplot
(
1
,
2
,
2
)
plt
.
title
(
operation
)
plt
.
imshow
(
imAgmented
)
# Adding Gaussian noise to image
common_type
=
tf
.
float32
# Make noise and image of the same type
gnoise
=
tf
.
random
.
normal
(
shape
=
tf
.
shape
(
image
),
mean
=
0.0
,
stddev
=
0.1
,
dtype
=
common_type
)
image_type_converted
=
tf
.
image
.
convert_image_dtype
(
image
,
dtype
=
common_type
,
saturate
=
False
)
noisy_image
=
tf
.
add
(
image_type_converted
,
gnoise
)
visualize
(
image_type_converted
,
noisy_image
,
'noisyimage'
)
# Adjusting brighness
bright
=
tf
.
image
.
adjust_brightness
(
image
,
0.2
)
visualize
(
image
,
bright
,
'brightened image'
)
# Flip image
flipped
=
tf
.
image
.
flip_left_right
(
image
)
visualize
(
image
,
flipped
,
'flipped image'
)
adjusted
=
tf
.
image
.
adjust_jpeg_quality
(
image
,
jpeg_quality
=
20
)
visualize
(
image
,
adjusted
,
'quality adjusted image'
)
# Randon cropping of the image (the cropping area is picked at random)
crop_to_original_ratio
=
0.5
# The scale of the cropped area to the original image
new_size
=
int
(
crop_to_original_ratio
*
image
.
shape
[
0
])
cropped
=
tf
.
image
.
random_crop
(
image
,
size
=
[
new_size
,
new_size
,
3
])
visualize
(
image
,
cropped
,
'randomly cropped image'
)
# Center cropping of the image (the cropping area is at the center)
central_fraction
=
0.6
# The scale of the cropped area to the original image
center_cropped
=
tf
.
image
.
central_crop
(
image
,
central_fraction
=
central_fraction
)
visualize
(
image
,
center_cropped
,
'centrally cropped image'
)
\ No newline at end of file
codes/python/
2-
basics_in_machine_learning/linear_regression/README.rst
→
codes/python/basics_in_machine_learning/linear_regression/README.rst
浏览文件 @
c919445c
文件已移动
codes/python/
2-
basics_in_machine_learning/linear_regression/code/linear_regression.py
→
codes/python/basics_in_machine_learning/linear_regression/code/linear_regression.py
浏览文件 @
c919445c
文件已移动
codes/python/
2-
basics_in_machine_learning/linear_regression/updating_model.gif
→
codes/python/basics_in_machine_learning/linear_regression/updating_model.gif
浏览文件 @
c919445c
文件已移动
codes/python/
2-
basics_in_machine_learning/linear_svm/README.rst
→
codes/python/basics_in_machine_learning/linear_svm/README.rst
浏览文件 @
c919445c
文件已移动
codes/python/
2-
basics_in_machine_learning/linear_svm/code/linear_svm.py
→
codes/python/basics_in_machine_learning/linear_svm/code/linear_svm.py
浏览文件 @
c919445c
文件已移动
codes/python/
2-
basics_in_machine_learning/logistic_regression/README.rst
→
codes/python/basics_in_machine_learning/logistic_regression/README.rst
浏览文件 @
c919445c
文件已移动
codes/python/
2-
basics_in_machine_learning/logistic_regression/code/logistic_regression.py
→
codes/python/basics_in_machine_learning/logistic_regression/code/logistic_regression.py
浏览文件 @
c919445c
文件已移动
codes/python/
2-
basics_in_machine_learning/multiclass_svm/README.rst
→
codes/python/basics_in_machine_learning/multiclass_svm/README.rst
浏览文件 @
c919445c
文件已移动
codes/python/
2-
basics_in_machine_learning/multiclass_svm/code/multiclass_svm.py
→
codes/python/basics_in_machine_learning/multiclass_svm/code/multiclass_svm.py
浏览文件 @
c919445c
文件已移动
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录