我正在使用Tensorflow来识别提供的图片中的对象,遵循本教程并使用此repo我成功使我的程序返回图片中的对象.例如,这是我用作输入的图片:
这是我的程序的输出:
我想要的只是获得所识别物品的颜色(最后一种情况下的红色球衣),这可能吗?
这是代码(从最后一个链接只有很小的变化)
/* Copyright 2016 The TensorFlow Authors. All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either …Run Code Online (Sandbox Code Playgroud) 我目前正在研究一个项目,在该项目中,我需要构建一个应用程序,该应用程序需要在浏览器中打开URL才能使用其中的某些功能。
为此,我用的木偶,以打开在服务器端的浏览器,所以我可以使用它像一个API一个脚本的NodeJS里面。
这是代码(nodejs):
app.get('/do', (req, res) => {
console.log("ok");
(async() => {
var browser = await puppeteer.launch(
{ args: ['--no-sandbox','--disable-setuid-sandbox'], headless: false });
var page = await browser.newPage();
await page.goto('https://url.com');//i hid the url for personal reason
await page.waitFor(1000); // to wait for 1000ms
await page.waitFor('body div'); // to wait for the 'body div' selector in body
await page.waitFor(() => Math.random() < 0.5); // to wait for the predicate
await page.screenshot({
path: 'public/photo.png'
});
await browser.close();
await res.end('<html><head></title></head><body><h1><img src=photo.png …Run Code Online (Sandbox Code Playgroud)