'프로그램 사용/yolo_tensorflow'에 해당되는 글 107건

  1. 2021.04.08 tensorboard 사용법
  2. 2021.04.07 ssd mobilnetv2 to tflite warnings
  3. 2021.04.07 ssd mobilenetv2 python load pb, tflite
  4. 2021.04.06 representative_dataset
  5. 2021.04.02 tflite run
  6. 2021.04.02 tensorflow image input
  7. 2021.04.02 ssd model pb to tflite with quantization
  8. 2021.04.02 tensorflow quantization
  9. 2021.04.01 tensorflow lite
  10. 2021.03.04 tensorflow 양자화

 

$ wget https://raw.githubusercontent.com/tensorflow/tensorflow/master/tensorflow/python/tools/import_pb_to_tensorboard.py
$ python3 import_pb_to_tensorboard.py --model_dir ./ --log_dir ./tensorboard
$ tensorboard --logdir ./tensorboard

[링크 : https://aciddust.github.io/blog/post/Tensorflow-pb파일-TensorBoard에-올리기/]

[링크 : https://raw.githubusercontent.com/tensorflow/tensorflow/master/tensorflow/python/tools/import_pb_to_tensorboard.py]

'프로그램 사용 > yolo_tensorflow' 카테고리의 다른 글

labelImg  (0) 2021.04.09
tf docker  (0) 2021.04.09
ssd mobilnetv2 to tflite warnings  (0) 2021.04.07
ssd mobilenetv2 python load pb, tflite  (0) 2021.04.07
representative_dataset  (0) 2021.04.06
Posted by 구차니

 

 

INFO:tensorflow:depth of additional conv before box predictor: 0
I0407 19:04:11.848860 140671031727936 convolutional_keras_box_predictor.py:153] depth of additional conv before box predictor: 0
INFO:tensorflow:depth of additional conv before box predictor: 0
I0407 19:04:11.849254 140671031727936 convolutional_keras_box_predictor.py:153] depth of additional conv before box predictor: 0
INFO:tensorflow:depth of additional conv before box predictor: 0
I0407 19:04:11.849459 140671031727936 convolutional_keras_box_predictor.py:153] depth of additional conv before box predictor: 0
INFO:tensorflow:depth of additional conv before box predictor: 0
I0407 19:04:11.849658 140671031727936 convolutional_keras_box_predictor.py:153] depth of additional conv before box predictor: 0
INFO:tensorflow:depth of additional conv before box predictor: 0
I0407 19:04:11.849853 140671031727936 convolutional_keras_box_predictor.py:153] depth of additional conv before box predictor: 0
INFO:tensorflow:depth of additional conv before box predictor: 0
I0407 19:04:11.850045 140671031727936 convolutional_keras_box_predictor.py:153] depth of additional conv before box predictor: 0

WARNING:tensorflow:Skipping full serialization of Keras layer <object_detection.meta_architectures.ssd_meta_arch.SSDMetaArch object at 0x7ff0245f8880>, because it is not built.
W0407 19:04:15.019573 140671031727936 save_impl.py:77] Skipping full serialization of Keras layer <object_detection.meta_architectures.ssd_meta_arch.SSDMetaArch object at 0x7ff0245f8880>, because it is not built.
2021-04-07 19:04:26.913764: W tensorflow/python/util/util.cc:348] Sets are not currently considered sequences, but this may change in the future, so consider avoiding using them.

W0407 19:04:44.291487 140671031727936 save.py:236] Found untraced functions such as BoxPredictor_layer_call_and_return_conditional_losses, BoxPredictor_layer_call_fn, BoxPredictor_layer_call_fn, BoxPredictor_layer_call_and_return_conditional_losses, BoxPredictor_layer_call_and_return_conditional_losses while saving (showing 5 of 125). These functions will not be directly callable after loading.
W0407 19:04:45.480654 140671031727936 save.py:236] Found untraced functions such as BoxPredictor_layer_call_and_return_conditional_losses, BoxPredictor_layer_call_fn, BoxPredictor_layer_call_fn, BoxPredictor_layer_call_and_return_conditional_losses, BoxPredictor_layer_call_and_return_conditional_losses while saving (showing 5 of 125). These functions will not be directly callable after loading.

'프로그램 사용 > yolo_tensorflow' 카테고리의 다른 글

tf docker  (0) 2021.04.09
tensorboard 사용법  (0) 2021.04.08
ssd mobilenetv2 python load pb, tflite  (0) 2021.04.07
representative_dataset  (0) 2021.04.06
tflite run  (0) 2021.04.02
Posted by 구차니

'프로그램 사용 > yolo_tensorflow' 카테고리의 다른 글

tensorboard 사용법  (0) 2021.04.08
ssd mobilnetv2 to tflite warnings  (0) 2021.04.07
representative_dataset  (0) 2021.04.06
tflite run  (0) 2021.04.02
tensorflow image input  (0) 2021.04.02
Posted by 구차니

이미지를 다 불러와서 때려박으나 ramdom 값을 때려박으나 차이가 없네..

도대체 멀까?

 

import cv2
import glob
import numpy as np
import tensorflow as tf

NORM_H=300
NORM_W=300
filename = glob.glob("/home/minimonk/src/SSD-MobileNet-TF/images/train/*.jpg")
images = []

for i in filename:
	img = cv2.imread(i)
	img = cv2.resize(img, (NORM_H, NORM_W))
	img = img / 255.0
	img = img.astype(np.float32)
	images.append(img)
	
for data in tf.data.Dataset.from_tensor_slices((images)).batch(1).take(len(filename)):
    yield [data.astype(tf.float32)]

[링크 : https://stackoverflow.com/questions/3207219/] path

[링크 : https://stackoverflow.com/questions/57877959/] example

 

[링크 : https://tech.ssut.me/what-does-the-yield-keyword-do-in-python/]

[링크 : https://engineer-mole.tistory.com/85]

 

+

[링크 : https://www.tensorflow.org/api_docs/python/tf/data/Dataset]

 

+

2021.04.07

[링크 : https://stackoverflow.com/questions/64795017/]

'프로그램 사용 > yolo_tensorflow' 카테고리의 다른 글

ssd mobilnetv2 to tflite warnings  (0) 2021.04.07
ssd mobilenetv2 python load pb, tflite  (0) 2021.04.07
tflite run  (0) 2021.04.02
tensorflow image input  (0) 2021.04.02
ssd model pb to tflite with quantization  (0) 2021.04.02
Posted by 구차니

엄밀하게는 tensorflow 전체에 대해서

모델 읽어 들이고 반복실행 부분을 찾는 중.

 

 

[링크 : http://stackoverflow.com/questions/65351046/how-to-feed-multiple-inputs-tflite-model-in-python-interpreter]

[링크 : http://www.tensorflow.org/lite/guide/inference#load_and_run_a_model_in_python]

 

'프로그램 사용 > yolo_tensorflow' 카테고리의 다른 글

ssd mobilenetv2 python load pb, tflite  (0) 2021.04.07
representative_dataset  (0) 2021.04.06
tensorflow image input  (0) 2021.04.02
ssd model pb to tflite with quantization  (0) 2021.04.02
tensorflow quantization  (0) 2021.04.02
Posted by 구차니

'프로그램 사용 > yolo_tensorflow' 카테고리의 다른 글

representative_dataset  (0) 2021.04.06
tflite run  (0) 2021.04.02
ssd model pb to tflite with quantization  (0) 2021.04.02
tensorflow quantization  (0) 2021.04.02
tensorflow lite  (0) 2021.04.01
Posted by 구차니

와... int8과 uint8 차이로

input_tensor 주소 받는게 안되다니!!

 

memcpy(interpreter->typed_input_tensor<uchar>(0), image.data, image.total() * image.elemSize());
memcpy(interpreter->typed_input_tensor<float>(0), image.data, image.total() * image.elemSize());

'프로그램 사용 > yolo_tensorflow' 카테고리의 다른 글

tflite run  (0) 2021.04.02
tensorflow image input  (0) 2021.04.02
tensorflow quantization  (0) 2021.04.02
tensorflow lite  (0) 2021.04.01
tensorflow 양자화  (0) 2021.03.04
Posted by 구차니

비슷한 제목에 다른 내용..

 

quantization은 현재로서는.. pb 에서 tflite로 변환할때 적용이 가능하고

tflite/float32로 변환된걸 unit8로 다시 한번 변환이 가능한진 모르겠다.

 

[링크 : https://www.tensorflow.org/lite/performance/post_training_quantization]

[링크 : https://www.tensorflow.org/lite/performance/post_training_integer_quant]

Posted by 구차니

원인 불명의 segmentation fault가 떠서 보니..

입력 tflite 파일이 바뀌었고

input이 uint8에서 float32로 바뀌어서 그런가 하고 바꾸어보니 문제없이 작동한다.

 

memcpy(interpreter->typed_input_tensor<uchar>(0), image.data, image.total() * image.elemSize());
memcpy(interpreter->typed_input_tensor<float>(0), image.data, image.total() * image.elemSize());

 

typed_input_tensor

T * typed_input_tensor(
  int index
)
Return a mutable pointer into the data of a given input tensor.

The given index must be between 0 and inputs().size().

[링크 : https://www.tensorflow.org/lite/api_docs/cc/class/tflite/interpreter]

 

+

학습이 잘못되었나..

둘다 num_classes가 90으로 동일하다.. COCO 90개를 기반으로 추가 학습을 했으면 더 늘어 나야 하는거 아닌가?

 

아래가 추가 학습한 내용.. quantized가 빠지고 use_regular_nms가 추가

아무튼 탐지는 하는데 이상한 숫자로 나오고(0번이던 91이든 나올줄 알았는데)

width도 개판으로 나와서 보니

기존은 이쁘게 0,1,2,3 순서라면

 

학습한 녀석은 3,2,1,0

 

그래서 width랑 label index가 이상하다고 느껴지는건가?

Posted by 구차니

inference_input_type과 interfence_output_type을 tf.int8로 지정해주면 양자화 해주는 듯

import tensorflow as tf
converter = tf.lite.TFLiteConverter.from_saved_model(saved_model_dir)
converter.optimizations = [tf.lite.Optimize.DEFAULT]
converter.representative_dataset = representative_dataset
converter.target_spec.supported_ops = [tf.lite.OpsSet.TFLITE_BUILTINS_INT8]
converter.inference_input_type = tf.int8  # or tf.uint8
converter.inference_output_type = tf.int8  # or tf.uint8
tflite_quant_model = converter.convert()

 

[링크 : https://www.tensorflow.org/lite/performance/post_training_quantization]

[링크 : https://www.tensorflow.org/lite/performance/post_training_integer_quant?hl=ko]

 

+

2021.03.31

import tensorflow as tf
import numpy as np

saved_model_dir="./"

#def representative_dataset():
#  for data in tf.data.Dataset.from_tensor_slices((images)).batch(1).take(100):
#    yield [data.astype(tf.float32)]

def representative_dataset():
    for _ in range(100):
      data = np.random.rand(1, 244, 244, 3)
      yield [data.astype(np.float32)]

converter = tf.lite.TFLiteConverter.from_saved_model(saved_model_dir)
converter.optimizations = [tf.lite.Optimize.DEFAULT]
converter.representative_dataset = representative_dataset
converter.target_spec.supported_ops = [tf.lite.OpsSet.TFLITE_BUILTINS_INT8]
converter.inference_input_type = tf.int8  # or tf.uint8
converter.inference_output_type = tf.int8  # or tf.uint8
tflite_quant_model = converter.convert()
open("saved_model.tflite", "wb").write(tflite_quant_model)

[링크 : https://bugloss-chestnut.tistory.com/entry/Tensorflow-tflite를-Quantization양자화하기python]

 

도대체 왜 크기가 안 맞는다고 나올까..

다시보니.. 모델은 320x320 인데 244x244로 되어서 안 맞아서 그런듯.

Traceback (most recent call last):
  File "conv.sh", line 21, in <module>
    tflite_quant_model = converter.convert()
  File "/home/minimonk/.local/lib/python3.8/site-packages/tensorflow/lite/python/lite.py", line 742, in convert
    result = self._calibrate_quantize_model(result, **flags)
  File "/home/minimonk/.local/lib/python3.8/site-packages/tensorflow/lite/python/lite.py", line 459, in _calibrate_quantize_model
    return calibrate_quantize.calibrate_and_quantize(
  File "/home/minimonk/.local/lib/python3.8/site-packages/tensorflow/lite/python/optimize/calibrator.py", line 97, in calibrate_and_quantize
    self._calibrator.Prepare([list(s.shape) for s in sample])
RuntimeError: tensorflow/lite/kernels/reshape.cc:69 num_input_elements != num_output_elements (5136 != 7668)Node number 93 (RESHAPE) failed to prepare.

 

(1,320,320,3) 으로 바꾸니 5136에서 8136 으로 바뀌었다.

저 수식 어떻게 되어먹은거야?

RuntimeError: tensorflow/lite/kernels/reshape.cc:69 num_input_elements != num_output_elements (8136 != 7668)Node number 93 (RESHAPE) failed to prepare.

 

아무튼.. pipeline.config를 보니 300x300 이라 넘어는 가는데..

이건 또 무슨 에러냐..

RuntimeError: Quantization not yet supported for op: 'CUSTOM'.

 

Posted by 구차니