question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Poor validation, is CSV generator working correctly ?

See original GitHub issue

Hello, I tried to make a “licenceplate” detector to get regions with retinanet and I annotated images to get that (don’t trust w and h, that are not width and height but x2 and y2 pixel coords):

image

So I saved CSV and get this format:

licenceplates/040603/P1010001.jpg,209,214,429,257,licenseplate

Of course there are several other images in CSV, that’s just a check !

And of course, classes.csv file is:

licenseplate,1

Then:

batch_size=16
image_side = 800
train_generator = csv_generator.CSVGenerator(
    'out/train.csv',
    csv_class_file='out/classes.csv',
    base_dir='.',
    batch_size=batch_size,
    image_max_side=image_side)
validation_generator = csv_generator.CSVGenerator(
    'out/validation.csv',
    csv_class_file='out/classes.csv', 
    base_dir='.',
    batch_size=batch_size,
    image_max_side=image_side)

epochs=100
ts = train_ds.shape[0] // batch_size
vs = validation_ds.shape[0] // batch_size
model = resnet.resnet_retinanet(2)
# model = vgg_retinanet(2)
model.compile(
    loss={
        'regression'    : losses.smooth_l1(),
        'classification': losses.focal()
    },
    optimizer=keras.optimizers.adam(lr=1e-5, clipnorm=0.001)
)
model.fit_generator(train_generator,
                    epochs=epochs,
                    verbose=1,
                    steps_per_epoch=ts,
                    validation_data=validation_generator,
                    validation_steps = vs)

I’ve got 0.4 in validation loss after 100 epochs, and boxes are not correct (that detects something else than licenseplates, as sun reflection, line on road, and so on)

Examples:

image

image

So I wonder:

  • are we ok that the format is ok for CSV => filename,x1,y1,x2,y2,classname
  • are we ok that 0,0 is the top left of image ?
  • are we ok that values are pixels and not a number between 0 and 1 ?

That should help me to understand what’s wrong 😃

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:12 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
metal3dcommented, Sep 12, 2018

@nuwanjkit I’m creating a web app named “imannotate” that prepares annotations. It returns a basic CSV containing image,label,coords. (https://github.com/smileinnovation/imannotate => devel branch)

Afterward, I only “download” each image and change “relative coords” to “pixel coords”, and I’m using the code that I gave in my first comment.

When I want to make prediction, I’m using the code in my second comment with “max_side” argument in “resize_image” function call corresponding to the “max_side” that I gave during the train process.

I’m writing a Medium article to work with imannotate tool, and maybe a Medium to treat CSV, train and predict on images 😉

0reactions
hgaisercommented, Sep 13, 2018

I think Slack will be better suited to have these discussions if you don’t mind 😃

Read more comments on GitHub >

github_iconTop Results From Across the Web

How To Do CSV File Validation And Schema Generation
Invalid CSV files create challenges for those building data pipelines. Pipelines value consistency, predictability, and testability as they ensure uninterrupted ...
Read more >
How to fix common CSV data formatting issues
FIX: Open the CSV file using any text editor like Notepad++ (https://notepad-plus-plus.org/) and just replace semi-colons with commas or vice- ...
Read more >
6 Rules for Creating Valid CSV Files - ThoughtSpot
Here are the rules for creating CSV files: · Separate data fields with a delimiter, usually a comma. · Keep each record on...
Read more >
Common CSV Template Error Messages and How to Fix Them
When creating CSV Templates, you will undoubtedly encounter errors that need to be fixed. These can be caused by problems or edge cases......
Read more >
CSV Validator 1.1
The CSV Validator will take a CSV Schema file and a CSV file, verify that the CSV Schema itself is syntactically correct and...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found