generate_nl_black_code
Fine-tuned VQA BLIP model for reading the black code (zwartecode) off of Dutch traffic signs. Trained on cropped sign images from the Panoramax platform.
This model is the third stage in a four-step pipeline:
- Detection β
Panoramax/detect_face_plate_signlocalises the sub-sign crop - Classification β this model identifies the traffic sign class from the crop
- Black code generation β this model generates the black code on the traffic sign from the crop
- Zone type classification β this model identifies the zone type of the traffic sign on the crop
Why have a separate model for reading the black codes?
For most Dutch traffic signs, the classification model from step 2 has a separate class. For instance, there is one class for zebra crossing signs and a separate one for weight limit signs. However, the model does not distinguish between a weight limit sign with weight limit 7.5 tons and a weight limit sign with limit 20 tons. The black code generation model adds exactly this distinction by reading the numerical values off of the traffic signs. An exception are speed limit signs. For these, there was so much training data that the classification model in step 2 could be trained to have an individual class for each speed.
Model details
| Property | Value |
|---|---|
| Architecture | BLIP (Salesforce) |
| Base model | Salesforce/blip-vqa-base |
| Fine-tuning epochs | 3 |
| Training images | 622 |
| Validation images | 147 |
Which sign classes from step 2 need to be fed into the black code generation model?
"maxaxleweight", "maxweight", "maxheight", "maxlength", "maxwidth", "hazard_incline"
| ID | Class | Description |
|---|---|---|
| 0 | maxaxleweight |
maximum weight allowed to be transmitted to the road through one axle or axle group |
| 1 | maxweight |
maximum allowed weight of a vehicle |
| 2 | maxheight |
maximum allowed height of a vehicle |
| 3 | maxlength |
maximum allowed length of a vehicle |
| 4 | maxwidth |
maximum allowed width of a vehicle |
| 5 | hazard_incline |
warning that there is an incline coming up ahead |
Performance
Validation set (147 images)
| Metric | Value |
|---|---|
| Exact-match accuracy | 91.2% |
Usage
from transformers import BlipProcessor, BlipForQuestionAnswering
processor = BlipProcessor.from_pretrained("akniele/blip_read_sign_codes")
model = BlipForQuestionAnswering.from_pretrained("akniele/bip_read_sign_codes")
question = "What number do you see on the sign?"
inputs = processor(raw_image, question, return_tensors="pt")
out = model.generate(**inputs)
print(processor.decode(out[0], skip_special_tokens=True))
The model expects a cropped image of a sign β not a full street photo.
Use Panoramax/detect_face_plate_sign to obtain the crop first.
Training
| Parameter | Value |
|---|---|
| Epochs | 3 |
| Batch size | 4 |
| Image size | 384 Γ 384 |
| Optimizer | AdamW |
| Initial LR | 0.01 |
The training dataset used for this model is based on the dataset Panoramax/Panoramax/classified_nl_road_signs.
Dataset
See Panoramax/???
for the training and validation images.
License
Creative Commons Attribution-ShareAlike 4.0 International (CC BY-SA 4.0)
- Downloads last month
- 92
Model tree for akniele/blip_read_sign_codes
Base model
Salesforce/blip-vqa-base