清理缓存
2024-06-29 14:15:08
//清理cookie Quark.Chromium().DeleteCookies("", "", false) //清理storage Quark.Chromium().FlushCookieStore(true)
浏览器图片鉴定内存无限上涨:
原因,JS中没有是否图片资源:
//鉴黄信号 ipc.on('jianhuang', function (web, urlMd5, fileMd5 , data) { const img = new Image(); img.src = data; img.onload = function() { nsfwModel.classify(img).then(predictions => { let Porn = ""; let zong = 0; predictions.forEach(function(ele) { zong += (ele.probability * 100).toFixed(2); $("#jgdemo ." + ele.className).html((ele.probability * 100).toFixed(2)); if (ele.className == "Porn") { Porn = (ele.probability * 100).toFixed(2); } }); if (zong == 0) { console.log("识别失败"); Porn = "0.02"; } ipc.emit('jianhuangJG', [web, urlMd5, fileMd5, Porn]); let str = $("#jgdemo").html(); $("#jg").html('<div class="jcjg">' + shijian() + " " + '<small>' + fileMd5 + '</small>' + str + '</div>'); // $("#setu").attr("src", data); // 释放图像对象 img.src = ''; }).catch(error => { // 处理分类过程中的任何错误 console.error("分类过程中出错:", error); let Porn = "0.01"; ipc.emit('jianhuangJG', [web, urlMd5, fileMd5, Porn]); $("#jg").html('<div class="jcjg">' + shijian() + " " + '<small>' + fileMd5 + '</small>' + "识别过程中出错</div>"); // 释放图像对象 img.src = ''; }); }; //图片加载失败了 img.onerror = function() { ipc.emit('jianhuangJG', [ web, urlMd5, fileMd5 , 0.01 ] ); console.log(file.name,"img加载失败" ); // 释放图像对象 img.src = ''; } })