01-10 08:57
벤치마킹
Notice
Recent Posts
Recent Comments
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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
- 가족소고기외식
- 아이혼자다녀옴
- 푸르지오포레피스
- 에어아시아
- 중학교입학수학문제
- 검색완료
- 파이썬
- 양양솔비치조식
- 결항
- 고마워다음
- 양양솔비치아침
- 영통외식
- 양양솔비치세프스키친
- 커피
- 양양솔비치 뷔페
- 결항전문
- 싱가폴중학교수학문제
- DFS
- 사진에서 글자추출
- 커피쏟음
- 편도수술
- 영통칠프로칠백식당
- 영통역소고기
- 주차넉넉
- 홍시스무디
- 당근마켓중고차
- 사진문자추출
- 사진문자추출하기
- 오트눈썰매장
- 종이캐리어
Archives
- Today
- Total
너와나의 관심사
tensorflow lite 로 personalization on-devcie 본문
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 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 | import tensorflow as tf from tensorflow.keras import layers from tensorflow.keras.regularizers import l2 from tfltransfer import bases from tfltransfer import heads from tfltransfer import optimizers from tfltransfer.tflite_transfer_converter import TFLiteTransferConverter import tensorflow.keras.backend as K #tf.compat.v1.disable_v2_behavior() #tf.compat.v1.disable_eager_execution() #tf.compat.v1.disable_eager_execution() #tf.compat.v1.disable_v2_behavior() #tf.compat.v1.enable_eager_execution() #tf.disable_v2_behavior() DEFAULT_BATCH_SIZE = 32 input_size = 224 output_size = 5 DEFAULT_INPUT_SIZE = 64 DEFAULT_BATCH_SIZE = 128 LEARNING_RATE = 0.001 ''' batch_size = DEFAULT_BATCH_SIZE base = bases.MobileNetV2Base(image_size=input_size) head = heads.SoftmaxClassifierHead(batch_size, base.bottleneck_shape(), output_size) optimizer = optimizers.SGD(LEARNING_RATE) converter = TFLiteTransferConverter( output_size, base, head, optimizer, batch_size) models = converter.convert_and_save('custom_keras_model') #parameter_shapes = [(7 * 7 * 1280, output_size), (output_size,)] ''' def test_mobilenet_v2_saved_model(): input_size = DEFAULT_INPUT_SIZE output_size = 4 base = bases.MobileNetV2Base(image_size=input_size) head_model = tf.keras.Sequential([ layers.Flatten(input_shape=(7, 7, 1280)), layers.Dropout(0.25), layers.Dense( units=32, activation='relu', kernel_regularizer=l2(0.01), bias_regularizer=l2(0.01)), layers.Dropout(0.25), layers.Dense( units=32, activation='relu', kernel_regularizer=l2(0.01), bias_regularizer=l2(0.01)), layers.Dense( units=4, activation='softmax', kernel_regularizer=l2(0.01), bias_regularizer=l2(0.01)), ]) head_model.compile(loss="categorical_crossentropy", optimizer="sgd") #head_model.compile(loss='categorical_crossentropy', optimizer='sgd') converter = TFLiteTransferConverter( output_size, base, heads.KerasModelHead(head_model), optimizers.SGD(LEARNING_RATE), DEFAULT_BATCH_SIZE) models = converter.convert_and_save('custom_keras_model_second') models = converter._convert() test_mobilenet_v2_saved_model() | cs |
Comments