const{createApp}=Vue const{createVuetify,useGoTo,useDisplay}=Vuetify var data={alert:{show:false,color:'success',text:'',timeout:0,},theme:{dark:false,},nav:{showDrawer:false,showTOC:true,tocPanel:0,tab:'account',post:{discussionId:6371,currentPage:1,targetPage:1,total:5,anchor:0,goToOptions:{container:null,duration:0,easing:'easeInOutCubic',offset:-100,},worker:null,task:[],active:[],apiLock:[],originLike:new Map([]),},related:{block:1,}},search:{width:80,text:null,loading:false,},tags:[{id:27,url:'/t/0e2e58346a045c7567770b2b3120',name:'Go',color:'#FFA726',icon:'mdi-language-go',},{id:28,url:'/t/3d104b0f6a045c7568772c310313',name:'Java',color:'#FFA726',icon:'mdi-language-java',},],posts:[{id:76330,num:0,uid:14092,content:'\u003Cp\u003E我是一个传统的 j**a 和 go 开发者,从没有接触过 ai 或者机器学习相关的内容,仅仅是从各种科普视频和文章大致了解了相关的实现原理。\u003C/p\u003E\u003Cp\u003E如果我想利用自定义 ai 或者自己训练的机器学习模型,实现一些简单功能,我该如何做呢,我对底层原理有浅显的了解,但深入了解的兴趣并不大,我只想快速实现一些简单功能。\u003C/p\u003E\u003Cp\u003E最常见的,比如我在阳台安装了一个摄像头正对着停车区,并能够通过 rtsp 协议获取到帧数据,如果我想实现通过自己训练的模型,实时监测每个车位当前是否有车,该如何做呢,我知道需要训练集,我可以从大量的监控画面中随机选择帧图片并手动标注,但如何开始训练自己的模型,我没有头绪。\u003C/p\u003E\u003Cp\u003E有什么类似快速实现或者脚手架工程类似的东西吗,感谢阅读\u003C/p\u003E',ipRegion:'',updatedByUid:0,createdAt:'2025-03-24 10:08:55',updatedAt:'2025-03-26 00:38:18',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:76331,num:1,uid:4084,content:'https://juejin.cn/post/7265968581841682492\u003Cbr\u003E\u003Cbr\u003E图片导入 https://roboflow.com/ 打标后导出 YOLOv8 数据集\u003Cbr\u003E\u003Cbr\u003E本地装了 YOLOv8 后(最新的是 11 ,建议用 8 版本),直接一键训练\u003Cbr\u003E\u003Cbr\u003E不用写一行代码就有模型了。\u003Cbr\u003E\u003Cbr\u003E调用的话最简单的方法:把 pt 后缀的模型转换成 onnx 。然后对应语言找 YOLOv8 的 onnx 调用示例',ipRegion:'',updatedByUid:0,createdAt:'2025-03-24 10:20:00',updatedAt:'2025-03-26 00:38:18',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:76332,num:2,uid:9192,content:'你这需求用 yolo 就可以实现,具体自己搜搜',ipRegion:'',updatedByUid:0,createdAt:'2025-03-24 10:20:05',updatedAt:'2025-03-26 00:38:18',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:76333,num:3,uid:678,content:'图像识别好像用 yolo 就行了\u003Cbr\u003Ej**a 可以用 https://github.com/deepj**alibrary/djl 调模型,这个是以前写的一些 demo: https://github.com/hligaty/d2l/blob/master/src/main/j**a/io/github/hligaty/demo/det/yolov5/YoloV5Model.j**a\u003Cbr\u003E学习的话可以看看 https://zh.d2l.ai/',ipRegion:'',updatedByUid:0,createdAt:'2025-03-24 10:36:28',updatedAt:'2025-03-26 00:38:18',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},{id:76334,num:4,uid:14092,content:'感谢回复~,我去研究一下 yolo',ipRegion:'',updatedByUid:0,createdAt:'2025-03-24 10:48:45',updatedAt:'2025-03-26 00:38:18',mentionNum:0,mentionedBy:[],mentionUsers:[],likeUsers:[],},],usersMap:new Map([[9192,{uid:9192,url:'/u/0b0457226a045c7e6163546f2d216436',avatar:'/a/0b0457226a045c7e6163546f2d216436',username:'TimePPT🤖',}],[4084,{uid:4084,url:'/u/6d2d02596a045c736062526f1f5f3c0c',avatar:'/a/6d2d02596a045c736062526f1f5f3c0c',username:'huiyadanli🤖',}],[678,{uid:678,url:'/u/1f1b430a6a045c77666d5e6f2251222e',avatar:'/a/1f1b430a6a045c77666d5e6f2251222e',username:'HaibaraDP🤖',}],[14092,{uid:14092,url:'/u/381842056a045d736063546f363e3a22',avatar:'/a/381842056a045d736063546f363e3a22',username:'soar0712🤖',}],]),related:[{title:'有在 vscode 上写 Java 的么?一个非常简单的扩展:可以一键复制 arthas 的 watch 命令。',url:'/d/0b26510b6a045c77606a567a455e606a5f011624',},{title:'大佬们平时都是怎样调试查看变量变化的? go 有哪些方便实时展示变量的库或工具?',url:'/d/221f67216a045c77606a567a455c636a23050963',},{title:'「郑州」招聘高级 Java 15K 上下,看个人水平',url:'/d/6a2d46346a045c77606a56754e58616a0e216467',},{title:'Cursor Go 开发,有哪些必装的插件?',url:'/d/337a733f6a045c77606a56754f5b6b6a39061e13',},{title:'在 Go 项目里,涉及到金额计算,大家一般用什么方式?',url:'/d/30267d146a045c77606a5675425d606a3f732227',},{title:'[全职]广州 - 潮汐 App - Golang 开发工程师',url:'/d/022a75356a045c77606a5675445d666a3b301504',},{title:'goland 如何远程开发?',url:'/d/1e1845056a045c77606a56754550676a29726b65',},{title:'开发了一个开箱即用的本地终端 Ztty',url:'/d/0c045a2e6a045c77606a5675455e6b6a3e200734',},{title:'go 部署到 1panel 上,是用源码运行 还是编译二进制运行!',url:'/d/193a435c6a045c77606a5675455c626a38360005',},{title:'[go 分布式定时任务框架] xxljob',url:'/d/357904216a045c77606a5675475f636a041a1663',},{title:'技术栈选择: Java 还是 Python',url:'/d/2878683b6a045c77606a5675475d616a083a1603',},{title:'Java 开发,接下来的路咋走啊?',url:'/d/1f78462e6a045c77606a5675475b656a1c37230a',},{title:'关于 Go 并发获取数据的问题,请教大家',url:'/d/687d67226a045c77606a5674415b646a1d3a3138',},{title:'windsurf 和 cursor 用来写 kotlin 后端还是不太行',url:'/d/2b780b5e6a045c77606a5674425a656a2d103a64',},{title:'Java 后端开发 , macbookAir m4 16+256G 入门款值得入手不,pdd6199 元,(之前那个 MacBookpro 2018 32G+512G 电脑坏了修起来要 4k 以上,没什么维修价值了)另外问一下够用不',url:'/d/200d00356a045c77606a5674435b6b6a0d276310',},{title:'macOS Goland 经常在双击 shift 全局搜索的时候,出现彩虹球,只能强制退出',url:'/d/380f58206a045c77606a5674435b666a15111c2a',},{title:'C++ 开发不想 996,如何跳槽转到 Java ?',url:'/d/09207c086a045c77606a56744358646a1f292613',},{title:'今天有个面试官和我讲 go 的协程比系统的线程更慢,这个我不能理解',url:'/d/182459046a045c77606a56744359626a1412041a',},{title:'Java 和 go 都会,以后找工作偏向哪个方面好呢',url:'/d/000b7b1b6a045c77606a5674445e656a1977262a',},{title:'大家 golang 项目里目前在用哪个 log 库打印日志呢?',url:'/d/623a67086a045c77606a5674455c646a5d0c1f65',},],} const App={setup(){const goTo=useGoTo() const{mdAndUp}=useDisplay() return{goTo,mdAndUp}},data(){return data;},mounted(){const themeDark=localStorage.getItem("themeDark") if(themeDark!==null){this.theme.dark=JSON.parse(themeDark)} if(this.nav.post.total>(this.nav.post.currentPage-1)*100+20){let moreLen=100 if(this.nav.post.total({id:null,num:(this.nav.post.currentPage-1)*100+v,uid:null,content:null,ipRegion:null,updatedByUid:null,createdAt:null,updatedAt:null,mentionNum:null,mentionedBy:null,mentionUsers:null,likeUsers:null,})) this.posts.push(...morePosts.slice(20))} this.workerStart() const hash=window.location.hash const match=hash.match(/#(\d+)/) if(match){const n=parseInt(match[1],10) if(n>=(this.nav.post.currentPage-1)*100&&n{this.jumpTo(n)})}} this.$nextTick(()=>{this.addHeadingIds() tocbot.init({tocSelector:'.toc',contentSelector:'#post-content-0',headingSelector:'h2, h3, h4',headingsOffset:100,scrollSmoothOffset:-100,scrollSmooth:true,collapseDepth:6,onClick:function(e){setTimeout(()=>{history.replaceState(null,'',window.location.pathname+window.location.search)},0)},}) tocbot.refresh()});},beforeUnmount(){this.workerStop() if(this.quill){this.quill.destroy() this.quill=null}},computed:{dposts(){return this.posts.slice(20);},},created(){},methods:{successAlert(msg){this.alert={show:true,color:'success',text:msg,timeout:1500,}},failureAlert(msg){this.alert={show:true,color:'error',text:msg,timeout:5000,}},flipThemeDark(){this.theme.dark=!this.theme.dark localStorage.setItem("themeDark",JSON.stringify(this.theme.dark))},toSearch(){if(!this.search.text){this.failureAlert('搜索词不能为空') return} let keywords=this.search.text.trim() if(keywords.length<1){this.failureAlert('搜索词不能为空') return} if(keywords.length>100){this.failureAlert('搜索词过长') return} this.doSearch(keywords)},toReg(){window.location.href="/reg"},toLogin(){window.location.href="/login"},toPage(){let url=window.location.href url=url.replace(/(\/\d+)?(#[0-9]+)?$/,this.nav.post.targetPage>1?`/${this.nav.post.targetPage}`:'') window.location.href=url},toLoadRelated({done}){if(this.my&&this.my.uid){this.apiLoadRelated({done})}else{done('ok')}},workerStart(){this.nav.post.worker=setInterval(()=>{this.workerLoad()},500);},workerStop(){if(this.nav.post.worker){clearInterval(this.nav.post.worker);this.nav.post.worker=null;}},async jumpTo(num){const page=Math.floor(num/100)+1 const i=num-(page-1)*100 if(page===this.nav.post.currentPage){this.goTo("#post-"+num,this.nav.post.goToOptions) if(!this.posts[i].id){const block=Math.floor(num/20)+1 this.nav.post.apiLock[block]=true await this.apiLoadPosts(block) this.$nextTick(()=>{this.goTo("#post-"+num,this.nav.post.goToOptions)})}}else{let url=window.location.href url=url.replace(/(\/\d+)?(#[0-9]+)?$/,page>1?`/${page}`:'') url=url+"#"+num window.location.href=url}},postIntersect(num){return(isIntersecting,entries,observer)=>{if(isIntersecting){this.nav.post.task.push(num) this.nav.post.active.push(num) this.nav.post.active=this.nav.post.active.filter(item=>Math.abs(item-num)<=5) this.nav.post.active.sort((a,b)=>a-b)}else{this.nav.post.active=this.nav.post.active.filter(item=>item!==num)} if(this.nav.post.active[0]){this.nav.post.anchor=this.nav.post.active[0]}else{this.nav.post.anchor=0}}},async apiLoadPosts(block){try{const response=await axios.post('/fapi/v1/post/block/'+block,{discussionId:this.nav.post.discussionId,}) if(response.data.code===0){response.data.data.posts.forEach(post=>{const i=post.num%100 Object.assign(this.posts[i],post)}) response.data.data.users.forEach(user=>{this.usersMap.set(user.uid,user)})}else{this.failureAlert('回帖数据加载失败: '+response.data.msg)}}catch(error){this.failureAlert('回帖数据加载失败: '+error)} this.nav.post.apiLock[block]=false},workerLoad(){while(this.nav.post.task.length){const num=this.nav.post.task.pop() const i=num-(this.nav.post.currentPage-1)*100 if(!this.posts[i].id){const block=Math.floor(num/20)+1 if(!this.nav.post.apiLock[block]){this.nav.post.apiLock[block]=true this.apiLoadPosts(block)}}}},getTimeInfo(t){if(!t){return ""} const now=new Date();const then=new Date(t);const diff=now-then;const minute=60*1000;const hour=minute*60;const day=hour*24;const month=day*30;const year=month*12;if(diffpost.num===num) if(!post){return "#"+num} const uid=post.uid const username=this.usersMap.get(uid)?.username if(!username){return "#"+num} return username},getUsernameByPostId(id){const post=this.posts.find(post=>post.id===id) if(!post){return "#"+this.getPostNumByPostId(id)} const uid=post.uid const username=this.usersMap.get(uid).username if(!username){return "#"+this.getPostNumByPostId(id)} return username},getPostNumByPostId(id){const post=this.posts.find(post=>post.id===id) return post.num},getPostById(id){const post=this.posts.find(post=>post.id===id) return post},getPostByNum(num){const post=this.posts.find(post=>post.num===num) return post},getAvatarByUid(uid){const avatar=this.usersMap.get(uid)?.avatar if(!avatar){return this.getRandomAvatar()} return avatar},getAvatarByPostNum(num){const post=this.posts.find(post=>post.num===num) if(!post){return this.getRandomAvatar()} const uid=post.uid return this.getAvatarByUid(uid)},getRandomAvatar(){const num=Math.floor(Math.random()*100) return "https://randomuser.me/api/portraits/men/"+num+".jpg"},getUrlByUid(uid){const url=this.usersMap.get(uid)?.url if(!url){return ""} return url},getTextByPostNum(num){const post=this.posts.find(post=>post.num===num) if(!post||!post.content){return '点击跳转到#'+num+'查看'} const parser=new DOMParser() const doc=parser.parseFromString(post.content,'text/html') const text=doc.body.textContent||'' return text.slice(0,100)},addHeadingIds(){const content=document.getElementById('post-content-0') if(!content){this.nav.showTOC=false return} const headings=content.querySelectorAll('h2, h3, h4') headings.forEach((heading,index)=>{if(!heading.id){heading.id=`toc-nav-${index}`}}) if(headings.length==0){this.nav.showTOC=false}},async doSearch(keywords){this.search.loading=true try{const response=await axios.post('/fapi/v1/search',{keywords:keywords,}) if(response.data.code===0){if(response.data.data.hash&&response.data.data.hash.length===32){window.location.href="/s/"+response.data.data.hash}else{this.failureAlert('搜索失败: 搜索服务异常')}}else{this.failureAlert('搜索失败: '+response.data.msg)}}catch(error){this.failureAlert('搜索失败: '+error)} this.search.loading=false},debounce(fn,delay){let timer=null return function(...args){if(timer)clearTimeout(timer) timer=setTimeout(()=>{fn.apply(this,args)},delay);};},},watch:{'nav.post.targetPage':{handler:async function(newV,oldV){this.toPage()},immediate:false},},} const vuetify=createVuetify({defaults:{global:{ripple:true,},},}) const app=createApp(App) app.use(vuetify).mount("#app")