프로그램 사용/minicom2021. 1. 28. 14:56

minicom 으로 실행하면 폭이 늘어나지 않고 창도 안커지는데(putty)

아래와 같이 하면 창을 늘리면 같이 늘어난다.

 

$ TERM=linux minicom

[링크 : https://unix.stackexchange.com/questions/106644/how-to-change-the-width-of-remote-serial-console]

 

+물론 시리얼로 접속해서는 화면은 늘어나도 실제로 콘솔 영향을 받는지

더 위아래로 길게 나오진 않는다 ㅠㅠ

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

minicom lf에 cr 붙이기  (0) 2023.01.05
minicom 16진수로 보기  (0) 2022.08.25
minicom 로그 저장하기  (0) 2021.09.16
minicom timestamp  (0) 2021.09.16
/dev/tty 를 sudo 쓰지 않고 사용하기  (0) 2020.09.24
Posted by 구차니

with_select_tf_ops 라는 옵션이 보이는데

*.cc 파일들 상에서 해당 디파인으로 뒤져도 안나오고 py 쪽으로만 보이는데..

헛짚은건가?  ㅠㅠ

bazel build --config=monolithic --define=with_select_tf_ops=true -c opt //tensorflow/lite:libtensorflowlite.so

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

Posted by 구차니

tf.size() tflite 호환 연산자 목록에 없긴한데

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

 

tf.size()는... tflite 지원인지 아닌지 말이 없네?

[링크 : https://www.tensorflow.org/api_docs/python/tf/size?hl=ko]

 

하라는 대로 하니 변환은 되었다?

아무래도 tflite_convert에는 없는 SELECT_TF_OPS 같은게 있어서 그런가?

import tensorflow as tf

converter = tf.lite.TFLiteConverter.from_saved_model(saved_model_dir)
converter.target_spec.supported_ops = [
  tf.lite.OpsSet.TFLITE_BUILTINS, # enable TensorFlow Lite ops.
  tf.lite.OpsSet.SELECT_TF_OPS # enable TensorFlow ops.
]
tflite_model = converter.convert()
open("converted_model.tflite", "wb").write(tflite_model)

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

  [링크 : https://stackoverflow.com/questions/53824223/what-does-flex-op-mean-in-tensorflow]

 

일단은 먼진 몰라도 그냥 pb가 있는거 대충 받는 링크

[링크 : https://tfhub.dev/tensorflow/ssd_mobilenet_v2/2]

[링크 : https://tfhub.dev/tensorflow/retinanet/resnet101_v1_fpn_1024x1024/1]

 

tflite-converter.py 에서 뒤져보니 아래와 같은 옵션을 주어야 작동하는건가..?

  if flags.experimental_select_user_tf_ops:
    if lite.OpsSet.SELECT_TF_OPS not in converter.target_spec.supported_ops:
      raise ValueError("--experimental_select_user_tf_ops can only be set if "
                       "--target_ops contains SELECT_TF_OPS.")

 

+

변환한 파일을 실행하니 죽는다 -_ㅠ overflowed.. 무시무시한 에러인데?

$ ./label_image -i 2012060407491899196_l.jpg -m test.tflite 
INFO: Loaded model go.tflite
INFO: resolved reporter
ERROR: tensorflow/lite/core/subgraph.cc BytesRequired number of elements overflowed.

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

Posted by 구차니

변환하기 힘들다 ㅠㅠ

실행해보니 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 구차니