baby做网站汽车/百度竞价点击价格

baby做网站汽车,百度竞价点击价格,网站后台素材,php网站跟随导航WebRTC(Web Real-Time Communication)协议 WebRTC(Web Real-Time Communication)是一种支持浏览器和移动应用程序之间进行 实时音频、视频和数据通信 的协议。它使得开发者能够在浏览器中实现高质量的 P2P(点对点&…

WebRTC(Web Real-Time Communication)协议

WebRTC(Web Real-Time Communication)是一种支持浏览器和移动应用程序之间进行 实时音频、视频和数据通信 的协议。它使得开发者能够在浏览器中实现高质量的 P2P(点对点)实时通信,而无需安装插件或第三方软件。WebRTC 主要用于视频通话、语音聊天、在线协作和数据传输等应用场景。

核心功能

WebRTC 提供了以下几个关键功能:

  1. 音视频通信:WebRTC 支持通过浏览器进行音频和视频的实时传输,用户之间可以进行高质量的语音和视频通话。
  2. P2P 数据传输:WebRTC 不仅支持音视频流,还支持点对点的数据通道(Data Channel)传输,适合进行文件传输、屏幕共享和实时协作。
  3. 低延迟:WebRTC 专门优化了数据传输过程,以减少通信中的延迟,使得实时通信更加顺畅。

工作原理

WebRTC 使用了一系列底层协议和技术来实现点对点通信。WebRTC 的工作流程通常包括以下几个关键步骤:

  1. 建立连接(Signaling)
    • 在 WebRTC 中,信令(Signaling) 是客户端用于交换通信所需的元数据(如网络信息、音视频编解码信息、媒体能力等)的一种过程。信令不是 WebRTC 协议的一部分,但它是 WebRTC 通信的必要步骤。
    • 信令的内容包括:协商媒体(音视频)格式、网络路径、设备信息等。
    • 通常,信令使用 WebSockets、HTTP 或其他协议进行实现。
    • 信令过程包括:
      • Offer(提议):发起方创建会话请求,发送给接收方。
      • Answer(应答):接收方回应发起方的请求,确认会话设置。
      • ICE candidates(ICE 候选者):每个端点通过收集网络候选地址来交换,以帮助建立最佳的 P2P 连接。
  2. 网络连接(ICE、STUN 和 TURN)
    • ICE(Interactive Connectivity Establishment):用于在 NAT 后的网络环境中建立端到端的连接。ICE 是 WebRTC 连接的关键组成部分,它帮助客户端发现并连接到彼此。
    • STUN(Session Traversal Utilities for NAT):STUN 服务器帮助客户端了解自己在 NAT 后的公网 IP 地址。
    • TURN(Traversal Using Relays around NAT):TURN 服务器在 P2P 连接无法直接建立时提供数据转发服务,确保通信的可靠性。TURN 作为最后的解决方案,通常会导致更高的延迟,因此只有在需要时才使用。
  3. 媒体流传输(RTP/RTCP)
    • RTP(Real-Time Transport Protocol):RTP 是 WebRTC 用于音频和视频流的传输协议。它允许在网络中实时地传输数据包,并为这些数据包添加时间戳,确保音视频数据的正确顺序。
    • RTCP(Real-Time Control Protocol):RTCP 用于监控 RTP 会话的质量,并提供流控制和同步。
  4. 数据传输(DataChannel)
    • RTCDataChannel:WebRTC 支持数据通道(DataChannel),使得浏览器间可以通过 P2P 传输任意数据(包括文本、文件、图像等)。数据通道提供了低延迟的点对点数据传输能力,常用于文件传输、屏幕共享等应用。

关键技术

WebRTC 由多种技术组成,其中最重要的包括:

  1. getUserMedia:用于获取用户的音频和视频输入设备(如麦克风和摄像头)的权限。它会返回一个包含音视频流的对象。

    navigator.mediaDevices.getUserMedia({ video: true, audio: true }).then(stream => {// 显示视频流const videoElement = document.getElementById('my-video');videoElement.srcObject = stream;}).catch(error => console.log('Error accessing media devices: ', error));
    
  2. RTCPeerConnection:用于建立、维护和管理 P2P 连接。它负责处理网络连接、音视频编解码、带宽管理等任务。

    const peerConnection = new RTCPeerConnection(configuration);
    peerConnection.addStream(localStream); // 添加本地音视频流// 建立连接后,发送媒体流
    peerConnection.createOffer().then(offer => peerConnection.setLocalDescription(offer)).then(() => {// 将 offer 发送给接收方});
    
  3. RTCDataChannel:用于建立点对点的数据传输通道,可以传输任意类型的数据。

    javascript复制编辑const dataChannel = peerConnection.createDataChannel('chat');
    dataChannel.onopen = () => console.log('Data channel open');
    dataChannel.onmessage = (event) => console.log('Received message: ', event.data);// 发送数据
    dataChannel.send('Hello, WebRTC!');
    

应用场景

  1. 视频通话:WebRTC 可以用于构建视频会议应用,如 Zoom、Google Meet 等。
  2. 语音通话:WebRTC 支持语音通话,广泛应用于 IP 电话、语音助手等。
  3. 文件传输:通过 RTCDataChannel,WebRTC 可以用于点对点的文件传输。
  4. 实时协作:WebRTC 用于多人在线编辑、白板共享等实时协作工具。
  5. 直播:WebRTC 可以支持低延迟的视频直播,适用于游戏直播、网络教学等领域。

实现过程

1. 获取音视频流(getUserMedia)

getUserMedia 是 WebRTC 中用于访问用户音频和视频设备的 API。通过它,你可以获取麦克风和摄像头的权限,从而获取用户的音视频流。

示例:获取视频和音频流
navigator.mediaDevices.getUserMedia({ video: true, audio: true }).then(stream => {// 获取视频流后,可以将其显示在视频标签上const videoElement = document.getElementById('localVideo');videoElement.srcObject = stream;// 创建 RTCPeerConnection 实例(将在后面讨论)const peerConnection = new RTCPeerConnection();// 将本地流添加到连接stream.getTracks().forEach(track => peerConnection.addTrack(track, stream));}).catch(error => {console.error('Error accessing media devices.', error);});
  • getUserMedia:请求用户设备的音视频流。
  • 返回的 MediaStream 可以用于显示、录制或传输。
2. 创建点对点连接(RTCPeerConnection)

WebRTC 使用 RTCPeerConnection 来管理媒体流的传输。它代表了与另一个客户端的点对点连接。

示例:创建 RTCPeerConnection 并添加本地流
const peerConnection = new RTCPeerConnection({iceServers: [{ urls: 'stun:stun.l.google.com:19302' } // 使用 STUN 服务器]
});// 添加本地流到连接
navigator.mediaDevices.getUserMedia({ video: true, audio: true }).then(stream => {const localVideo = document.getElementById('localVideo');localVideo.srcObject = stream;stream.getTracks().forEach(track => peerConnection.addTrack(track, stream));});
  • STUN 服务器:STUN(Session Traversal Utilities for NAT)帮助客户端发现自己的公共 IP 地址,用于 NAT 穿透。
3. 信令交换(Signal)

WebRTC 协议并不直接定义信令交换的方式,因此你需要自己实现信令交换。信令过程用于交换连接的元数据,如会话描述(SDP)和 ICE 候选者等。

  1. 创建 Offer(发起方)
peerConnection.createOffer().then(offer => {return peerConnection.setLocalDescription(offer);  // 设置本地 SDP}).then(() => {// 将 offer 发送给对方(通过信令服务器)signalingServer.send({ type: 'offer', offer: peerConnection.localDescription });});
  • SDP(Session Description Protocol):描述了音视频流的编码、传输等信息。
  1. 设置 Answer(接收方)

接收方收到 Offer 后,创建 Answer 并回复:

signalingServer.on('offer', offer => {peerConnection.setRemoteDescription(new RTCSessionDescription(offer)).then(() => peerConnection.createAnswer()).then(answer => {return peerConnection.setLocalDescription(answer);  // 设置本地 SDP}).then(() => {// 将 answer 发送给发起方signalingServer.send({ type: 'answer', answer: peerConnection.localDescription });});
});
  1. 交换 ICE 候选者

在连接过程中,客户端会收集并交换 ICE 候选者(候选网络路径)。这些候选者用于寻找最佳的连接路径。

peerConnection.onicecandidate = event => {if (event.candidate) {// 发送 ICE 候选者到对方signalingServer.send({ type: 'ice-candidate', candidate: event.candidate });}
};// 接收对方的 ICE 候选者
signalingServer.on('ice-candidate', candidate => {peerConnection.addIceCandidate(new RTCIceCandidate(candidate));
});
  1. 建立连接并处理媒体流

当信令交换完成并且 ICE 候选者交换完毕后,WebRTC 将会建立一个完整的点对点连接,音视频流会开始传输。

示例:显示远端视频流

peerConnection.ontrack = event => {const remoteVideo = document.getElementById('remoteVideo');remoteVideo.srcObject = event.streams[0];  // 获取远程流并显示
};

5. 数据通道(RTCDataChannel)

WebRTC 还支持 RTCDataChannel,用于在两个客户端之间进行低延迟的点对点数据传输(例如文件传输、聊天信息等)。

示例:创建并使用数据通道
const dataChannel = peerConnection.createDataChannel('chat');// 监听数据通道的消息
dataChannel.onmessage = event => {console.log('Received message:', event.data);
};// 发送数据
dataChannel.send('Hello from WebRTC!');

6. 断开连接

当通信结束时,你可以通过关闭 PeerConnection 来断开连接并释放资源。

peerConnection.close();

WebRTC-Streamer开源项目

项目介绍

WebRTC-Streamer 是一个开源工具集,旨在简化实时音视频数据流的传输与集成,主要通过 WebRTC 技术实现低延迟的音视频流传输。开发者无需深入理解复杂的底层协议即可轻松将实时音视频功能集成到自己的应用中。该项目特别设计了高效的音视频流处理功能,支持多种数据来源,如 V4L2 捕获设备RTSP 流屏幕捕捉 等,适用于多种实时传输场景。

快速启动

WebRTC-Streamer 提供了简便的集成方式。以下是一个通过 HTML 和 JavaScript 快速搭建基本实时音视频流服务的示例代码:

<html>
<head><script src="libs/adapter.min.js"></script><script src="webrtcstreamer.js"></script>
</head>
<body>
<script>
var webRtcServer;
window.onload = function() {webRtcServer = new WebRtcStreamer(document.getElementById("video"), location.protocol+"//" + location.hostname + ":8000");webRtcServer.connect("rtsp://wowzaec2demo.streamlock.net/vod/mp4:BigBuckBunny_115k.mov");
}
window.onbeforeunload = function() {if (webRtcServer !== null) {webRtcServer.disconnect();}
}
</script>
<video id="video" controls autoplay muted></video>
</body>
</html>
代码解析
  • 引入了 adapter.min.jswebrtcstreamer.js 两个必要的 JavaScript 库。
  • 创建一个 WebRtcStreamer 实例,指定本地服务器地址及目标 RTSP 视频流地址。
  • 页面加载时自动连接至 RTSP 流,播放视频。
  • 页面卸载时,断开连接,释放资源。
应用案例与最佳实践

示例 1:直播演示

  • 使用 WebRTC-Streamer 可以通过简化的 Web 组件方式轻松展示来自 RTSP 源的实时视频流。
<webrtc-streamer url="rtsp://wowzaec2demo.streamlock.net/vod/mp4:BigBuckBunny_115k.mov">

示例 2:地图上的直播流

  • 配合 Google Map APIWebRTC-Streamer 可以在地图上显示多个实时视频流,适用于 监控交通管理 等领域。
其它生态项目

WebRTC-Streamer 还支持一系列相关生态项目,以扩展其功能和适用范围:

  • webrtc-streamer-card:为 Home Assistant 提供的卡片插件,允许从 WebRTC-Streamer 服务中拉取零延迟视频流,适用于智能家居。
  • rpi-webrtc-streamer:面向 树莓派 系列微控制器的 WebRTC 流媒体软件包,支持在边缘设备上实现高效的音视频处理。
  • Live555 Integration:通过整合 Live555 Media Server,增强 WebRTC-Streamer 在处理非标准音视频格式方面的能力,扩展其应用场景。

附录:WebRTC-Streamer项目地址

https://gitcode.com/gh_mirrors/we/webrtc-streamer/?utm_source=artical_gitcode&index=bottom&type=card&webUrl&isLogin=1

附录:webrtcstreamer.js源码

// webrtcstreamer.js
var WebRtcStreamer = (function() {/** * Interface with WebRTC-streamer API* @constructor* @param {string} videoElement - id of the video element tag* @param {string} srvurl -  url of webrtc-streamer (default is current location)*/var WebRtcStreamer = function WebRtcStreamer (videoElement, srvurl) {if (typeof videoElement === "string") {this.videoElement = document.getElementById(videoElement);} else {this.videoElement = videoElement;}this.srvurl           = srvurl || location.protocol+"//"+window.location.hostname+":"+window.location.port;this.pc               = null;    this.mediaConstraints = { offerToReceiveAudio: true, offerToReceiveVideo: true };this.iceServers = null;this.earlyCandidates = [];}WebRtcStreamer.prototype._handleHttpErrors = function (response) {if (!response.ok) {throw Error(response.statusText);}return response;}/** * Connect a WebRTC Stream to videoElement * @param {string} videourl - id of WebRTC video stream* @param {string} audiourl - id of WebRTC audio stream* @param {string} options -  options of WebRTC call* @param {string} stream  -  local stream to send*/WebRtcStreamer.prototype.connect = function(videourl, audiourl, options, localstream) {this.disconnect();// getIceServers is not already receivedif (!this.iceServers) {console.log("Get IceServers");fetch(this.srvurl + "/api/getIceServers").then(this._handleHttpErrors).then( (response) => (response.json()) ).then( (response) =>  this.onReceiveGetIceServers(response, videourl, audiourl, options, localstream)).catch( (error) => this.onError("getIceServers " + error ))} else {this.onReceiveGetIceServers(this.iceServers, videourl, audiourl, options, localstream);}}/** * Disconnect a WebRTC Stream and clear videoElement source*/WebRtcStreamer.prototype.disconnect = function() {		if (this.videoElement?.srcObject) {this.videoElement.srcObject.getTracks().forEach(track => {track.stop()this.videoElement.srcObject.removeTrack(track);});}if (this.pc) {fetch(this.srvurl + "/api/hangup?peerid=" + this.pc.peerid).then(this._handleHttpErrors).catch( (error) => this.onError("hangup " + error ))try {this.pc.close();}catch (e) {console.log ("Failure close peer connection:" + e);}this.pc = null;}}    /** GetIceServers callback*/WebRtcStreamer.prototype.onReceiveGetIceServers = function(iceServers, videourl, audiourl, options, stream) {this.iceServers       = iceServers;this.pcConfig         = iceServers || {"iceServers": [] };try {            this.createPeerConnection();var callurl = this.srvurl + "/api/call?peerid=" + this.pc.peerid + "&url=" + encodeURIComponent(videourl);if (audiourl) {callurl += "&audiourl="+encodeURIComponent(audiourl);}if (options) {callurl += "&options="+encodeURIComponent(options);}if (stream) {this.pc.addStream(stream);}// clear early candidatesthis.earlyCandidates.length = 0;// create Offerthis.pc.createOffer(this.mediaConstraints).then((sessionDescription) => {console.log("Create offer:" + JSON.stringify(sessionDescription));this.pc.setLocalDescription(sessionDescription).then(() => {fetch(callurl, { method: "POST", body: JSON.stringify(sessionDescription) }).then(this._handleHttpErrors).then( (response) => (response.json()) ).catch( (error) => this.onError("call " + error )).then( (response) =>  this.onReceiveCall(response) ).catch( (error) => this.onError("call " + error ))}, (error) => {console.log ("setLocalDescription error:" + JSON.stringify(error)); });}, (error) => { alert("Create offer error:" + JSON.stringify(error));});} catch (e) {this.disconnect();alert("connect error: " + e);}	    }WebRtcStreamer.prototype.getIceCandidate = function() {fetch(this.srvurl + "/api/getIceCandidate?peerid=" + this.pc.peerid).then(this._handleHttpErrors).then( (response) => (response.json()) ).then( (response) =>  this.onReceiveCandidate(response)).catch( (error) => this.onError("getIceCandidate " + error ))}/** create RTCPeerConnection */WebRtcStreamer.prototype.createPeerConnection = function() {console.log("createPeerConnection  config: " + JSON.stringify(this.pcConfig));this.pc = new RTCPeerConnection(this.pcConfig);var pc = this.pc;pc.peerid = Math.random();		pc.onicecandidate = (evt) => this.onIceCandidate(evt);pc.onaddstream    = (evt) => this.onAddStream(evt);pc.oniceconnectionstatechange = (evt) => {  console.log("oniceconnectionstatechange  state: " + pc.iceConnectionState);if (this.videoElement) {if (pc.iceConnectionState === "connected") {this.videoElement.style.opacity = "1.0";}			else if (pc.iceConnectionState === "disconnected") {this.videoElement.style.opacity = "0.25";}			else if ( (pc.iceConnectionState === "failed") || (pc.iceConnectionState === "closed") )  {this.videoElement.style.opacity = "0.5";} else if (pc.iceConnectionState === "new") {this.getIceCandidate();}}}pc.ondatachannel = function(evt) {  console.log("remote datachannel created:"+JSON.stringify(evt));evt.channel.onopen = function () {console.log("remote datachannel open");this.send("remote channel openned");}evt.channel.onmessage = function (event) {console.log("remote datachannel recv:"+JSON.stringify(event.data));}}pc.onicegatheringstatechange = function() {if (pc.iceGatheringState === "complete") {const recvs = pc.getReceivers();recvs.forEach((recv) => {if (recv.track && recv.track.kind === "video") {console.log("codecs:" + JSON.stringify(recv.getParameters().codecs))}});}}try {var dataChannel = pc.createDataChannel("ClientDataChannel");dataChannel.onopen = function() {console.log("local datachannel open");this.send("local channel openned");}dataChannel.onmessage = function(evt) {console.log("local datachannel recv:"+JSON.stringify(evt.data));}} catch (e) {console.log("Cannor create datachannel error: " + e);}	console.log("Created RTCPeerConnnection with config: " + JSON.stringify(this.pcConfig) );return pc;}/** RTCPeerConnection IceCandidate callback*/WebRtcStreamer.prototype.onIceCandidate = function (event) {if (event.candidate) {if (this.pc.currentRemoteDescription)  {this.addIceCandidate(this.pc.peerid, event.candidate);					} else {this.earlyCandidates.push(event.candidate);}} else {console.log("End of candidates.");}}WebRtcStreamer.prototype.addIceCandidate = function(peerid, candidate) {fetch(this.srvurl + "/api/addIceCandidate?peerid="+peerid, { method: "POST", body: JSON.stringify(candidate) }).then(this._handleHttpErrors).then( (response) => (response.json()) ).then( (response) =>  {console.log("addIceCandidate ok:" + response)}).catch( (error) => this.onError("addIceCandidate " + error ))}/** RTCPeerConnection AddTrack callback*/WebRtcStreamer.prototype.onAddStream = function(event) {console.log("Remote track added:" +  JSON.stringify(event));this.videoElement.srcObject = event.stream;var promise = this.videoElement.play();if (promise !== undefined) {promise.catch((error) => {console.warn("error:"+error);this.videoElement.setAttribute("controls", true);});}}/** AJAX /call callback*/WebRtcStreamer.prototype.onReceiveCall = function(dataJson) {console.log("offer: " + JSON.stringify(dataJson));var descr = new RTCSessionDescription(dataJson);this.pc.setRemoteDescription(descr).then(() =>  { console.log ("setRemoteDescription ok");while (this.earlyCandidates.length) {var candidate = this.earlyCandidates.shift();this.addIceCandidate(this.pc.peerid, candidate);				}this.getIceCandidate()}, (error) => { console.log ("setRemoteDescription error:" + JSON.stringify(error)); });}	/** AJAX /getIceCandidate callback*/WebRtcStreamer.prototype.onReceiveCandidate = function(dataJson) {console.log("candidate: " + JSON.stringify(dataJson));if (dataJson) {for (var i=0; i<dataJson.length; i++) {var candidate = new RTCIceCandidate(dataJson[i]);console.log("Adding ICE candidate :" + JSON.stringify(candidate) );this.pc.addIceCandidate(candidate).then( () =>      { console.log ("addIceCandidate OK"); }, (error) => { console.log ("addIceCandidate error:" + JSON.stringify(error)); } );}this.pc.addIceCandidate();}}/** AJAX callback for Error*/WebRtcStreamer.prototype.onError = function(status) {console.log("onError:" + status);}return WebRtcStreamer;})();if (typeof window !== 'undefined' && typeof window.document !== 'undefined') {window.WebRtcStreamer = WebRtcStreamer;}if (typeof module !== 'undefined' && typeof module.exports !== 'undefined') {module.exports = WebRtcStreamer;}

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/895619.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

沃德校园助手系统php+uniapp

一款基于FastAdminThinkPHPUniapp开发的为校园团队提供全套的技术系统及运营的方案&#xff08;目前仅适配微信小程序&#xff09;&#xff0c;可以更好的帮助你打造自己的线上助手平台。成本低&#xff0c;见效快。各种场景都可以自主选择服务。 更新日志 V1.2.1小程序需要更…

Linux 系统上以 root 用户身份运行 ./mysql.server start 命令,但仍然收到 “Permission denied” 错误

如图 1 所示&#xff0c;当在 Linux 系统上以 root 用户身份运行 ./mysql.server start 命令&#xff0c;但仍然收到 “Permission denied” 错误时&#xff0c;这通常不是由于权限不足&#xff08;因为您已经是 root 用户&#xff09;&#xff0c;而可能是由于 mysql.server 脚…

Android的Activity生命周期知识点总结,详情

一. Activity生命周期 1.1 返回栈知识点 二. Activity状态 2.1 启动状态 2.2 运行状态 2.3 暂停状态 2.4 停止状态 2.5 销毁状态 三. Activity生存期 3.1 回调方法 3.2 生存期 四. 体验Activity的生命周期 五. Activity被回收办法 引言&#xff1a; 掌握Acti…

Python----PyQt开发(PyQt基础,环境搭建,Pycharm中PyQttools工具配置,第一个PyQt程序)

一、QT与PyQT的概念和特点 1.1、QT QT是一个1991年由The Qt Company开发的跨平台C图形用户界面应用程序开发 框架&#xff0c;可构建高性能的桌面、移动及Web应用程序。也可用于开发非GUI程序&#xff0c;比如 控制台工具和服务器。Qt是面向对象的框架&#xff0c;使用特殊的代…

win10 系统 自定义Ollama安装路径 及模型下载位置

win10 系统 自定义Ollama安装路径 及模型下载位置 由于Ollama的exe安装软件双击安装的时候默认是在C盘&#xff0c;以及后续的模型数据下载也在C盘&#xff0c;导致会占用C盘空间&#xff0c;所以这里单独写了一个自定义安装Ollama安装目录的教程。 Ollama官网地址&#xff1…

微软官方出品GPT大模型编排工具:7个开源项目

今天一起盘点下&#xff0c;12月份推荐的7个.Net开源项目&#xff08;点击标题查看详情&#xff09;。 1、一个浏览器自动化操作的.Net开源库 这是一个基于 Google 开源的 Node.js 库 Puppeteer 的 .NET 开源库&#xff0c;方便开发人员使用无头 Web 浏览器抓取 Web、检索 Ja…

苹果CMS站群插件的自动生成功能:提升网站流量的秘诀

引言 在数字营销的浪潮中&#xff0c;站群技术因其强大的流量引导能力而备受青睐。苹果CMS作为一款优秀的内容管理系统&#xff0c;凭借其灵活性和可扩展性&#xff0c;成为了站群管理的理想选择。本文将详细介绍苹果CMS站群插件的自动生成功能&#xff0c;探讨如何通过这一功…

VS Code User和System版区别【推荐使用System版本】and VSCode+Keil协同开发之Keil Assistant

VS Code User和System版区别 Chapter1 VS Code User和System版区别1. 对于安装而言2. 结束语 Chapter2 VS Code 安装、配置教程及插件推荐插件&#xff1a; Chapter3 VSCodeKeil协同开发之Keil Assistant1. 效果展示2. Keil Assistant简介3. Keil Assistant功能特性4. 部署步骤…

大语言模型入门

大语言模型入门 1 大语言模型步骤1.1 pre-training 预训练1.1.1 从网上爬数据1.1.2 tokenization1.1.2.1 tokenization using byte pair encoding 1.3 预训练1.3.1 context1.3.2 training1.3.3 输出 1.2 post-training1&#xff1a;SFT监督微调1.2.1 token 1.3 强化学习1.3.1 基…

DeepSeek R1 本地部署和知识库搭建

一、本地部署 DeepSeek-R1&#xff0c;是幻方量化旗下AI公司深度求索&#xff08;DeepSeek&#xff09;研发的推理模型 。DeepSeek-R1采用强化学习进行后训练&#xff0c;旨在提升推理能力&#xff0c;尤其擅长数学、代码和自然语言推理等复杂任务 。 使用DeepSeek R1, 可以大大…

基于大数据的全国热门旅游景点数据分析系统的设计与实现

【大数据】基于大数据的全国热门旅游景点数据分析系统的设计与实现&#xff08;完整系统源码开发笔记详细部署教程&#xff09;✅ 目录 一、项目简介二、项目界面展示三、项目视频展示 一、项目简介 该系统主要包括登录注册、系统首页、图表分析、数据管理和个人信息五大功能模…

李宏毅机器学习笔记:【6.Optimization、Adaptive Learning Rate】

Optimization 1.Adaptive Learning Rate2.不同的参数需要不同的学习率3.Root Mean Square4.RMSProp5.Adam6.learning rate scheduling7.warm up总结 critical point不一定是你在训练一个network时候遇到的最大的障碍。 1.Adaptive Learning Rate 也就是我们要给每个参数不同的…

Task03:Ollama API 的使用

Ollama API 使用指南 简介 Ollama 提供了强大的 REST API&#xff0c;使开发者能够方便地与大语言模型进行交互。通过 Ollama API&#xff0c;用户可以发送请求并接收模型生成的响应&#xff0c;应用于自然语言处理、文本生成等任务。本文将详细介绍生成补全、对话生成的基本…

我用AI做数据分析之四种堆叠聚合模型的比较

我用AI做数据分析之四种堆叠聚合模型的比较 这里AI数据分析不仅仅是指AI生成代码的能力&#xff0c;我想是测试AI数据分析方面的四个能力&#xff0c;理解人类指令的能力、撰写代码的能力、执行代码的能力和解释结果的能力。如果这四个能力都达到了相当的水准&#xff0c;才可…

DC-6靶机渗透测试全过程

目录 前期准备 一、渗透测试 1.IP地址查询 2.端口信息搜寻 3.网页信息搜集 wappalyzer WPScan 反弹shell graham用户 反弹出jens的shell nmap提权 二、总结 前期准备 攻击机&#xff1a; kali windows11 靶机&#xff1a;DC-6靶机&#xff08;调至NAT模式&#xff0…

[操作系统] 基础IO:系统文件I/O

在 Linux 操作系统中&#xff0c;文件 I/O&#xff08;输入/输出&#xff09;是程序与文件系统交互的基础。理解文件 I/O 的工作原理对于编写高效、可靠的程序至关重要。本文将深入探讨系统文件 I/O 的机制。 一种传递标志位的方法 在 Linux 中&#xff0c;文件的打开操作通常…

滚动弹幕案例

滚动弹幕案例 一、需求 1.页面上漂浮字体大小不一、颜色不一&#xff0c;从左向右滚动的弹幕&#xff1b; 2.底部中间有一个发送功能&#xff0c;可以发送新的弹幕&#xff1b; 3.底部的发送部分可以向下收起和弹出。 二、html <div class"container"><…

【wiki知识库】08.添加用户登录功能--后端SpringBoot部分

目录 一、今日目标? 二、SpringBoot后端实现 2.1 新增UserLoginParam 2.2 修改UserController 2.3 UserServiceImpl代码 2.4 创建用户上下文工具类 2.5?通过token校验用户&#xff08;重要&#xff09; 2.6 创建WebMvcConfig 2.7 用户权限校验拦截器 一、今日目标 上…

在nodejs中使用RabbitMQ(六)sharding消息分片

RabbitMQ 的分片插件&#xff08;rabbitmq_sharding&#xff09;允许将消息分布到多个队列中&#xff0c;这在消息量很大或处理速度要求高的情况下非常有用。分片功能通过将消息拆分到多个队列中来平衡负载&#xff0c;从而提升消息处理的吞吐量和可靠性。它能够在多个队列之间…

【D2】神经网络初步学习

总结&#xff1a;学习了 PyTorch 中的基本概念和常用功能&#xff0c;张量&#xff08;Tensor&#xff09;的操作、自动微分&#xff08;Autograd&#xff09;、正向传播、反向传播。通过了解认识LeNet 模型&#xff0c;定义神经网络类&#xff0c;熟悉卷积神经网络的基本结构和…