Skip to content

Instantly share code, notes, and snippets.

View lix19937's full-sized avatar
🤖
keep learning new things.

lix19937

🤖
keep learning new things.
View GitHub Profile
1 ONNX 能被指定结构框选node 如nn.mha 算子在netron中 自动按颜色进行选取
2
@lix19937
lix19937 / find_t_1_0.5_v2.cpp
Created June 26, 2026 12:31
find_t_1_0.5_v2
/**************************************************************
# * @Author: ljw
# * @Date: 2026-04-19 10:14:11
# * @Last Modified by: ljw
# * @Last Modified time: 2026-06-25 14:34:02
# **************************************************************/
#include <vector>
#include <algorithm>
@lix19937
lix19937 / t_1_0.5.cpp
Created June 24, 2026 12:49
find_t_1_0.5
#include <vector>
#include <algorithm>
#include <shared_mutex>
#include <optional>
#include <cmath>
#include <mutex>
#include <iostream>
#include <iomanip>
struct DataPoint {
@lix19937
lix19937 / round_by_factor.cpp
Created May 12, 2026 08:00
round_by_factor
#include <stdio.h>
#include <cmath>
#include <iostream>
/*
def round_by_factor(number: int, factor: int) -> int:
"""Returns the closest integer to 'number' that is divisible by 'factor'."""
return round(number / factor) * factor
factor=32
@lix19937
lix19937 / find-the-nearest-interval.cpp
Last active January 18, 2026 15:30
find-the-nearest-interval.cpp
#include <iostream>
#include <algorithm>
#include <deque>
#include <stdint.h>
struct LocalPoseLite{
uint64_t measurement_time;
LocalPoseLite(uint64_t t){
@lix19937
lix19937 / finddr.cpp
Created October 16, 2025 12:19
find nearest value
#include <iostream>
#include <queue>
int main() {
struct DrInfo {
int64_t timestamp;
};
std::queue<DrInfo> dr_queue_;
std::queue<DrInfo> dr_queue2_;
@lix19937
lix19937 / .cc
Created August 7, 2025 08:22
check_parent_exists.cc
#include <iostream>
#include <experimental/filesystem>
namespace fs = std::experimental::filesystem;
void ensure_parent_exists(const std::string& filepath) {
fs::path p(filepath);
fs::path parent = p.parent_path();
@lix19937
lix19937 / nchw2nhwc.py
Created July 6, 2025 00:53
nchw2nhwc.py
import numpy as np
with open('chw888.bin', 'rb') as f:
raw_data = f.read()
array = np.frombuffer(raw_data, dtype=np.uint8)
n=3
h=544
w=960
c=3
@lix19937
lix19937 / ClearBit.cpp
Created June 24, 2025 06:37
ClearBit.cpp
#include <iostream>
#include <stdint.h>
#include <bitset>
uint32_t SetBit(uint32_t position) {
uint32_t num = 0;
num |= (1 << position);
return num;
}
@lix19937
lix19937 / print.cpp
Created June 11, 2025 06:06
print cvmat info
int tnbytes = h * w;
// std::vector<cv::Mat> tchannels;
// cv::split(img_bgr, tchannels);
// std::cout << "宽度: " << tchannels[0].cols << std::endl;
// std::cout << "高度: " << tchannels[0].rows << std::endl;
// std::cout << "通道数: " << tchannels[0].channels() << std::endl;
// std::cout << "数据类型: " << tchannels[0].type() << " ---- " << CV_8UC1 << std::endl;
// std::cout << "深度: " << tchannels[0].depth() << std::endl;
// std::cout << "尺寸: " << tchannels[0].size() << std::endl;
// std::cout << "是否连续存储: " << (tchannels[0].isContinuous() ? "是" : "否") << std::endl;