gg

在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述

在这里插入图片描述

 yum -y install gcc gcc-c++ autoconf pcre pcre-devel  make automake
 yum -y install wget httpd-tools vim
 cd /opt;mkdir app download logs work backup
 分别为源码目录,下载的软件包目录,自定义目录、shell脚本,默认配置文件的备份等

1确认网络可用 ping www.baidu.com
2确认yum源可用 yum list | grep gcc
3确认关闭iptables规则
查看 iptables -L
如果有,关闭 iptables -F

iptables -t nat -L
iptables -t nat -F

4确认停用selinux
查看是否启用 getenforce
关闭 setenforce 0

查看SELinux状态:
1、/usr/sbin/sestatus -v      ##如果SELinux status参数为enabled即为开启状态
SELinux status:                 enabled
2、getenforce                 ##也可以用这个命令检查
关闭SELinux:
1、临时关闭(不用重启机器):
setenforce 0        ##设置SELinux 成为permissive模式
##setenforce 1 设置SELinux 成为enforcing模式
2、修改配置文件需要重启机器:
修改/etc/selinux/config 文件
将SELINUX=enforcing改为SELINUX=disabled
重启机器即可

http://mirrors.163.com/centos/7.6.1810/isos/x86_64/
在这里插入图片描述
http://nginx.org/
Nginx (engine x) 是一个高性能的HTTP和反向代理web服务器,同时也提供了IMAP/POP3/SMTP服务
Nginx 是一个开源且高性能、可靠的的http中间件、代理服务

中间件是在操作系统功能范围外为应用提供服务的多用途软件。任何位于内核和用户应用之间的软件都可以是中间件。中间件不提供传统应用的功能,而是将软件与其他软件衔接。由于中间件能够让数据从一个应用流动到另一个中,因此把它比作输水管最为贴切。

中间件就是程序中可织入的,可重用的,与业务逻辑无关的各种组件。
中间件(middleware)是基础软件的一大类,属于可复用软件的范畴。

顾名思义,中间件处于操作系统软件与用户的应用软件的中间。
中间件在操作系统、网络和数据库之上, 应用软件的下层,总的作用是为处于自己上层的应用软件提供运行与开发的环境,帮助用户灵活、高效地开发和集成复杂的应用软件。

在众多关于中间件的定义中,比较普遍被接受的是 IDC 表述的:中间件是一种独立的系统软件或服务程序,分布式应用软件借助这种软件在不同的技术之间共享资源,中间件位于客户机服务器的操作系统之上,管理计算资源和网络通信。

分类:数据访问中间件,远程调用中间件,消息中间件,交易中间件,对象中间件。

二 常见的http中间件服务
httpd apache
iis 微软
gws 谷歌
nginx
三 nginx优点
1 io多路复用epoll
在这里插入图片描述
在这里插入图片描述
二、 什么是epoll
io多路复用的实现方式select、poll、epoll 未完

2 轻量级

功能模块少
代码模块化–易于开发人员的二次开发 Tengine https://tengine.taobao.org/
Tengine是由淘宝网发起的Web服务器项目。它在Nginx的基础上,针对大访问量网站的需求,添加了很多高级功能和特性。Tengine的性能和稳定性已经在大型的网站如淘宝网,天猫商城等得到了很好的检验。它的最终目标是打造一个高效、稳定、安全、易用的Web平台。
3 cpu亲和 (affinity)
在这里插入图片描述
在这里插入图片描述

4 sendfile
在这里插入图片描述
在这里插入图片描述

安装

http://nginx.org/en/download.html

Mainline version 开发版
在这里插入图片描述
changes 版本更新的改变
pgb 包安全校验-第三方网站下载的需要安全校验

Stable version 稳定版
Legacy version 历史版本
Source Code 源代码
Pre-Built Packages 基于yum方式安装
我使用此方式安装
在这里插入图片描述
http://nginx.org/en/linux_packages.html
按官方指导
添加yum源
cd /etc/yum.repos.d/
cat CentOS-Base.repo

[base]
name=CentOS- r e l e a s e v e r − B a s e m i r r o r l i s t = h t t p : / / m i r r o r l i s t . c e n t o s . o r g / ? r e l e a s e = releasever - Base mirrorlist=http://mirrorlist.centos.org/?release= releaseverBasemirrorlist=http://mirrorlist.centos.org/?release=releasever&arch=KaTeX parse error: Expected 'EOF', got '&' at position 9: basearch&̲repo=os&infra=infra
#baseurl=http://mirror.centos.org/centos/ r e l e a s e v e r / o s / releasever/os/ releasever/os/basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7

vim /etc/yum.repos.d/nginx.repo
拷贝
[nginx-stable]
name=nginx stable repo
baseurl=http://nginx.org/packages/centos/ r e l e a s e v e r / releasever/ releasever/basearch/
gpgcheck=1
enabled=1
gpgkey=https://nginx.org/keys/nginx_signing.key

[nginx-mainline]
name=nginx mainline repo
baseurl=http://nginx.org/packages/mainline/centos/ r e l e a s e v e r / releasever/ releasever/basearch/
gpgcheck=1
enabled=0
gpgkey=https://nginx.org/keys/nginx_signing.key
保存
注意 确认 baseurl和以前的yum源的路径后缀相同 /centos/ r e l e a s e v e r / releasever/ releasever/basearch/

验证
yum list | grep nginx
安装
yum install nginx
验证
nginx -v 版本
nginx -V 编译参数

二 基本参数使用

安装目录
rpm -ql nginx 查看安装目录

[root@rain yum.repos.d]# rpm  -ql nginx 

遵循linux的文件规范 etc下放核心配置

/etc/logrotate.d/nginx   nginx日志轮转 用于logrotate服务日志的切割

/etc/nginx
/etc/nginx/nginx.conf
/etc/nginx/conf.d
/etc/nginx/conf.d/default.conf    这三个为启动时需要加载的配置文件

/etc/nginx/fastcgi_params
/etc/nginx/uwsgi_params
/etc/nginx/scgi_params     这三个 cgi相关配置 fastcgi配置

/etc/nginx/koi-utf
/etc/nginx/koi-win
/etc/nginx/win-utf       编码转换的映射文件

/etc/nginx/mime.types   http协议的content-type与扩展名的对应关系

/etc/sysconfig/nginx
/etc/sysconfig/nginx-debug
/usr/lib/systemd/system/nginx-debug.service
/usr/lib/systemd/system/nginx.service   用于配置系统守护进程管理器管理方式

/usr/lib64/nginx

/usr/lib64/nginx/modules
/etc/nginx/modules         nginx模块目录

/usr/libexec/initscripts/legacy-actions/nginx
/usr/libexec/initscripts/legacy-actions/nginx/check-reload
/usr/libexec/initscripts/legacy-actions/nginx/upgrade

/usr/sbin/nginx
/usr/sbin/nginx-debug   nginx服务启动管理的终端命令

/usr/share/doc/nginx-1.16.0
/usr/share/doc/nginx-1.16.0/COPYRIGHT
/usr/share/man/man8/nginx.8.gz    nginx的手册和帮助文档

/usr/share/nginx
/usr/share/nginx/html
/usr/share/nginx/html/50x.html
/usr/share/nginx/html/index.html

/var/cache/nginx    nginx的缓存目录

/var/log/nginx     nginx日志目录

编译参数

nginx -V

[root@rain yum.repos.d]# nginx -V
nginx version: nginx/1.16.0
built by gcc 4.8.5 20150623 (Red Hat 4.8.5-36) (GCC) 
built with OpenSSL 1.0.2k-fips  26 Jan 2017
TLS SNI support enabled
configure arguments: --prefix=/etc/nginx --sbin-path=/usr/sbin/nginx --modules-path=/usr/lib64/nginx/modules --conf-path=/etc/nginx/nginx.conf --error-log-path=/var/log/nginx/error.log --http-log-path=/var/log/nginx/access.log --pid-path=/var/run/nginx.pid --lock-path=/var/run/nginx.lock --http-client-body-temp-path=/var/cache/nginx/client_temp --http-proxy-temp-path=/var/cache/nginx/proxy_temp --http-fastcgi-temp-path=/var/cache/nginx/fastcgi_temp --http-uwsgi-temp-path=/var/cache/nginx/uwsgi_temp --http-scgi-temp-path=/var/cache/nginx/scgi_temp --user=nginx --group=nginx --with-compat --with-file-aio --with-threads --with-http_addition_module --with-http_auth_request_module --with-http_dav_module --with-http_flv_module --with-http_gunzip_module --with-http_gzip_static_module --with-http_mp4_module --with-http_random_index_module --with-http_realip_module --with-http_secure_link_module --with-http_slice_module --with-http_ssl_module --with-http_stub_status_module --with-http_sub_module --with-http_v2_module --with-mail --with-mail_ssl_module --with-stream --with-stream_realip_module --with-stream_ssl_module --with-stream_ssl_preread_module --with-cc-opt='-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -fPIC' --with-ld-opt='-Wl,-z,relro -Wl,-z,now -pie'

在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
基本参数

语法

[root@rain yum.repos.d]# cd /etc/nginx
[root@rain nginx]# ls
conf.d          koi-utf  mime.types  nginx.conf   uwsgi_params
fastcgi_params  koi-win  modules     scgi_params  win-utf
[root@rain nginx]# vim nginx.conf

查看主配置文件
主要有三块

在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
http下可以配置多个站点,即多个server
server 里面有
listen :监听端口
server_name: 虚拟主机或独立域名
location:控制路径的访问

user  nginx;
worker_processes  1;

error_log  /var/log/nginx/error.log warn; #配置nginx错误日志 位置 级别
pid        /var/run/nginx.pid;


events {
    worker_connections  1024;
}


http {
    include       /etc/nginx/mime.types;
    default_type  application/octet-stream;

    log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
                      '$status $body_bytes_sent "$http_referer" '
                      '"$http_user_agent" "$http_x_forwarded_for"';

    access_log  /var/log/nginx/access.log  main; #access_log  日志的配置,结合log_format  定义日志级别 

    sendfile        on;
    #tcp_nopush     on;

    keepalive_timeout  65;  #超时时间

    #gzip  on;

    include /etc/nginx/conf.d/*.conf;      # 这个意思是说他包含了这个目录下的所有*.conf配置文件
}

这个路径下只有一个配置文件

[root@rain nginx]# cd /etc/nginx/conf.d/
[root@rain conf.d]# ls
default.conf
[root@rain conf.d]# 
                                       

server {
    listen       80;
    server_name  localhost;

    #charset koi8-r;
    #access_log  /var/log/nginx/host.access.log  main;

location / {            #  / 所有路径将进入
    root   /usr/share/nginx/html;     # root    页面路径
    index  index.html index.htm;      # index.html 找不到会找index.htm
}

#error_page  404              /404.html;

# redirect server error pages to the static page /50x.html
#
error_page   500 502 503 504  /50x.html;
location = /50x.html {
    root   /usr/share/nginx/html;
}

# proxy the PHP scripts to Apache listening on 127.0.0.1:80
#
#location ~ \.php$ {
#    proxy_pass   http://127.0.0.1;
  #}

# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
#location ~ \.php$ {
#    root           html;
#    fastcgi_pass   127.0.0.1:9000;
#    fastcgi_index  index.php;
#    fastcgi_param  SCRIPT_FILENAME  /scripts$fastcgi_script_name;
#    include        fastcgi_params;
#}

# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
#location ~ /\.ht {
#    deny  all;
#}
}

配置文件修改好需要重启

http请求

yum update curl

[root@rain bin]# curl http://www.baidu.com
查看响应报文
[root@rain bin]# curl -v http://www.baidu.com

重定向到linux空设备
[root@rain bin]# curl -v http://www.baidu.com > /dev/null

在这里插入图片描述
大于号是请求 小于号是响应

nginx日志类型
error.log access_log
log_format
在这里插入图片描述
[root@rain bin]# tail -f /var/log/nginx/error.log

在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述

在这里插入图片描述
在这里插入图片描述

[root@rain /]# nginx -t -c /etc/nginx/nginx.conf 
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful
[root@rain /]# nginx -s reload -c /etc/nginx/nginx.conf 

[root@rain /]# curl http://127.0.0.1
[root@rain /]# tail -n 200 /var/log/nginx/access.log 
127.0.0.1 - - [14/May/2019:23:07:07 +0800] "GET / HTTP/1.1" 200 612 "-" "curl/7.29.0" "-"
127.0.0.1 - - [14/May/2019:23:07:09 +0800] "GET / HTTP/1.1" 200 612 "-" "curl/7.29.0" "-"
[root@rain /]# 

内置变量
https://nginx.org/en/docs/
https://nginx.org/en/docs/syslog.html
https://nginx.org/en/docs/http/ngx_http_log_module.html#access_log
在这里插入图片描述

<think>好的,我现在需要帮助用户了解如何使用GG-CNN进行抓取检测或相关应用。首先,我应该回顾一下用户提供的引用内容,确保准确理解GG-CNN的特点和相关信息。 根据引用[1],GG-CNN是一种生成抓取卷积神经网络,能够直接从图像生成抓取姿势,无需采样和分类,频率高达50Hz,适用于动态物体和闭环控制。引用[2]提到GG-CNN是轻量级的全卷积网络,使用深度图像进行像素级预测,适合动态环境。这两个引用是主要的技术来源,而引用[3]关于CNN谣言检测可能不太相关,但需要确认是否有隐藏的联系。 用户的需求是使用GG-CNN进行抓取检测,需要教程和实现方法。我应该分解步骤,从环境配置到模型使用,再到应用实例。需要确保回答结构清晰,步骤详细,同时引用提供的资料来支持内容。 首先,环境搭建可能需要Python、深度学习框架如PyTorch或TensorFlow,以及相关库如OpenCV。接着,数据准备部分需要提到使用的数据集,比如康奈尔抓取数据集,或者用户自己的深度图像。然后,模型构建需要根据GG-CNN的架构描述,可能包括编码器-解码器结构,输出抓取质量、角度和宽度。 在模型训练部分,要强调损失函数的选择,如均方误差,以及优化器和训练参数。测试与应用部分应包括加载预训练模型、处理输入图像、生成抓取参数,并转换为机器人可执行的指令。同时,闭环控制的实现可能需要结合机器人操作系统(ROS)或其他实时系统。 注意事项中需要提到硬件要求、数据集适配和实时性优化。相关问题部分要引导用户深入思考,如闭环控制实现、训练数据不足怎么办、动态物体处理等,并引用对应的参考文献来支持答案。 需要检查是否所有步骤都覆盖了用户的需求,是否有遗漏的部分。例如,是否需要提供代码示例?用户给的示例中有Python代码,所以可能期望类似的部分。但GG-CNN的具体实现代码可能不在公开引用中,可能需要指导用户查阅官方仓库或论文中的伪代码。 另外,确保使用正确的中文术语,避免技术术语错误。例如,“全卷积神经网络”是否正确,是否符合引用[2]中的描述。同时,引用标识应自然地附加在相关陈述后,如闭环控制部分引用[1]和[2]。 最后,生成的相关问题要围绕GG-CNN的应用、优化和扩展,帮助用户进一步探索。例如,如何在实际机器人上部署,如何处理不同传感器数据等。 现在,我需要将以上思考整理成一个结构化的回答,分步骤解释实现方法,引用正确的来源,并生成相关问题。</think>### GG-CNN抓取检测模型使用教程与实现方法 GG-CNN(Generative Grasping Convolutional Neural Network)是一种轻量级全卷积神经网络,可直接从深度图像中生成抓取姿势,适用于动态环境和实时闭环控制[^1][^2]。以下是其核心实现步骤: --- #### **1. 环境配置** - **框架依赖**:需安装Python(≥3.6)、PyTorch/TensorFlow、OpenCV及Numpy。 ```bash pip install torch torchvision opencv-python numpy ``` - **硬件要求**:支持CUDA的GPU可加速推理(推荐NVIDIA显卡)。 --- #### **2. 数据准备** - **数据集**:使用康奈尔抓取数据集(包含RGB-D图像及抓取标注),或自定义深度图像数据。 - **数据预处理**: - 将深度图像归一化至$[0,1]$。 - 调整图像分辨率为模型输入尺寸(如GG-CNN默认$320×320$)。 --- #### **3. 模型构建** GG-CNN采用**编码器-解码器结构**,输出每个像素点的抓取质量、角度和宽度[^2]: ```python # 示例模型结构(基于PyTorch) import torch.nn as nn class GGCNN(nn.Module): def __init__(self): super().__init__() # 编码器(特征提取) self.encoder = nn.Sequential( nn.Conv2d(1, 32, kernel_size=5), # 输入深度图通道为1 nn.ReLU(), nn.MaxPool2d(2), # ... 更多卷积层 ) # 解码器(生成抓取参数) self.decoder = nn.Sequential( nn.ConvTranspose2d(64, 32, kernel_size=5), nn.ReLU(), nn.Conv2d(32, 3, kernel_size=1) # 输出3通道:质量、角度、宽度 ) def forward(self, x): x = self.encoder(x) x = self.decoder(x) return x ``` --- #### **4. 模型训练** - **损失函数**:对抓取质量、角度、宽度分别计算均方误差(MSE): $$L = \lambda_1 L_{quality} + \lambda_2 L_{angle} + \lambda_3 L_{width}$$ - **优化器**:使用Adam,学习率设为$1e^{-4}$,训练约50个epoch。 --- #### **5. 测试与应用** **步骤1:加载预训练模型** ```python model = GGCNN() model.load_state_dict(torch.load('ggcnn_weights.pth')) ``` **步骤2:处理输入图像** ```python import cv2 depth_image = cv2.imread('depth.png', cv2.IMREAD_GRAYSCALE) processed_image = preprocess(depth_image) # 归一化与缩放 ``` **步骤3:生成抓取参数** ```python with torch.no_grad(): output = model(processed_image) grasp_quality = output[0] # 抓取质量热图 grasp_angle = output[1] # 抓取角度 grasp_width = output[2] # 抓取宽度 ``` **步骤4:转换为机器人指令** - 选择质量最高的像素位置$(x,y)$,提取对应角度$\theta$和宽度$w$。 - 通过机器人逆运动学计算关节角度,执行抓取[^1]。 --- #### **6. 闭环控制实现** 结合机器人位姿反馈,以50Hz频率更新抓取参数,适应物体移动或环境变化。需集成ROS或实时通信框架。 --- #### **注意事项** 1. **硬件同步**:深度相机与机器人控制需时间同步。 2. **数据适配**:若抓取非平面物体,需增加数据增强(旋转、噪声)。 3. **实时性优化**:模型剪枝或量化可进一步提升推理速度。 --- ###
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值