我正在尝试使用Clarifai人脸检测模型,但是API存在一些严重问题。
它曾经在几周前工作大约6/10次(即使我使用相同的图像而没有更改任何东西,有时它也只能随机工作),但是现在我得到:无法加载资源:api.clarifai .com / v2 / models / searches:1服务器每次尝试发出请求时都响应400(错误请求)状态,而自上次以来我什么都没更改。
当我检查“网络”标签时,看到的响应是
{"status":{"code":11100,"description":"Bad request format","details":"Query must contain at least one of 'name', 'type', or 'model_type_id'. Check your request fields.","req_id":"ace310ecadbd40e1acce939f96ee8bf5"},"models":[]}
这是我最初使用的方法-以前可以使用,现在不再可用
app.models
.predict(
Clarifai.FACE_DETECT_MODEL,
this.state.input)
.then(response => {
if (response) {
fetch('http://localhost:3000/image', {
method:'put',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
id: this.state.user.id,
})
})
.then(response=>response.json())
.then(count => {
this.setState({users: {
entries: count
}})
})
我使用的第二种方法来自类似的StackOverflow问题:Clarifai - FACE DETECT - Model does not exist
我只更改了.predict()里面的内容
app.models
.predict(
{
model_id: 'a403429f2ddf4b49b307e318f00e528b',
version_id: '34ce21a40cc24b6b96ffee54aabff139'
},
this.state.input)
.then(response => {
if (response) {
fetch('http://localhost:3000/image', {
method:'put',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
id: this.state.user.id,
})
})
.then(response=>response.json())
.then(count => {
this.setState({users: {
entries: count
}})
})
}
我将不胜感激!
编辑:当我使用FACE_DETECTION_MODEL而不是FACE_DETECT_MODEL时,我的控制台出现了很多错误。
答案 0 :(得分:0)
您可以尝试将FACE_DETECT_MODEL替换为FACE_DETECTION_MODEL