- 博客(93)
- 收藏
- 关注
原创 vscode debug c++代码
需要修改tasks.json文件。和make -j,对应的就是tasks.json中的两个任务。在tasks.json中写好编译的步骤,即tasks,如cmake …在lauch.json中配置可执行文件的路径和需要执行tasks中的哪一个任务。此时会在.vscode中生成tasks.json文件。需要提前写好CMakeLists.txt。终端–>配置任务–>g++生成活动文件。此时会生成launch.json文件。3.配置lanuch.json。2.配置tasks.json。运行–>添加配置–>C++
2023-12-21 15:35:59
1177
转载 转载:安装nvidia-docker
https://wenku.csdn.net/answer/5fb0056dec75f32f48deac10b7de44c8
2023-12-08 10:57:08
131
原创 jetson挂载tf卡
3.挂载SD卡到/media/mydisk文件夹下。找到/dev/mmcblk1。2.格式化ext4分区。4.设置开机自动挂载。
2023-09-07 15:43:58
214
原创 jetson源
deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports/ bionic main multiverse restricted universedeb http://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports/ bionic-security main multiverse restricted universedeb http://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports/
2023-09-04 14:12:20
74
原创 git的简单使用
git clone -b 标签名 git地址。git tag -a 标签名 -m 信息。git push origin 标签名。git chechout 标签名。git tag -d 标签名。
2023-08-11 16:24:55
58
转载 onnx模型裁剪一部分
https://github.com/onnx/onnx/blob/main/docs/PythonAPIOverview.md
2022-08-30 16:51:40
2117
原创 测试网页能否播放视频
<html> <head> <title>camera</title> </head> <body> <video id="video" width="640" height="360" src="http://192.168.4.78:9000/test/fire_143-2022-04-14-09-12-00.mp4" controls autoplay> </vide.
2022-05-11 14:24:24
418
原创 python清理僵尸进程的两种方法
import multiprocessing as mpfrom time import sleepimport shortuuidimport osimport psutil# 方法1 信号import signalsignal.signal(signal.SIGCHLD, signal.SIG_IGN)class P(mp.Process): def __init__(self, name): super(P, self).__init__()
2022-05-11 14:10:16
874
原创 ffmpeg h64编码
#include <fstream>#include <iostream>extern "C"{#include <libavcodec/avcodec.h>}#define print(x) std::cout << x << std::endlvoid print_av_err(int ret){ char buf[1024] = {0}; av_strerror(ret, buf, sizeof(buf
2022-03-19 13:27:24
1166
原创 c++延时函数精度问题
任务:假设需要做视频编解码显示,需要频繁调用sleep(10ms)函数,如果sleep函数内部误差过大,会导致fps不准确,特别是需要高fps任务。对比几个方法,测试误差。#include <iostream>#include <thread>#include <chrono>#include <sys/time.h>void sleep_for(double ms){ // 单位粒度越小,时间越准确,CPU资源占用相对升高 /
2022-03-15 15:55:09
2065
原创 ubuntu18.04 通过docker配置mysql、redis、rabbitmq
ubuntu18.04配置rabbitmq、mysql、redis1、配置rabbitmqdocker pull rabbitmqsudo docker run -d --hostname my-rabbit --name rabbit -e RABBITMQ_DEFAULT_USER=admin -e RABBITMQ_DEFAULT_PASS=admin -p 15672:15672 -p 5672:5672 -p 25672:25672 -p 61613:61613 -p 1883:1883 r
2022-03-04 09:49:24
2188
原创 pytorch:张量的数学计算
import torch# 计算转置a = torch.tensor([[1, 2], [3, 4]], dtype=torch.float32)print(a)print(a.t())# 计算逆矩阵b = torch.inverse(a)print(b)print(a@b)# 计算traceprint(torch.trace(a))# 计算范数print(torch.norm(a, dim=-1, p=1))# 计算行列式print(torch.det(a)).
2022-02-07 09:48:35
295
原创 opencv保存视频文件很大
目前接触到的视频保存方法有两种,一种是cv2.VideoWriter,另一种是imageio,对比下来imageio保存的录像文件要比opencv保存的小很多,具体原因暂时不清楚。存在的问题:imageio保存的视频不能获得视频总帧数这个属性import imageioimport cv2from tqdm import tqdmclass MyVideoWriter: def __init__(self, save_path, height=None, width=None, fps
2022-01-21 14:50:40
5482
原创 python常用工具类
# 获取当前机器gpu的数量def get_gpu_count(): # return len(os.popen("nvidia-smi -L").read().strip().split("\n")) # num_default = len(os.popen("nvidia-smi -L").read().strip().split("\n")) pattern = "(GPU \d+?): NVIDIA" num_default = len(re.findall(pat
2021-12-30 14:53:02
1861
原创 try_except
def try_except(func): # try-except function. Usage: @try_except decorator def handler(*args, **kwargs): try: func(*args, **kwargs) except Exception as e: print(e) return handler用法:@try_exceptdef func
2021-12-30 11:34:34
205
原创 跳帧读取视频文件类
# 对于大视频文件,set pos速度很慢,不如直接grabclass FrameReaderV2: def __init__(self, video_path): self.video_path = video_path self.cap = None self.init_cap() def init_cap(self): if self.cap is not None: self.cap.rele
2021-12-29 14:58:01
293
原创 could not select device driver ““ with capabilities: [[gpu]].
https://collabnix.com/introducing-new-docker-cli-api-support-for-nvidia-gpus-under-docker-engine-19-03-0-beta-release/
2021-11-12 19:45:29
1557
原创 loguru
from loguru import loggerlogger.add("1.log")logger.debug("111111")logger.info("2222222")logger.warning("33333333")logger.error("444444444")logger.info('If you are using Python {}, prefer {feature} of course!', 3.6, feature='f-strings')@logger.cat.
2021-11-05 15:58:39
97
原创 cocoeval的简单使用
from pycocotools.cocoeval import COCOevalfrom pycocotools.coco import COCOimport numpy as npgt = COCO("/mnt/data/safety_wearing/safe_belt/annotations/instances_val2017.json")dt = COCO("/mnt/data/safety_wearing/safe_belt/annotations/pre.json") # 预测结果每
2021-11-05 15:39:12
3289
原创 python:目标检测label显示
import cv2import numpy as np_COLORS = np.array( [ 0.000, 0.447, 0.741, 0.850, 0.325, 0.098, 0.929, 0.694, 0.125, 0.494, 0.184, 0.556, 0.466, 0.674, 0.188, 0.301, 0.745, 0.933, 0.635, 0.078, 0.1
2021-11-05 12:08:33
430
原创 pytorch:融合conv和bn
from copy import deepcopyimport torchimport torch.nn as nndef fuse_conv_and_bn(conv, bn): # Fuse convolution and batchnorm layers https://tehnokv.com/posts/fusing-batchnorm-and-conv/ fusedconv = ( nn.Conv2d( conv.in_channels
2021-11-05 11:38:24
1213
原创 opencv 录像
import cv2 class MyVideoWriter: def __init__(self,save_path,height=None,width=None,fps=25): self.save_path = save_path self.height = height self.width = width self.fourcc = cv2.VideoWriter_fourcc(*'MP4V') self
2021-11-02 10:14:27
1240
原创 nni的简单使用
1、训练cifar10模型网络结构主要基于torchvision的resnet18修改,conv1的卷积核由7x7变成3x3,layer2的stride换成1import torchimport numpy as npfrom nni.compression.pytorch.utils.counter import count_flops_paramsfrom cifar_resnet import ResNet18import torch.nn as nnfrom tqdm import t
2021-10-25 11:40:09
876
原创 c++使用笔记
vectror<T> vec(size);vec = {.....};std::copy_if(dets.begin(), dets.end(), std::back_inserter(results), [&](Detection d){ return d.class_confidence >= postThres; });std::sort(results.begin(), results.end(), [&](Detection &d1, Detecti
2021-10-13 10:24:22
50
原创 tensorrt的CMakeLists.txt
cmake_minimum_required(VERSION 2.6)project(main)set(CMAKE_BUILD_TYPE "Debug") # 用于gdb调试add_definitions(-std=c++11) # 14?option(CUDA_USE_STATIC_CUDA_RUNTIME OFF) # 是否必要# set(CMAKE_CXX_STANDARD 11) # 14?# set(CMAKE_BUILD_TYPE Debu
2021-10-11 18:31:22
1946
原创 c++精确时间统计
#include <chrono>auto start = std::chrono::high_resolution_clock::now();auto end = std::chrono::high_resolution_clock::now();auto cost = std::chrono::duration_cast<std::chrono::milliseconds>(end-start).count();
2021-09-27 14:13:35
455
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人