변환하기 힘들다 ㅠㅠ

실행해보니 pb나 tflite 를 읽어서 시각화 하는데

tensorboard랑 비슷하다고 해야하나 다르다고 하나.. 보이는 방식은 가로로(tensroboard) 세로로(netron) 보이는 차이인것 같기도 하고..

다만 버전정보가 똭 보이는건 편하네..

그리고 tensorboard보다는 빠른 느낌이다.

 

[링크 : https://devinlife.com/tensorflow%20lite/tflite-simple-regression/]

[링크 : https://github.com/lutzroeder/netron]

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

tensorflowlite build  (0) 2021.01.28
pb to tflite 변환 part 2...  (0) 2021.01.27
pb to tflite, tensorboard  (0) 2021.01.26
tensorflow pb to tflite  (0) 2021.01.25
텐서플로우 - detection과 classification  (0) 2021.01.22
Posted by 구차니

tensorboard

먼가 복잡하게 나오는데 보는법을 모르겠다? ㅠㅠ

[링크 : https://urbangy.tistory.com/38]

[링크 : https://eehoeskrap.tistory.com/322]

 

pb to tflite

영... 실패중.. ㅠㅠ

[링크 : https://github.com/tensorflow/tensorflow/issues/46285]

 

$ python3 /home/minimonk/src/tensorflow/tensorflow/lite/python/tflite_convert.py --saved_model_dir=./saved_model --output_file=output.tflite
2021-01-26 19:01:39.223104: W tensorflow/stream_executor/platform/default/dso_loader.cc:60] Could not load dynamic library 'libcudart.so.11.0'; dlerror: libcudart.so.11.0: cannot open shared object file: No such file or directory
2021-01-26 19:01:39.223142: I tensorflow/stream_executor/cuda/cudart_stub.cc:29] Ignore above cudart dlerror if you do not have a GPU set up on your machine.
2021-01-26 19:01:41.278842: I tensorflow/compiler/jit/xla_cpu_device.cc:41] Not creating XLA devices, tf_xla_enable_xla_devices not set
2021-01-26 19:01:41.279042: W tensorflow/stream_executor/platform/default/dso_loader.cc:60] Could not load dynamic library 'libcuda.so.1'; dlerror: libcuda.so.1: cannot open shared object file: No such file or directory
2021-01-26 19:01:41.279063: W tensorflow/stream_executor/cuda/cuda_driver.cc:326] failed call to cuInit: UNKNOWN ERROR (303)
2021-01-26 19:01:41.279101: I tensorflow/stream_executor/cuda/cuda_diagnostics.cc:156] kernel driver does not appear to be running on this host (mini2760p): /proc/driver/nvidia/version does not exist
2021-01-26 19:01:41.279527: I tensorflow/compiler/jit/xla_gpu_device.cc:99] Not creating XLA devices, tf_xla_enable_xla_devices not set
2021-01-26 19:01:55.229040: W tensorflow/compiler/mlir/lite/python/tf_tfl_flatbuffer_helpers.cc:316] Ignored output_format.
2021-01-26 19:01:55.229092: W tensorflow/compiler/mlir/lite/python/tf_tfl_flatbuffer_helpers.cc:319] Ignored drop_control_dependency.
2021-01-26 19:01:55.229117: W tensorflow/compiler/mlir/lite/python/tf_tfl_flatbuffer_helpers.cc:325] Ignored change_concat_input_ranges.
2021-01-26 19:01:55.230250: I tensorflow/cc/saved_model/reader.cc:32] Reading SavedModel from: ./saved_model
2021-01-26 19:01:55.349428: I tensorflow/cc/saved_model/reader.cc:55] Reading meta graph with tags { serve }
2021-01-26 19:01:55.349498: I tensorflow/cc/saved_model/reader.cc:93] Reading SavedModel debug info (if present) from: ./saved_model
2021-01-26 19:01:55.349576: I tensorflow/compiler/jit/xla_gpu_device.cc:99] Not creating XLA devices, tf_xla_enable_xla_devices not set
2021-01-26 19:01:55.676408: I tensorflow/compiler/mlir/mlir_graph_optimization_pass.cc:196] None of the MLIR optimization passes are enabled (registered 0 passes)
2021-01-26 19:01:55.748285: I tensorflow/cc/saved_model/loader.cc:206] Restoring SavedModel bundle.
2021-01-26 19:01:55.826459: I tensorflow/core/platform/profile_utils/cpu_utils.cc:112] CPU Frequency: 2494460000 Hz
2021-01-26 19:01:56.738523: I tensorflow/cc/saved_model/loader.cc:190] Running initialization op on SavedModel bundle at path: ./saved_model
2021-01-26 19:01:57.100034: I tensorflow/cc/saved_model/loader.cc:277] SavedModel load for tags { serve }; Status: success: OK. Took 1869785 microseconds.
2021-01-26 19:01:58.857435: I tensorflow/compiler/mlir/tensorflow/utils/dump_mlir_util.cc:194] disabling MLIR crash reproducer, set env var `MLIR_CRASH_REPRODUCER_DIRECTORY` to enable.
2021-01-26 19:01:59.851936: I tensorflow/compiler/jit/xla_gpu_device.cc:99] Not creating XLA devices, tf_xla_enable_xla_devices not set
loc(callsite(callsite("Postprocessor/BatchMultiClassNonMaxSuppression/MultiClassNonMaxSuppression/SortByField_1/Size@__inference_call_func_10155" at "StatefulPartitionedCall@__inference_signature_wrapper_11818") at "StatefulPartitionedCall")): error: 'tf.Size' op is neither a custom op nor a flex op
error: failed while converting: 'main': Ops that can be supported by the flex runtime (enabled via setting the -emit-select-tf-ops flag):
	tf.Size {device = ""}
Traceback (most recent call last):
  File "/home/minimonk/.local/lib/python3.8/site-packages/tensorflow/lite/python/convert.py", line 210, in toco_convert_protos
    model_str = wrap_toco.wrapped_toco_convert(model_flags_str,
  File "/home/minimonk/.local/lib/python3.8/site-packages/tensorflow/lite/python/wrap_toco.py", line 32, in wrapped_toco_convert
    return _pywrap_toco_api.TocoConvert(
Exception: <unknown>:0: error: loc(callsite(callsite("Postprocessor/BatchMultiClassNonMaxSuppression/MultiClassNonMaxSuppression/SortByField_1/Size@__inference_call_func_10155" at "StatefulPartitionedCall@__inference_signature_wrapper_11818") at "StatefulPartitionedCall")): 'tf.Size' op is neither a custom op nor a flex op
<unknown>:0: note: loc("StatefulPartitionedCall"): called from
<unknown>:0: error: failed while converting: 'main': Ops that can be supported by the flex runtime (enabled via setting the -emit-select-tf-ops flag):
	tf.Size {device = ""}


During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/minimonk/src/tensorflow/tensorflow/lite/python/tflite_convert.py", line 698, in <module>
    main()
  File "/home/minimonk/src/tensorflow/tensorflow/lite/python/tflite_convert.py", line 694, in main
    app.run(main=run_main, argv=sys.argv[:1])
  File "/home/minimonk/.local/lib/python3.8/site-packages/tensorflow/python/platform/app.py", line 40, in run
    _run(main=main, argv=argv, flags_parser=_parse_flags_tolerate_undef)
  File "/home/minimonk/.local/lib/python3.8/site-packages/absl/app.py", line 303, in run
    _run_main(main, args)
  File "/home/minimonk/.local/lib/python3.8/site-packages/absl/app.py", line 251, in _run_main
    sys.exit(main(argv))
  File "/home/minimonk/src/tensorflow/tensorflow/lite/python/tflite_convert.py", line 677, in run_main
    _convert_tf2_model(tflite_flags)
  File "/home/minimonk/src/tensorflow/tensorflow/lite/python/tflite_convert.py", line 265, in _convert_tf2_model
    tflite_model = converter.convert()
  File "/home/minimonk/.local/lib/python3.8/site-packages/tensorflow/lite/python/lite.py", line 739, in convert
    result = _convert_saved_model(**converter_kwargs)
  File "/home/minimonk/.local/lib/python3.8/site-packages/tensorflow/lite/python/convert.py", line 632, in convert_saved_model
    data = toco_convert_protos(
  File "/home/minimonk/.local/lib/python3.8/site-packages/tensorflow/lite/python/convert.py", line 216, in toco_convert_protos
    raise ConverterError(str(e))
tensorflow.lite.python.convert.ConverterError: <unknown>:0: error: loc(callsite(callsite("Postprocessor/BatchMultiClassNonMaxSuppression/MultiClassNonMaxSuppression/SortByField_1/Size@__inference_call_func_10155" at "StatefulPartitionedCall@__inference_signature_wrapper_11818") at "StatefulPartitionedCall")): 'tf.Size' op is neither a custom op nor a flex op
<unknown>:0: note: loc("StatefulPartitionedCall"): called from
<unknown>:0: error: failed while converting: 'main': Ops that can be supported by the flex runtime (enabled via setting the -emit-select-tf-ops flag):
	tf.Size {device = ""}

 

[링크 : https://bekusib.tistory.com/210]

[링크 : https://bugloss-chestnut.tistory.com/entry/Tensorflow-keras-h5-pb-tflite-변환-오류python]

[링크 : https://gmground.tistory.com/entry/학습된-모델을-TensorFlow-Lite-모델tflite로-변환하여-Android에서-Object-Classification-해보기]

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

pb to tflite 변환 part 2...  (0) 2021.01.27
tensorflow netron  (0) 2021.01.27
tensorflow pb to tflite  (0) 2021.01.25
텐서플로우 - detection과 classification  (0) 2021.01.22
텐서플로우 모델 출력? (metadata?)  (0) 2021.01.21
Posted by 구차니

saved_model 디렉토리 전체가 필요하군..

단순하게 pb2만 있으면 되는게 아니군아..

 

Converting a SavedModel
tflite_convert \
  --saved_model_dir=/tmp/mobilenet_saved_model \
  --output_file=/tmp/mobilenet.tflite

Converting a Keras H5 model
tflite_convert \
  --keras_model_file=/tmp/mobilenet_keras_model.h5 \
  --output_file=/tmp/mobilenet.tflite

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

[링크 : https://stackoverflow.com/questions/52918051/how-to-convert-pb-to-tflite-format]

Posted by 구차니
프로그램 사용/gcc2021. 1. 24. 11:24

오늘도 어김없이(?) 노인학대 옵션 찾는중

3.19.59 x86 Options
These ‘-m’ options are defined for the x86 family of computers.

-march=cpu-type
‘sandybridge’
Intel Sandy Bridge CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, AVX, AES and PCLMUL instruction set support.

[링크 : https://gcc.gnu.org/onlinedocs/gcc/x86-Options.html]

 

+

그래도 tensorflow 빌드 해서 실행하는데 속도에 유의미한 영향을 주진 않네

이런 라즈베리 파이 만도 못한 내 노트북 ㅠㅠㅠㅠ

(라즈베리 4코어 + neon 가속시  170ms 정도, i5-2520m 에서 1300ms ㅠㅠ)

Posted by 구차니

detection은 객체의 종류와 확률 그리고 "위치"를 얻는다면

[링크 : https://www.tensorflow.org/lite/models/object_detection/overview]

 

classification은 객체의 종류와 확률 만을 결과로 얻는다.

[링크 : https://www.tensorflow.org/lite/models/image_classification/overview]

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

pb to tflite, tensorboard  (0) 2021.01.26
tensorflow pb to tflite  (0) 2021.01.25
텐서플로우 모델 출력? (metadata?)  (0) 2021.01.21
tensorflow 객체 탐지 예제  (0) 2021.01.21
tensorflow lite on x86 / label_image  (0) 2021.01.20
Posted by 구차니

+ 2021.01.22

다시 정리하고 와서 보니

위에는 classification tflite 파일이고 아래는 detection 이니 차이가 나는 듯.

 

+

tflite 파일 vi로 보니 문자열들이 좀 보이는데, python 써서 출력이 가능하려나?

[링크 : https://www.tensorflow.org/lite/convert/metadata]

 

---

output_tensor_metadata 에서

name:probability 라는게 있는데

[링크 : https://tfhub.dev/google/lite-model/aiy/vision/classifier/food_V1/1]

[링크 : https://tfhub.dev/google/lite-model/cropnet/classifier/cassava_disease_V1/1]

 

다른 tfilte 파일에서 보니

output_tensor_groups 라는게 존재해서 tensor_names로 3개의 출력이 존재하고

output_tensor_metadata 에 name:location, name:category, name:score 가 존재한다.

[링크 : https://tfhub.dev/google/lite-model/object_detection/mobile_object_localizer_v1/1/metadata/2]

 

출력에서 여러개 출력을 내는건.. 해당 프로젝트에서 사용하는 tflite 파일이 그렇게 생성 되었기 때문인건가?

Output Signature
The model outputs four arrays, mapped to the indices 0-4. Arrays 0, 1, and 2 describe N detected objects, with one element in each array corresponding to each object.

[링크 : https://www.tensorflow.org/lite/models/object_detection/overview]

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

tensorflow pb to tflite  (0) 2021.01.25
텐서플로우 - detection과 classification  (0) 2021.01.22
tensorflow 객체 탐지 예제  (0) 2021.01.21
tensorflow lite on x86 / label_image  (0) 2021.01.20
tensorflow-lite 모델  (0) 2021.01.18
Posted by 구차니
Posted by 구차니
프로그램 사용/vi2021. 1. 20. 11:07

vimdiff 시에 다른 부분의 글씨가 안보여서 다른 색상을 찾는데

blue / darkblue / default / delek / desert / elflord / evening / industry / koehler / morning / murphy

pablo / peachpuff / ron / shine / slate / torte / zellner

정도가 있는데 좀 찾아봐야 할 듯.. 몇개는 너무 칙칙하고 몇개는 너무 눈 아프고 ㅠㅠ

 

colorscheme <TAB>

[링크 : https://stackoverflow.com/questions/7331940/how-to-get-the-list-of-all-installed-color-schemes-in-vim]

 

+

개인적으로 torte가 가장 무난한듯.

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

vi 이전 위치 다음 위치로 이동하기  (0) 2022.08.04
vi가 늦게 켜지는 이유  (0) 2022.07.28
vi 에서 매칭되는 갯수 확인하기  (0) 2019.12.18
vi gg=G와 set ts  (0) 2019.07.04
vi 검색 취소하기  (0) 2019.06.04
Posted by 구차니

cmake 시에 -D 플래그로 옵션을 활성화 가능한데

그 플래그 목록을 확인하는 cmake 옵션은 -LA

$ cmake -LAH

 

openCV-4.5.1 에서 하다 보니 무조건 다른 디렉토리에서 빌드 하라고 나오는지라

한번은 cmake 하고 ccmake로 볼 수 있는건지 확인이 좀 필요할 듯.

sudo apt-get install cmake-curses-gui
ccmake ..

[링크 : https://stackoverflow.com/questions/16851084/how-to-list-all-cmake-build-options-and-their-default-values]

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

make 조건식  (0) 2023.08.16
cmake ninja, cmake 옵션주기  (0) 2022.12.07
cmake 빌드 에러시  (0) 2021.01.19
make order  (0) 2016.06.16
make /bin/sh: 1: pushd: not found 에러  (0) 2016.06.08
Posted by 구차니