def test_predictions_weak(self, client): picture = Picture.create(image_id='foobar.jpg') algorithm = Algorithm.create(name='DeevioNet', version='1.1') prediction = Prediction.create(picture_id=picture.id, algorithm_id=algorithm.id, proba=0.69) prediction = Prediction.create(picture_id=picture.id, algorithm_id=algorithm.id, proba=0.7) body = json.loads(client.get('/v1/predictions/weak').data) assert len(body) == 1
def test_predictions_by_image_id(self, client): picture = Picture.create(image_id='foobar.jpg') algorithm = Algorithm.create(name='DeevioNet', version='1.1') prediction = Prediction.create(picture_id=picture.id, algorithm_id=algorithm.id, proba=0.99, status='complete', label='nail', result='good', bbox=[100, 200, 500, 500]) body = json.loads(client.get('/v1/predictions/%s' % 'foobar.jpg').data) assert body['probability'] == prediction.proba assert body['status'] == prediction.status assert body['label'] == prediction.label assert body['result'] == prediction.result assert body['bbox'] == prediction.bbox assert body['algorithm']['type'] == 'GET' assert body['algorithm']['rel'] == 'algorithm' assert body['algorithm']['href'] == '/v1/algorithm/DeevioNet?version=1.1' assert body['picture']['type'] == 'GET' assert body['picture']['rel'] == 'picture' assert body['picture']['href'] == '/v1/picture/foobar.jpg'
def test_prediction_create_algorithm(self): algorithm = Algorithm.create() prediction = Prediction.create(algorithm_id=algorithm.id) assert prediction.algorithm == algorithm assert algorithm.predictions[-1] == prediction
def test_prediction_create_result(self, result): assert Prediction.create(result=result).result == result
def test_prediction_create_bbox(self, bbox): assert Prediction.create(bbox=bbox).bbox == bbox
def test_prediction_create_proba(self, proba): assert Prediction.create(proba=proba).proba == proba
def test_prediction_create_picture(self): picture = Picture.create() prediction = Prediction.create(picture_id=picture.id) assert prediction.picture == picture assert picture.predictions[-1] == prediction