Car Recognition Model
Content list
Description
This article describes how to use our car predicting model via API. The model is trained to recognize the brand and the model of a car based on its photo. The dataset used to train it was enhanced during the process using various random techniques of rotating, skewing, and cropping of the images.
The model can be used via our API for various tasks like:
- live car recognition using camera
- pre-checking the image uploads in online car markets
- connecting with a multi-object classifying net – additional details for cars
- identification or suggestion based on very few details
Check out our simple visual demo at https://demo.mlapi.io/cars.
Currently recognizable models
The list below contains all car models recognized by our NN.
Every entry is formatted in a following manner: cars-brand_cars-model
.
The total number of currently recognizable models is 439
.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 |
skoda_octavia skoda_kodiaq skoda_fabia skoda_yeti skoda_citigo skoda_felicia skoda_superb skoda_roomster skoda_rapid subaru_impreza subaru_legacy subaru_outback subaru_xv subaru_forester subaru_justy lexus_ls lexus_nx lexus_rx lexus_ct lexus_is lexus_gs opel_adam opel_astra opel_vectra opel_zafira opel_tigra opel_omega opel_agila opel_antara opel_corsa opel_combo opel_insignia opel_signum opel_frontera opel_vivaro opel_karl opel_crossland-x rover_75 porsche_cayenne porsche_macan porsche_panamera porsche_911 suzuki_swift suzuki_jimny suzuki_sx4 suzuki_sx4-s-cross suzuki_liana suzuki_samurai suzuki_wagon-r+ suzuki_vitara suzuki_celerio suzuki_splash suzuki_grand-vitara suzuki_baleno suzuki_alto smart_fortwo smart_forfour dodge_grand-caravan dodge_caliber dodge_challenger dodge_ram dodge_journey alfa-romeo_147 alfa-romeo_gt alfa-romeo_giulietta alfa-romeo_mito alfa-romeo_stelvio alfa-romeo_156 alfa-romeo_giulia dacia_sandero-stepway dacia_sandero dacia_duster dacia_lodgy dacia_logan dacia_dokker ford_focus-c-max ford_fiesta ford_c-max ford_b-max ford_edge ford_fusion ford_tourneo-connect ford_f150 ford_transit-custom ford_ranger ford_mondeo ford_focus ford_grand-c-max ford_transit-connect ford_ka ford_kuga ford_galaxy ford_mustang ford_transit ford_maverick aixam_city bmw_seria-3 bmw_seria-2 bmw_seria-1 bmw_seria-7 bmw_seria-6 bmw_seria-5 bmw_seria-4 bmw_x5-m bmw_z4 bmw_x3 bmw_x1 bmw_m3 bmw_x6 bmw_x5 bmw_x4 mercedes-benz_glc mercedes-benz_gle mercedes-benz_citan mercedes-benz_cl mercedes-benz_clk mercedes-benz_cla mercedes-benz_gls mercedes-benz_w201-(190) mercedes-benz_cls mercedes-benz_klasa-c mercedes-benz_klasa-b mercedes-benz_klasa-a mercedes-benz_klasa-e mitsubishi_lancer mitsubishi_asx mitsubishi_lancer-evolution mitsubishi_galant mitsubishi_pajero mitsubishi_outlander mitsubishi_grandis mitsubishi_carisma mitsubishi_colt mitsubishi_space-star mitsubishi_l200 daewoo_nubira daewoo_lanos daewoo_kalos daewoo_matiz jaguar_f-pace jaguar_s-type jaguar_x-type jaguar_xe jaguar_xf jaguar_xj nissan_pulsar nissan_pathfinder nissan_almera nissan_navara nissan_micra nissan_patrol nissan_murano nissan_nv200 nissan_x-trail nissan_primera nissan_almera-tino nissan_note nissan_tiida nissan_terrano nissan_pixo nissan_qashqai+2 nissan_primastar nissan_qashqai nissan_juke toyota_corolla-verso toyota_yaris toyota_celica toyota_avensis toyota_auris toyota_corolla toyota_aygo toyota_proace toyota_hilux toyota_sienna toyota_c-hr toyota_verso toyota_land-cruiser toyota_prius toyota_previa toyota_avensis-verso toyota_yaris-verso toyota_camry toyota_rav4 volvo_c30 volvo_s80 volvo_s90 volvo_v90 volvo_v70 volvo_xc-70 volvo_v50 volvo_v60 volvo_xc-60 volvo_s60 volvo_xc-90 volvo_s40 volvo_v40 volvo_c70 mini_one mini_cooper mini_clubman mini_countryman mini_cooper-s seat_toledo seat_mii seat_arosa seat_leon seat_altea seat_alhambra seat_exeo seat_cordoba seat_altea-xl seat_ateca audi_q7 audi_q5 audi_q2 audi_q3 audi_80 audi_tt audi_a6-allroad audi_a6 audi_a7 audi_a4 audi_a5 audi_s8 audi_a3 audi_a1 audi_s4 audi_a2 audi_s6 audi_a8 audi_s3 chevrolet_matiz chevrolet_captiva chevrolet_aveo chevrolet_camaro chevrolet_rezzo chevrolet_corvette chevrolet_lacetti chevrolet_nubira chevrolet_spark chevrolet_kalos chevrolet_cruze saab_9-5 saab_9-3 honda_cr-v honda_odyssey honda_accord honda_fr-v honda_jazz honda_civic honda_hr-v honda_city isuzu_d-max hyundai_i40 hyundai_matrix hyundai_tucson hyundai_atos hyundai_i10 hyundai_terracan hyundai_getz hyundai_ix20 hyundai_santa-fe hyundai_i20 volkswagen_polo volkswagen_bora volkswagen_touran volkswagen_amarok volkswagen_beetle volkswagen_phaeton volkswagen_multivan volkswagen_cc volkswagen_golf-plus volkswagen_crafter volkswagen_jetta volkswagen_fox volkswagen_transporter volkswagen_passat-cc volkswagen_scirocco volkswagen_caravelle volkswagen_sharan volkswagen_caddy volkswagen_golf volkswagen_tiguan volkswagen_eos volkswagen_up! volkswagen_new-beetle volkswagen_lupo volkswagen_golf-sportsvan volkswagen_passat volkswagen_arteon volkswagen_touareg volkswagen_garbus mazda_cx-3 mazda_cx-5 mazda_cx-7 mazda_cx-9 mazda_mx-5 mazda_tribute mazda_6 mazda_5 mazda_3 mazda_2 mazda_premacy mazda_mpv mazda_626 mazda_323f infiniti_fx kia_rio kia_carnival kia_venga kia_optima kia_picanto kia_cee'd kia_cerato kia_pro_cee'd kia_sorento kia_sportage kia_carens kia_soul peugeot_407 peugeot_406 peugeot_expert peugeot_1007 peugeot_607 peugeot_4007 peugeot_partner peugeot_106 peugeot_107 peugeot_boxer peugeot_807 peugeot_207-cc peugeot_3008 peugeot_2008 peugeot_308 peugeot_206-plus peugeot_301 peugeot_306 peugeot_307 peugeot_207 peugeot_206 peugeot_208 peugeot_5008 peugeot_rcz peugeot_508 peugeot_bipper peugeot_307-cc peugeot_206-cc fiat_fiorino fiat_ulysse fiat_bravo fiat_doblo fiat_punto-2012 fiat_grande-punto fiat_500 fiat_stilo fiat_croma fiat_idea fiat_sedici fiat_tipo fiat_punto fiat_punto-evo fiat_seicento fiat_freemont fiat_126 fiat_500l fiat_scudo fiat_panda fiat_linea fiat_qubo fiat_500x fiat_125p fiat_ducato renault_captur renault_thalia renault_grand-espace renault_kadjar renault_laguna renault_scenic renault_twingo renault_vel-satis renault_clio renault_trafic renault_talisman renault_grand-scenic renault_master renault_fluence renault_koleos renault_modus renault_espace renault_kangoo renault_megane jeep_grand-cherokee jeep_wrangler jeep_cherokee jeep_renegade daihatsu_cuore daihatsu_terios daihatsu_materia daihatsu_sirion land-rover_discovery-sport land-rover_range-rover-sport land-rover_range-rover land-rover_defender land-rover_discovery land-rover_freelander land-rover_range-rover-evoque chrysler_sebring chrysler_pt-cruiser chrysler_town-&-country chrysler_grand-voyager chrysler_voyager chrysler_pacifica chrysler_300c citroen_xsara citroen_berlingo citroen_ds5 citroen_ds4 citroen_c-elysée citroen_c-crosser citroen_saxo citroen_c3-picasso citroen_c1 citroen_c2 citroen_c3 citroen_jumpy-combi citroen_c5 citroen_c8 citroen_c4-picasso citroen_c4-grand-picasso citroen_jumper citroen_c4-cactus ssangyong_kyron ssangyong_rexton ssangyong_korando ssangyong_tivoli lancia_musa lancia_ypsilon lancia_phedra lancia_delta |
Models architecture
The model is based on 6 Convolutional layers, 2 Dense layers interlaced with a single Dropout layer. The total amount of parameters is below 4 million.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
_________________________________________________________________ Layer (type) Output Shape Param # ================================================================= zero_padding2d_1 (ZeroPaddin (None, 255, 255, 3) 0 _________________________________________________________________ conv2d_1 (Conv2D) (None, 127, 127, 64) 1792 _________________________________________________________________ conv2d_2 (Conv2D) (None, 63, 63, 64) 36928 _________________________________________________________________ conv2d_3 (Conv2D) (None, 31, 31, 128) 73856 _________________________________________________________________ conv2d_4 (Conv2D) (None, 15, 15, 128) 147584 _________________________________________________________________ conv2d_5 (Conv2D) (None, 7, 7, 256) 295168 _________________________________________________________________ conv2d_6 (Conv2D) (None, 3, 3, 256) 590080 _________________________________________________________________ flatten_1 (Flatten) (None, 2304) 0 _________________________________________________________________ dense_1 (Dense) (None, 1024) 2360320 _________________________________________________________________ dropout_1 (Dropout) (None, 1024) 0 _________________________________________________________________ dense_2 (Dense) (None, 439) 449975 ================================================================= Total params: 3,955,703 |
The models loss and accuracy plot can be found here.
Authentication
To be able to communicate with MLAPI service you need to have a user account created. The best way for this to happen is to contact us via office@ermlab.com.
When you already got your credentials you can login in the following manner:
CURL
1 2 3 4 |
curl "https://api.mlapi.io/auth" \ -X POST \ -d '{"username":"test", "password":"test"}' \ -H "Content-Type: application/json" |
JavaScript, ES6+
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
let token = ""; fetch("https://api.mlapi.io/auth", { method : "post", headers: { 'Content-Type': 'application/json', }, body : JSON.stringify({ "username" : "test", "password" : "test" }) }).then((resp) => { token = resp.json().access_token; }); |
Python
1 2 3 4 |
import requests as r token = r.post("https://api.mlapi.io/auth", json={"username" : "test", "password" : "test"}).json().get('access_token') |
The response from the server on positive authentication should look like this:
1 2 3 |
{ "access_token": "XXXXlong.tokenXXXX" } |
Authorization and sample requests
Every request you want to send to the server should have your TOKEN appended.
As we are using JWT for authentication and authorization the manner you should append the TOKEN is as follows:
Sending a Base64 encoded image
CURL
1 2 3 4 5 |
curl "https://api.mlapi.io/v2/cars" \ -X POST \ -H "Authorization: JWT XXXXtokenYouObtainedXXXX" \ -H "Content-Type: application/json" \ -d '{"image" : "data:image/png;base64, ABCDEF"}' |
JavaScript, ES6+
1 2 3 4 5 6 7 8 9 10 11 12 13 |
let response = ""; fetch("https://api.mlapi.io/v2/cars", { method : "post", headers : { 'Authorization' : 'JWT ' + token, 'Content-Type' : 'application/json', }, body : JSON.stringify({ "image" : "data:image/png;base64, ABCDEF" }) }).then((resp) => { response = resp.json(); }); |
Python
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
import requests as r class MyAuth(r.auth.AuthBase): def __init__(self, token): self.token = token def __call__(self, request): request.headers["Authorization"] = "JWT {}".format(self.token) return request ################################################################################# ##### Getting token, see ##### https://mlapi.io/machine-learning/car-brand-and-model-recognition/#auth ################################################################################# r.post("https://api.mlapi.io/v2/cars", auth = MyAuth(token), json={"image" : "data:image/png;base64, ABCDEF"}).json() |
Sending a binary image
CURL
1 2 3 4 5 |
curl "https://api.mlapi.io/v2/cars" \ -X POST \ -H "Authorization: JWT XXXXtokenYouObtainedXXXX" \ -H "Content-Type: image/jpeg" \ --data-binary "@image_name.jpg" |
JavaScript, ES6+
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
///////////////////////////////////////////////////////// // The easiest way is just to convert the image to Base64 // with the built-in FileReader function. Getting token, see // https://mlapi.io/machine-learning/car-brand-and-model-recognition/#auth ///////////////////////////////////////////////////////// var i = document.createElement("INPUT"); i.setAttribute("type", "file"); i.onchange = ()=>{handleFileAdded(i.files[0])}; document.body.appendChild(i); function handleFileAdded(img) { var reader = new FileReader(), response = ""; reader.addEventListener("load", ()=> { fetch("https://api.mlapi.io/v2/cars", { method : "post", headers: { 'Authorization': 'JWT ' + token, 'Content-Type': 'application/json', }, body : JSON.stringify({"image": reader.result}) }).then((resp) => { response = resp.json(); }); }, false); if (img){ reader.readAsDataURL(img); } } |
Python
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
import requests as r class MyAuth(r.auth.AuthBase): def __init__(self, token): self.token = token def __call__(self, request): request.headers["Authorization"] = "JWT {}".format(self.token) return request ################################################################################# ##### Getting token, see ##### https://mlapi.io/machine-learning/car-brand-and-model-recognition/#auth ################################################################################# with open("./my_car.jpg", "rb") as f: data = f.read() r.post("https://api.mlapi.io/v2/cars", auth = MyAuth(token), data = data, headers={'Content-Type': 'image/jpeg'}).json() |
Valid response (The result structure will change in the next version)
1 2 3 4 5 6 7 8 9 10 |
{ "result": [ "land-rover_discovery 89.923%,", "honda_cr-v 3.279%,", "subaru_forester 3.223%,", "suzuki_grand-vitara 1.058%,", "land-rover_range-rover 0.898%," ] } |
Want to try it out without all the typing? Check out our simple visual demo at https://demo.mlapi.io/cars