Notice
Recent Posts
Recent Comments
Link
반응형
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | ||||
4 | 5 | 6 | 7 | 8 | 9 | 10 |
11 | 12 | 13 | 14 | 15 | 16 | 17 |
18 | 19 | 20 | 21 | 22 | 23 | 24 |
25 | 26 | 27 | 28 | 29 | 30 | 31 |
Tags
- 머신러닝
- 오픽
- C언어
- 프로그래밍
- 석사
- 파이썬gui
- 4차산업
- ComputerVision
- 초보영어
- 영어공부
- 특수대학원
- coding
- 직장인
- 코딩
- 딥러닝
- Vision
- opencv
- 산업대학원
- 영어회화
- 대학원
- 파이썬
- 영어
- machinevision
- 인공지능
- 동사
- 영어기초
- 머신비전
- Python
- Ai
- 3dprinter
Archives
- Today
- Total
미래기술연구소
[패스트캠퍼스 수강 후기] 컴퓨터비전인강 100% 환급 챌린지 37 회차 본문
728x90
반응형
황박사님.. 벌써 37일 연속으로 뵙습니다
이제 친근하네요
이 코드들을 현업에 그대로 복붙해볼 생각이다
이미지 전처리 부터 해야되는데
이 부분에 대해서는....... 다른 블로그 눈팅좀 하고...........
def _bytes_feature(value):
"""Returns a bytes_list from a string / byte."""
if isinstance(value, type(tf.constant(0))):
value = value.numpy() # BytesList won't unpack a string from an EagerTensor.
return tf.train.Feature(bytes_list=tf.train.BytesList(value=[value]))
S
def _int64_feature(value):
"""Returns an int64_list from a bool / enum / int / uint."""
return tf.train.Feature(int64_list=tf.train.Int64List(value=[value]))
def image_example(image_string, label):
image_shape = tf.image.decode_image(image_string).shape
feature = {
'height': _int64_feature(image_shape[0]),
'width': _int64_feature(image_shape[1]),
'depth': _int64_feature(image_shape[2]),
'label': _int64_feature(label),
'image_raw': _bytes_feature(image_string),
}
return tf.train.Example(features=tf.train.Features(feature=feature))
if os.path.exists(TFRECORD_PATH) is False:
os.mkdir(TFRECORD_PATH)
num_tfrecords = len(file_list) // IMAGE_PER_TFRECORD
if len(file_list) % IMAGE_PER_TFRECORD != 0:
num_tfrecords += 1
for idx in range(num_tfrecords):
idx0 = idx * IMAGE_PER_TFRECORD
idx1 = idx0 + IMAGE_PER_TFRECORD
record_file = TFRECORD_PATH + '%05d.tfrecords' % idx
with tf.io.TFRecordWriter(record_file) as writer:
for filename, label in zip(file_list[idx0:idx1],
label_list[idx0:idx1]):
image_string = open(filename, 'rb').read()
tf_example = image_example(image_string, label)
writer.write(tf_example.SerializeToString())
728x90
반응형
'etc > FastCampus 챌린지' 카테고리의 다른 글
[패스트캠퍼스 수강 후기] 컴퓨터비전인강 100% 환급 챌린지 39 회차 (0) | 2020.11.26 |
---|---|
[패스트캠퍼스 수강 후기] 컴퓨터비전인강 100% 환급 챌린지 38 회차 (0) | 2020.11.25 |
[패스트캠퍼스 수강 후기] 컴퓨터비전인강 100% 환급 챌린지 36 회차 (0) | 2020.11.23 |
[패스트캠퍼스 수강 후기] 컴퓨터비전인강 100% 환급 챌린지 35 회차 (0) | 2020.11.22 |
[패스트캠퍼스 수강 후기] 컴퓨터비전인강 100% 환급 챌린지 34 회차 (0) | 2020.11.21 |