- Project type: Object detection
- Operating system: Windows 10 Pro v10.0.19044, making API requests in Node v16.13.1
The problem:
I’ve trained a model using Roboflow train via the API (the /train endpoint), which seemed to have worked fine, until testing the model out. The model is trying to detect the following class labels:
dime
nickel
penny
quarter
But the dataset version used to train this model contains only 26 images all of which are labelled ‘holly’. This is the only label used in my dataset, I have no idea where the ‘coin-related’ labels are coming from. The only reasonable explanation I can think of is that the problem is occurring on the API-side, and my project ID has been mixed up with someone else’s?
The project I’m referring to is https://app.roboflow.com/iadt/6439775c84bbfd58df9cb753/7
For context, here’s the code I’ve used to train the model. Please keep in mind that this code works absolutely fine in terms of triggering the training process, it’s the result that’s the issue:
const train = (project, version) => {
return new Promise(async (resolve, reject) => {
// first check if already generating a model. if so, do not let the user generate another model - will cause havoc in terms of model accuracy, since it trains the same model twice.
await getTrainingStatus(project, version)
.then(async (trainingDetails) => {
if(Object.keys(trainingDetails.version.model).length){
// this dataset version already has a model. there can be only 1 per version.
reject('Please generate a new version to train a model')
}
if(!trainingDetails?.version?.generating){
// this call starts the training process
await axios.post(`https://api.roboflow.com/iadt/${project}/${version}/train?api_key=${process.env.ROBOFLOW_API_KEY}`)
.then(async (res) => {
let status = "training";
setInterval(async () => {
if(status === 'training'){
// this call checks on the status of the training process
await getTrainingStatus(project, version)
.then(async (trainingDetails) => {
// if res.version.generating = false, training has stopped (I think)
if(!trainingDetails?.version?.generating){
// change training status to break out of the interval and resolve
status = "done"
// maybe use websocket here? keep updating the user on the training status
}
})
.catch((e) => {
reject('Failed to check training status: ', e)
})
}
else{
resolve('Training has finished')
}
}, 5000)
})
.catch((e) => {
reject('Failed to begin training process: ', e)
})
}
else{
reject('A version is already generating. Please wait for it to finish before generating another version.')
}
})
.catch((e) => {
reject("Error while determining training status: ", e)
})
});
};