tensorflow lite 빌드는 묘하게 갈리는구나..

일단 static library는 bazel 도움 없이 스크립트, make로 빌드하게 되어있고

./tensorflow/lite/tools/make/download_dependencies.sh
./tensorflow/lite/tools/make/build_aarch64_lib.sh

 

so는 위의 스크립트로는 못하고 bazel의 도움을 받아야 빌드할 수 있는데

3단계. ARM64 바이너리 빌드하기
C 라이브러리
bazel build --config=elinux_aarch64 -c opt //tensorflow/lite/c:libtensorflowlite_c.so

C++ 라이브러리
bazel build --config=elinux_aarch64 -c opt //tensorflow/lite:libtensorflowlite.so

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

 

cross compile은 --config=를 통해서 지정이 가능하나, 특정 컴파일러를 쓰도록 지정은 어떻게 하는지 찾아봐야 겠다.

구글 페이지에는 elinux_aarch64만 보이는데 .bazelrc를 열어보니 elinux_armhf 도 존재한다(32bit?)

그리고 monolithic이 해결책일줄 알았는데.. 단일 so를 만드는 옵션일뿐.. select_tf_ops 랑은 상관이 없나보다..

# Embedded Linux options (experimental and only tested with TFLite build yet)
#     elinux:          General Embedded Linux options shared by all flavors.
#     elinux_aarch64:  Embedded Linux options for aarch64 (ARM64) CPU support.
#     elinux_armhf:    Embedded Linux options for armhf (ARMv7) CPU support.

# Other build options:
#     short_logs:       Only log errors during build, skip warnings.
#     verbose_logs:     Show all compiler warnings during build.
#     monolithic:       Build all TF C++ code into a single shared object.
#     dynamic_kernels:  Try to link all kernels dynamically (experimental).
#     libc++:           Link against libc++ instead of stdlibc++

 

 

Posted by 구차니
embeded/Cortex-M3 STM2021. 2. 2. 15:31

IWDG - Independent Watchdog

Note: The RTC, the IWDG, and the corresponding clock sources are not stopped by entering Stop or Standby mode.

 

 

클럭관련

High/Low speed External/Internal

HSE = high-speed external clock signal

HSI = high-speed internal clock signal

LSI = low-speed internal clock signal

LSE = low-speed external clock signal

 

APB1은 36MHz 클럭 최대, APB2는 72MHz 최대

다만 타이머쪽은 둘다 72MHz를 넣을 수 있다.

 

USART 번호가 없어서 모르겠지만 4.5Mbit/s 혹은 2.25Mbit/s 까지 설정이 가능하다는데

아니 USART를 Mbps 급으로 쓰는데가 있긴 한건가? ㄷㄷ

 

아 맞다.. 있긴 있었지.. -_-

2021/01/08 - [embeded] - orange pi r1+

 

 

'embeded > Cortex-M3 STM' 카테고리의 다른 글

STM32CubeIDE / HAL register callbacks  (0) 2021.02.03
STM32CubeIDE 주의사항(?)  (0) 2021.02.02
CMSIS for stm32  (0) 2018.02.12
stm32 DMA 관련글들  (0) 2017.12.11
cmsis printf  (0) 2017.01.10
Posted by 구차니
Linux2021. 2. 2. 14:16

윈도우에서는 winscard.h 와 dll을 통해서 지원이 가능한데

리눅스에서는 개인이 만든 라이브러리가 있는 듯?

pcscd 버전을 지원을 위해 적으라는 것을 봐서는

독립적으로 작동하진 않고 pcscd 데몬을 통해 통신을 하도록 구현 된 것으로 보인다.

[링크 : https://pcsclite.apdu.fr/]

'Linux' 카테고리의 다른 글

tar with pigz  (0) 2021.02.23
grep regexp match list  (0) 2021.02.22
linux smart card  (0) 2021.02.02
linux shared memory 확인 및 삭제  (0) 2021.01.22
linux 프레임 버퍼에 이미지, 동영상 재생하기  (0) 2021.01.21
Posted by 구차니
Linux2021. 2. 2. 12:35

2760p 노트북에 Smartcard 리더가 있으니 시도!

 

$ sudo apt-get install pcsc-tools pcscd

[링크 : https://wiki.archlinux.org/index.php/Smartcards]

 

pcscd 데몬이 없어서 생기는 문제

$ sudo pcsc_scan
SCardEstablishContext: Service not available.

 

카드 안 꼽고 실행하면 아래처럼 리더 종류만 나오고

$ pcsc_scan
Using reader plug'n play mechanism
Scanning present readers...
0: Alcor Micro AU9560 00 00
 
Tue Feb  2 12:41:04 2021
 Reader 0: Alcor Micro AU9560 00 00
  Event number: 1
  Card state: Card removed, 

 

카드 꽂으면 아래와 같이 카드의 ATR(먼지 모름!) 을 읽어서 어떤 카드인지 추측을 한다.

-n 옵션을 주면 어떤 카드인지 추측을 안하고 값만 출력 함.

$ pcsc_scan -n
Using reader plug'n play mechanism
Scanning present readers...
0: Alcor Micro AU9560 00 00
 
Tue Feb  2 12:42:17 2021
 Reader 0: Alcor Micro AU9560 00 00
  Event number: 2
  Card state: Card inserted, 
  ATR: 00 00 00 00 00 00 00 00 00 00 00 00

 

'Linux' 카테고리의 다른 글

grep regexp match list  (0) 2021.02.22
리눅스 스마트 카드 api  (0) 2021.02.02
linux shared memory 확인 및 삭제  (0) 2021.01.22
linux 프레임 버퍼에 이미지, 동영상 재생하기  (0) 2021.01.21
sit1 인터페이스  (0) 2021.01.20
Posted by 구차니
하드웨어2021. 2. 2. 12:27

half duplex 방식으로 통신

[링크 : https://en.wikipedia.org/wiki/ISO/IEC_7816]

[링크 : https://www.smartcardsupply.com/Content/Cards/7816standard.htm]

 

윈도우 SDK 에도 포함되어 있네?

[링크 : https://docs.microsoft.com/en-us/windows/win32/api/winscard/]

 

[링크 : http://egloos.zum.com/moai82/v/4211968]

[링크 : https://iamkoo.tistory.com/54]

 

대충 봐서는 일반적인 UART 같긴한데

RX는 연결하지 않고 TX만으로 half-duplex 구성한다는게 신기하네?

The USART Smartcard mode supports asynchronous protocol Smartcards as defined in the ISO 7816-3 standard.
With the Smartcard mode enabled, the USART must be configured as:
• eight data bits plus parity;
• 0.5 or 1.5 stop bits.

[링크 : https://www.st.com/resource/en/application_note/dm00255231-smartcard-interface-based-on-stm32cube-firmware-stmicroelectronics.pdf]

'하드웨어' 카테고리의 다른 글

captive screw  (0) 2025.01.23
스피커 출력 watt dB 변환(?)  (0) 2017.10.26
WinDriver / jungo driver  (0) 2017.10.07
cr20xx 건전지... 호환성(?)  (0) 2017.09.10
4극 이어폰 리모컨 원리  (0) 2017.03.06
Posted by 구차니

bazel로 빌드시에 어떤 옵션이 가능한지 보는 법 없나...

현재 발견(?) 한건

 

--config=monolithic

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

 

c와 c++용 라이브러리 생성

bazel build --config=elinux_aarch64 -c opt //tensorflow/lite/c:libtensorflowlite_c.so
bazel build --config=elinux_aarch64 -c opt //tensorflow/lite:libtensorflowlite.so

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

 

$ bazel build tensorflow/examples/label_image

[링크 : https://chromium.googlesource.com/external/github.com/tensorflow/tensorflow/+/refs/heads/master/tensorflow/examples/label_image/]

 

[ github.com/tensorflow/tensorflow/issues/38077]

[ github.com/tensorflow/tensorflow/issues/35590]

Posted by 구차니

toco랑은 또 다른건가..

보다 보니 tf.lite.Optimize.DEFAULT 라는 것도 새롭게 보이고

set_shape( ) 로 입력값이 변화하지 않도록 정해주는 것 같은데 무슨 차이인지 모르겠다 ㅠㅠ

 

!pip install tf-nightly
import tensorflow as tf

## TFLite Conversion
model = tf.saved_model.load("saved_model")
concrete_func = model.signatures[tf.saved_model.DEFAULT_SERVING_SIGNATURE_DEF_KEY]
concrete_func.inputs[0].set_shape([1, 300, 300, 3])
tf.saved_model.save(model, "saved_model_updated", signatures={"serving_default":concrete_func})
converter = tf.lite.TFLiteConverter.from_saved_model(saved_model_dir='saved_model_updated', signature_keys=['serving_default'])

converter.optimizations = [tf.lite.Optimize.DEFAULT]
converter.target_spec.supported_ops = [tf.lite.OpsSet.TFLITE_BUILTINS, tf.lite.OpsSet.SELECT_TF_OPS]
tflite_model = converter.convert()

## TFLite Interpreter to check input shape
interpreter = tf.lite.Interpreter(model_content=tflite_model)
interpreter.allocate_tensors()

# Get input and output tensors.
input_details = interpreter.get_input_details()
output_details = interpreter.get_output_details()

# Test the model on random input data.
input_shape = input_details[0]['shape']
print(input_shape)

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

    [링크 : https://github.com/tensorflow/tensorflow/issues/42114#issuecomment-671593386]

 

+

희망을 가졌던 tf.lite.Optimize.DEFAULT는 quantization 관련 옵션 ㅠㅠ

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

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

[링크 : https://www.tensorflow.org/lite/api_docs/python/tf/lite/Optimize]

Posted by 구차니
게임/닌텐도 스위치2021. 1. 31. 19:58

언제 고장났더라?

아무튼.. 나에게는 제노블레이드 DE가 조이스틱 갈아먹는 게임이구나 ㅠㅠ

 

조립하던 중 걸쇠를 건드리긴 했는데 별일 없겠지 하고 조립하고 꽂으니

무선으로는 되는데 유선으로는 안되서 다시 분해!

헐.. 배터리랑 진동모터 사이에 커넥터가 살짝 빠지면 저런 일이 벌어지는구나..

 

찾아보니 한 달 만인가..

2020/12/12 - [게임/닌텐도 스위치] - 닌텐도 스위치 보호필름 교체 그리고 조이콘 조이스틱 수리

'게임 > 닌텐도 스위치' 카테고리의 다른 글

디아 스위치 구매  (0) 2021.09.30
제노블레이드 공략  (0) 2021.03.28
제노블레이드 크로니클스 de 엔딩  (0) 2021.01.08
조이콘 조이스틱 부품 분해  (0) 2020.12.14
조이콘 수리  (4) 2020.12.12
Posted by 구차니
embeded/rpi pico2021. 1. 31. 15:18

dual cortex-m0

아두이노 나노를 노리는 타겟이것 같긴한데.. python 까지 되니 넘사벽이라고 해야하려나?

그러고 보니 아두이노도 cortex-m0가 있던거 같은데 아두이노 python도 찾아봐야겠다.

 

[링크 : http://www.raspberrypi.org/products/raspberry-pi-pico/]

[링크 : http://www.raspberrypi.org/products/raspberry-pi-pico/specifications/]

 

'embeded > rpi pico' 카테고리의 다른 글

rpi pico main.py 올리기 윈도우10, 우분투  (0) 2021.06.24
rpi pico micropython  (0) 2021.06.23
rpi pico - RP2040  (0) 2021.06.23
지름 도착 - rpi pico / esp32-cam  (0) 2021.06.23
rpi pico / usb hid?  (1) 2021.06.21
Posted by 구차니

오른발이 좀 가끔 움찔하게 아플때가 있어서 보니

설마했던 사마귀 재발 -_-

 

오늘 병원가서 확인해보니 맞다고. -_ㅠ

"아 고통의 시간이네요 ㅠㅠ"

의사도 피식 ㅠㅠ

 

 

아무튼 작고 생긴지 얼마 안되었고 1군데 뿐이라

이번에는 약도 없이 그냥 레이저로 지지고 옴

'개소리 왈왈 > 육아관련 주저리' 카테고리의 다른 글

주말.. 쉬긴 개뿔  (0) 2021.02.13
피아노 사고싶다 ㅠㅠ  (0) 2021.02.12
문을 파괴한다!  (0) 2021.01.30
간만에 키즈카페 다녀옴  (0) 2021.01.23
오늘자 득템  (0) 2021.01.18
Posted by 구차니