function classifyMany($classify_many_id, $image_list) { ini_set('memory_limit', '512M'); $client = new GuzzleHttp\Client(); $digits_response = $client->post('http://arcos.io:5000/models/images/classification/classify_many.json', ['multipart' => [['name' => 'job_id', 'contents' => '20161024-081150-5437'], ['name' => 'image_list', 'contents' => fopen($image_list, 'r')]]]); if ($digits_response->getStatusCode() == 200) { $digits_classifications = json_decode($digits_response->getBody())->classifications; $traffic_signs = array(); foreach ($digits_classifications as $image => $classifications) { $classification = $classifications[0]; $spain_id = $classification[0]; $confidence = $classification[1]; if (array_key_exists($spain_id, $traffic_signs)) { $traffic_sign = $traffic_signs[$spain_id]; } else { $traffic_sign = TrafficSignClass::where('spain_id', '=', $spain_id)->first(); $traffic_signs[$spain_id] = $traffic_sign; } $classify_many_sample = new ClassifyManySample(); $classify_many_sample->sample_image = basename($image); $classify_many_sample->class_id = $traffic_sign['id']; $classify_many_sample->confidence = $confidence; $classify_many_sample->classify_many_id = $classify_many_id; $classify_many_sample->save(); } return $digits_classifications; } else { return null; } }
$classify_one_predictions = $response['predictions']; } } else { if (isset($_POST["action"]) && $_POST["action"] == "submitImageList") { $response = processImageList(); if (isset($response) && $response['success'] && is_numeric($response['id']) && $response['id'] > 0) { $classify_many_id = $response["id"]; } } else { if (isset($_GET['classify_many']) && is_numeric($_GET['classify_many'])) { $classify_many_id = $_GET['classify_many']; } } } if (isset($classify_many_id) && is_numeric($classify_many_id)) { $classify_many_predictions = ClassifyManySample::where('classify_many_id', '=', $classify_many_id)->with('_class')->get()->toArray(); $current_page = isset($_GET['page']) ? (int) $_GET['page'] : 1; $items_per_page = 15; $current_items = array_slice($classify_many_predictions, $items_per_page * ($current_page - 1), $items_per_page); $paginator = new Illuminate\Pagination\LengthAwarePaginator($current_items, count($classify_many_predictions), $items_per_page, $current_page); $paginator->setPath('classifier.php'); $paginator->appends(['classify_many' => $classify_many_id]); $presenter = new Landish\Pagination\Materialize($paginator); } $title = "Classifier"; include_once "include/header.inc.php"; ?> <div class="section"> <div class="row"> <div class="col s12">