쿨쿨쿨

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

완전 연소  (0) 2021.05.28
외근  (0) 2021.05.27
비는 안와서 좋네  (0) 2021.05.19
무슨 주말 내내 비만 오냐 -_-  (0) 2021.05.16
샤오미 미에어 전원 케이블  (0) 2021.05.15
Posted by 구차니
분류가 모호한 글2021. 5. 22. 22:25

인터넷 유머글 보다가 댓글에서 갑자기 발견한 부고

 

21.05.06 사망했고

소식이 알려진 건 21.05.20

 

좋아했던 독자로서 작가님의 명복을 기원합니다..

 

[링크 : https://zdnet.co.kr/view/?no=20210520134059]

'분류가 모호한 글' 카테고리의 다른 글

buildroot rootfs overlay  (0) 2023.06.16
FMCW, MMIC  (0) 2022.03.22
good bye 척 예거  (2) 2020.12.09
FMCW  (0) 2018.07.19
우드락 / 보드롱 / 폼보드?  (0) 2018.05.03
Posted by 구차니
Linux API/linux2021. 5. 21. 17:33

stdin을 통해 입력을 받아 작동하는 프로그램을 쉘에서 실행하고 백드라운드로 돌리니 멈춘다?!

bg
[1] /test
#
[1]+  Stopped (tty input)        /test

 

[링크 : https://topic.alibabacloud.com/...-stopped-tty-input_1_16_30150438.html]

[링크 : https://unix.stackexchange.com/questions/294471/backgrounded-job-keeps-stopping]

 

아무튼 SIGTTIN이 들어와서 그렇다고 하는데

간단하게는.. 해당 시그널을 무시하면 되는거고..

다른 방법은 좀 더 고민해 봐야 할 듯 -_-

 

void
init_shell ()
{

  /* See if we are running interactively.  */
  shell_terminal = STDIN_FILENO;
  shell_is_interactive = isatty (shell_terminal);

  if (shell_is_interactive)
    {
      /* Loop until we are in the foreground.  */
      while (tcgetpgrp (shell_terminal) != (shell_pgid = getpgrp ()))
        kill (- shell_pgid, SIGTTIN);

      /* Ignore interactive and job-control signals.  */
      signal (SIGINT, SIG_IGN);
      signal (SIGQUIT, SIG_IGN);
      signal (SIGTSTP, SIG_IGN);
      signal (SIGTTIN, SIG_IGN);
      signal (SIGTTOU, SIG_IGN);
      signal (SIGCHLD, SIG_IGN);

      /* Put ourselves in our own process group.  */
      shell_pgid = getpid ();
      if (setpgid (shell_pgid, shell_pgid) < 0)
        {
          perror ("Couldn't put the shell in its own process group");
          exit (1);
        }

      /* Grab control of the terminal.  */
      tcsetpgrp (shell_terminal, shell_pgid);

      /* Save default terminal attributes for shell.  */
      tcgetattr (shell_terminal, &shell_tmodes);
    }
}

[링크 : https://www.gnu.org/software/libc/manual/html_node/Initializing-the-Shell.html]

 

Macro: int SIGTTINA process cannot read from the user’s terminal while it is running as a background job. When any process in a background job tries to read from the terminal, all of the processes in the job are sent a SIGTTIN signal. The default action for this signal is to stop the process. For more information about how this interacts with the terminal driver, see Access to the Terminal.

[링크 : https://www.gnu.org/software/libc/manual/html_node/Job-Control-Signals.html]

'Linux API > linux' 카테고리의 다른 글

select, poll, epoll  (0) 2021.11.02
Unhandled fault: external abort on non-linefetch  (0) 2021.05.25
linux gpio interrupt poll?  (0) 2021.05.04
Floating point exception  (0) 2021.04.05
실행파일 not fount, FATAL: kernel too old  (0) 2021.04.05
Posted by 구차니

label_image 예제를 보면 get_top_n 에서

(prediction[i] + 128) / 256.0 나 prediction[i] / 255.0 

같은 quantization 범위에 맞춘 무언가가 보이는데 

TfLiteQuantizationParams.scale 와 TfLiteQuantizationParams.zero_point을 이용하면 자동화 가능할 느낌.

template <class T>
void get_top_n(T* prediction, int prediction_size, size_t num_results,
               float threshold, std::vector<std::pair<float, int>>* top_results,
               TfLiteType input_type) {
  // Will contain top N results in ascending order.
  std::priority_queue<std::pair<float, int>, std::vector<std::pair<float, int>>,
                      std::greater<std::pair<float, int>>>
      top_result_pq;

  const long count = prediction_size;  // NOLINT(runtime/int)
  float value = 0.0;

  for (int i = 0; i < count; ++i) {
    switch (input_type) {
      case kTfLiteFloat32:
        value = prediction[i];
        break;
      case kTfLiteInt8:
        value = (prediction[i] + 128) / 256.0;
        break;
      case kTfLiteUInt8:
        value = prediction[i] / 255.0;
        break;
      default:
        break;
    }
    // Only add it if it beats the threshold and has a chance at being in
    // the top N.
    if (value < threshold) {
      continue;
    }

    top_result_pq.push(std::pair<float, int>(value, i));

    // If at capacity, kick the smallest value out.
    if (top_result_pq.size() > num_results) {
      top_result_pq.pop();
    }
  }

  // Copy to output vector and reverse into descending order.
  while (!top_result_pq.empty()) {
    top_results->push_back(top_result_pq.top());
    top_result_pq.pop();
  }
  std::reverse(top_results->begin(), top_results->end());
}

 

netron 에서 보면 quantization 범위가 나오는데, 어딘가 저장하고는 있는 듯 해서 검색 중

// SupportedQuantizationTypes.
typedef enum TfLiteQuantizationType {
  // No quantization.
  kTfLiteNoQuantization = 0,
  // Affine quantization (with support for per-channel quantization).
  // Corresponds to TfLiteAffineQuantization.
  kTfLiteAffineQuantization = 1,
} TfLiteQuantizationType;

// Structure specifying the quantization used by the tensor, if-any.
typedef struct TfLiteQuantization {
  // The type of quantization held by params.
  TfLiteQuantizationType type;
  // Holds a reference to one of the quantization param structures specified
  // below.
  void* params;
} TfLiteQuantization;

// Legacy. Will be deprecated in favor of TfLiteAffineQuantization.
// If per-layer quantization is specified this field will still be populated in
// addition to TfLiteAffineQuantization.
// Parameters for asymmetric quantization. Quantized values can be converted
// back to float using:
//     real_value = scale * (quantized_value - zero_point)
typedef struct TfLiteQuantizationParams {
  float scale;
  int32_t zero_point;
} TfLiteQuantizationParams;

// Parameters for asymmetric quantization across a dimension (i.e per output
// channel quantization).
// quantized_dimension specifies which dimension the scales and zero_points
// correspond to.
// For a particular value in quantized_dimension, quantized values can be
// converted back to float using:
//     real_value = scale * (quantized_value - zero_point)
typedef struct TfLiteAffineQuantization {
  TfLiteFloatArray* scale;
  TfLiteIntArray* zero_point;
  int32_t quantized_dimension;
} TfLiteAffineQuantization;

typedef struct TfLiteTensor {
  TfLiteType type;
  TfLitePtrUnion data;
  TfLiteIntArray* dims;
  TfLiteQuantizationParams params;
  TfLiteAllocationType allocation_type;
  size_t bytes;
  const void* allocation;
  const char* name;
  struct TfLiteDelegate* delegate;
  TfLiteBufferHandle buffer_handle;
  bool data_is_stale;
  bool is_variable;
  TfLiteQuantization quantization;
  TfLiteSparsity* sparsity;
  const TfLiteIntArray* dims_signature;
} TfLiteTensor;

 

+

2021.05.26

typedef struct TfLiteIntArray {
  int size;
// gcc 6.1+ have a bug where flexible members aren't properly handled
// https://github.com/google/re2/commit/b94b7cd42e9f02673cd748c1ac1d16db4052514c
#if (!defined(__clang__) && defined(__GNUC__) && __GNUC__ == 6 && \
     __GNUC_MINOR__ >= 1) ||                                      \
    defined(HEXAGON) || (__clang_major__ == 7 && __clang_minor__ == 1)
  int data[0];
#else
  int data[];
#endif
} TfLiteIntArray;

// Fixed size list of floats. Used for per-channel quantization.
typedef struct TfLiteFloatArray {
  int size;
// gcc 6.1+ have a bug where flexible members aren't properly handled
// https://github.com/google/re2/commit/b94b7cd42e9f02673cd748c1ac1d16db4052514c
// This also applies to the toolchain used for Qualcomm Hexagon DSPs.
#if !defined(__clang__) && defined(__GNUC__) && __GNUC__ == 6 && \
    __GNUC_MINOR__ >= 1
  float data[0];
#else
  float data[];
#endif
} TfLiteFloatArray;

 

class Interpreter {
  /// Invoke the interpreter (run the whole graph in dependency order).
  ///
  /// NOTE: It is possible that the interpreter is not in a ready state
  /// to evaluate (i.e. if a ResizeTensor() has been performed without an
  /// AllocateTensors().
  /// Returns status of success or failure.
  TfLiteStatus Invoke();

  /// WARNING: Experimental interface, subject to change
  Subgraph& primary_subgraph() {
    return *subgraphs_.front();  /// Safe as subgraphs_ always has 1 entry.
  }
  
  /// Read only access to list of inputs.
  const std::vector<int>& inputs() const { return primary_subgraph().inputs(); }
  
  /// Read only access to list of outputs.
  const std::vector<int>& outputs() const {
    return primary_subgraph().outputs();
  }
  
  // Subgraphs
  std::vector<std::unique_ptr<Subgraph>> subgraphs_;
};

[링크 : https://github.com/tensorflow/tensorflow/blob/master/tensorflow/lite/interpreter.h]

 

class Subgraph {
  // Array of indices representing the tensors that are inputs to the
  // interpreter.
  std::vector<int> inputs_;

  // Array of indices representing the tensors that are outputs to the
  // interpreter.
  std::vector<int> outputs_;
  
  // Read only access to list of inputs.
  std::vector<int>& inputs() { return inputs_; }

  // Read only access to list of inputs.
  const std::vector<int>& inputs() const { return inputs_; }

  // Read only access to list of outputs.
  std::vector<int>& outputs() { return outputs_; }

  // Read only access to list of outputs.
  const std::vector<int>& outputs() const { return outputs_; }
};

[링크 : https://github.com/tensorflow/tensorflow/blob/master/tensorflow/lite/core/subgraph.h]

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

tensorflow lite yolov4  (0) 2021.06.10
tensorflow lite interpreter->AllocateTensors()  (0) 2021.05.26
imx6q neon tensorlow lite  (0) 2021.05.10
tflite type  (0) 2021.05.01
tflite example  (0) 2021.04.19
Posted by 구차니
embeded/raspberry pi2021. 5. 21. 11:43

기본 설정으로는 1080p60 / 2160p30이 한계이고

config.txt에서 hdmi_enable_4kp60=1을 넣어주면 4kp60을 지원한다고.

근데 해보고 나서 리부팅 하고 해상도 설정 바꾸어 보는데 60p가 안뜬다 -_-

(USB-C 바로 옆에 HDMI-0만 된다는데 왜 안되냐고!!)

 

The Raspberry Pi 4 can drive up to two displays, with a resolution up to 1080p at a 60Hz refresh rate. At 4K resolution, if you connect two displays then you are limited to a 30Hz refresh rate. You can also drive a single display at 4K with a 60Hz refresh rate: this requires that the display is attached to the HDMI port adjacent to the USB-C power input (labelled HDMI0). You must also enable 4Kp60 output by setting the hdmi_enable_4kp60=1 flag in config.txt. 

[링크 : https://www.raspberrypi.org/documentation/configuration/hdmi-config.md]

 

다 넣어봐도 안되네 -_ㅠ

[링크 : https://www.raspberrypi.org/forums/viewtopic.php?t=246634]

 

+ 2021.05.24

config.txt 파일 뒤져보다 보니 어라?!

pi4 항목에 은근슬쩍 들어가있는 dtoverlay=vc4-fkms-v3d

이걸 주석처리 하니 1920x1080 0Hz로 인식되어버리고 메뉴에서도 화면설정하는 항목이 사라진다 -_-

[pi4]
# Enable DRM VC4 V3D driver on top of the dispmanx display stack
dtoverlay=vc4-fkms-v3d
max_framebuffers=2

[all]
#dtoverlay=vc4-fkms-v3d

 

raspi-config 에서는 Advanced Options - HDMI / Composite 에 해당 항목이 존재한다.

 

 

'embeded > raspberry pi' 카테고리의 다른 글

rpi cm4 어댑터 보드 or RPI zero 케이블?  (0) 2021.06.04
rpi4 cm4 csi  (0) 2021.06.03
라즈베리 파이 이미지 dd로 굽기  (0) 2021.05.21
rpi usb boot 확인?  (0) 2021.05.18
rpi 4b / tensorflow lite 빌드  (0) 2021.05.18
Posted by 구차니
embeded/raspberry pi2021. 5. 21. 10:36

맨날 윈도우에서 하다 보니 win32diskimager만 써서 몰랐는데

그냥 dd만 하면 언제 끝날지 알수가 없다 -_-

 

bs가 중요한건가.. dstat 에서 속도가 오르는게 보이네

$ dd if=2021-03-04-raspios-buster-armhf.img of=/dev/sdX bs=4M conv=fsync
$ dd if=2021-03-04-raspios-buster-armhf.img of=/dev/sdX bs=4M conv=fsync status=progress

'embeded > raspberry pi' 카테고리의 다른 글

rpi4 cm4 csi  (0) 2021.06.03
rpi 4b 해상도, 주사율  (2) 2021.05.21
rpi usb boot 확인?  (0) 2021.05.18
rpi 4b / tensorflow lite 빌드  (0) 2021.05.18
rpi 4b spec + 부팅시간  (0) 2021.05.18
Posted by 구차니

벌써 주말, 월말이 다가오네

'개소리 왈왈 > 직딩의 비애' 카테고리의 다른 글

월 말  (2) 2021.05.31
개발자 급여는 하늘을 찌르는것 처럼 보이는데..  (3) 2021.05.24
휴가인데 휴가 같지가 않다.  (0) 2021.05.17
놋북이 생겼습니다!  (0) 2021.05.12
국내 출장? 외근?  (0) 2021.05.11
Posted by 구차니

오랫만에 초여름 날씨

미세먼지도 있었는진 모르겠지만 상큼하고 좋네

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

외근  (0) 2021.05.27
기절  (0) 2021.05.23
무슨 주말 내내 비만 오냐 -_-  (0) 2021.05.16
샤오미 미에어 전원 케이블  (0) 2021.05.15
어린이날  (0) 2021.05.05
Posted by 구차니
embeded/raspberry pi2021. 5. 18. 15:07

2020-09-03 eeprom 버전이면 usb 된다고 한데..

원래 내가 검색하던건 라즈4 부팅이 느려서 찾아보았을 뿐이고

갑자기 USB 부팅을 가고 있고..

 

$ sudo rpi-eeprom-
rpi-eeprom-config  rpi-eeprom-update

$ sudo rpi-eeprom-update
*** UPDATE AVAILABLE ***
BOOTLOADER: update available
   CURRENT: Thu  3 Sep 12:11:43 UTC 2020 (1599135103)
    LATEST: Thu 29 Apr 16:11:25 UTC 2021 (1619712685)
   RELEASE: default (/lib/firmware/raspberrypi/bootloader/default)
            Use raspi-config to change the release.

  VL805_FW: Dedicated VL805 EEPROM
     VL805: up to date
   CURRENT: 000138a1
    LATEST: 000138a1

[링크 : https://blog.naver.com/emperonics/221979352174]

[링크 : https://www.clien.net/service/board/cm_rasp/15400383]

'embeded > raspberry pi' 카테고리의 다른 글

rpi 4b 해상도, 주사율  (2) 2021.05.21
라즈베리 파이 이미지 dd로 굽기  (0) 2021.05.21
rpi 4b / tensorflow lite 빌드  (0) 2021.05.18
rpi 4b spec + 부팅시간  (0) 2021.05.18
회사에 남...는(?!) 라즈베리 파이 4B  (0) 2021.05.12
Posted by 구차니
embeded/raspberry pi2021. 5. 18. 12:27

와... distcc 쓰며 뻘짓(?) 하던게 허무할 정도의 성능..

rpi 3b 3대로 병렬 빌드 하는 것 보단 조금 느리지만

시스템 구성이나 전력소비 따지면 rpi 4b 하나가 나을 것 같다.

 

real    9m45.279s
user    36m3.752s
sys     2m28.809s
Posted by 구차니