Skip to main content

Hi Team,

I worked to create the annotions.txt ( https://www.safe.com/blog/2019/01/fme-does-computer-vision/ ) , but when I used the transformer RasterObjectDetectorSamplePreparer - I didnt't success.

i received the error information on Data Inspector: 

fme_rejection_message (encoded: UTF-8): Internal OpenCV Error has occured: b'Unable to open image: C:\\Solutial\\ML_Lixeiras\\ML_Detector\\C:/Solutial/ML_Lixeiras/Positive/Novas\\1.jpg\r\nOpenCV: terminate handler is called! The last OpenCV error is:\r\nOpenCV(3.4.3) Error: Assertion failed (0 <= roi.x && 0 <= roi.width && roi.x + roi.width <= m.cols && 0 <= roi.y && 0 <= roi.height && roi.y + roi.height <= m.rows) in cv::Mat::Mat, file c:\\build\\3_4_winpack-build-win64-vc15\\opencv\\modules\\core\\src\\matrix.cpp, line 465\r\n'

My configuration:

0684Q00000ArBCgQAN.jpg

 

Version: FME(R) 2019.0.1.0 (20190506 - Build 19253 - WIN64)

 

@dmitribagh

Thanks,

Danilo

hi @danilo_fme,

 

This error might appear when your annotation coordinates exceed the extents of the raster (for example, your raster is 100 by 100 pixels, and you place the annotation frame to go from 90th to 102nd pixel).

 

 

Did you use the utility that comes with OpenCV (opencv_annotation.exe) or some other method?

Unfortunately, everything involving opencv requires extra attention to every tiny detail - from file encoding to paths to boundaries - a single error leads to a failure with no good error message :(

 

 

Dmitri

hi @danilo_fme,

 

This error might appear when your annotation coordinates exceed the extents of the raster (for example, your raster is 100 by 100 pixels, and you place the annotation frame to go from 90th to 102nd pixel).

 

 

Did you use the utility that comes with OpenCV (opencv_annotation.exe) or some other method?

Unfortunately, everything involving opencv requires extra attention to every tiny detail - from file encoding to paths to boundaries - a single error leads to a failure with no good error message :(

 

 

Dmitri

Hi @dmitribagh

First - thank you your reply.

My annotations.txt was created using line command and draw option  like describe the blog:

C:\apps\FME2019\plugins\opencv\opencv_annotation.exe --annotations="C:\Temp\StopSignDataset\annotations.txt" --images="C:\Temp\StopSignDataset\Positive\" --maxWindowHeight=1000

 

My annotations:

0684Q00000ArMYpQAN.jpg

 

Thanks your help and time.

 

Danilo


Hi @danilo_fme,

try using relative paths to images - relative to your annotation file.

For example, if your annotation.txt is in c:\\ROD\\, and images are in c:\\ROD\\Positives\\, use

Positives\\image1.jpg 1 10 10 20 20

 

 

instead of

 

c:\\ROD\\Positives\\image1.jpg 1 10 10 20 20

When you change the annotation file, make sure it stays in the original encoding - OpenCV does not like Unicode. Also delete all the rows with zero images (for example, if you skipped an image while making annotations).

I know, this is a bit (or a lot) confusing, but that's how OpenCV often works, I am sorry about that. And please keep me posted about your progress/struggles, I really want to help you with this.

Dmitri


Hi @danilo_fme,

try using relative paths to images - relative to your annotation file.

For example, if your annotation.txt is in c:\\ROD\\, and images are in c:\\ROD\\Positives\\, use

Positives\\image1.jpg 1 10 10 20 20

 

 

instead of

 

c:\\ROD\\Positives\\image1.jpg 1 10 10 20 20

When you change the annotation file, make sure it stays in the original encoding - OpenCV does not like Unicode. Also delete all the rows with zero images (for example, if you skipped an image while making annotations).

I know, this is a bit (or a lot) confusing, but that's how OpenCV often works, I am sorry about that. And please keep me posted about your progress/struggles, I really want to help you with this.

Dmitri

Hi @dmitribagh,

Thanks your informations. Yours tips were valuable for my case.

I did make the changes in the way of annotation file and is Works now the transformer RasterObjectDetectorSamplePreparer. Very Nice.

 

Now I'm going to try to works the transformer RasterObjectDetectionModelTrainer

 

I'll keep you inform my progress.

 

Thanks,

Danilo


@dmitribagh: I'm dealing with the same issue: I've tried using the kept_-file as well as relative paths in the annotation file. Features are processed correctly, although they are being rejected by the transformer. I'm using geotiff images btw. These should be supported by opencv.

Any ideas?

Kind regards,

Ronny


Reply