Question

Has anyone gotten opencv/Objectdetector to actually work?

  • 14 November 2022
  • 6 replies
  • 6 views

Badge +3

I have been trying this for a while and have been spending too much time on this.

 

I saw, and downloaded, Dmitri's stopsigndetector workspace and had a go at it myself. I just have no way of getting it to work at all. Sometimes it seems to get a result (which never makes any sense), but running the same workspace again will then result in a crash.

 

the problems I encounter:

  • Sample preparer just doesn't work at all. Rejects incomming feauture without an error.
  • sample generator. Sometimes works, sometimes doesn't. Sometimes gives the error 'invalid background description fie', a file the transformer generates itself..?
  • instability: sometimes any of the 4 transformers (sample preparer, sample generator, trainer and detector) just crashes without an error
  • Lack of documentation

 

I tried the relative path trick, without it nothing works, but that didn't help. I downloaded Dimitri'workspace: Doesnt'work. Crashes on the samplepreparer, no error message.

 

 

 

 


6 replies

Userlevel 6
Badge +32

I have tried it but had a similar experience. Ran out of time and motivation before it worked.

Badge +3

I put all the files in one directory (except for the negatives). That got me a bit further (though the sample preparer is not working at all, so I used the sample generator). The result looks like nothing though. I tried arrows on roads, very clear and easy you'd think. It found just random squares on the aereil photo.

Userlevel 1
Badge +15

Hi @michiedem​ thanks for your question! I'm assuming that you are looking at the workspace found here? And if so, have you taken a look at the accompanying blog post on how this was made?

 

To better answer your question regarding the RasterObjectDetector transformer, are you able to run the workspace 'StopSignDetector.fmwt' (without modifying anything) and if not where are you encountering errors? What version & build number of FME are you using? Are you on Windows or Linux?

 

For the RasterObjectDetectorSamplePreparer and RasterObjectDetectorSampleGenerator transformers, by looking at the documentation on the package it seems that it has not been updated since 2019. It seems your displeasure and errors are common among many users (e.g. one, & two).

 

To answer the title of your question: yes, we have customers who made it work, but it was never simple. I'm sorry for the inconvenience. I can make an internal request that Safe would invest some time into re-writing the buggy OpenCV code if you would like to submit a support case: https://community.safe.com/s/submit-case

 

From previous replies I believe Dmitri is happy to provide direct support if necessary as well.

Badge +3

Hi @michiedem​ thanks for your question! I'm assuming that you are looking at the workspace found here? And if so, have you taken a look at the accompanying blog post on how this was made?

 

To better answer your question regarding the RasterObjectDetector transformer, are you able to run the workspace 'StopSignDetector.fmwt' (without modifying anything) and if not where are you encountering errors? What version & build number of FME are you using? Are you on Windows or Linux?

 

For the RasterObjectDetectorSamplePreparer and RasterObjectDetectorSampleGenerator transformers, by looking at the documentation on the package it seems that it has not been updated since 2019. It seems your displeasure and errors are common among many users (e.g. one, & two).

 

To answer the title of your question: yes, we have customers who made it work, but it was never simple. I'm sorry for the inconvenience. I can make an internal request that Safe would invest some time into re-writing the buggy OpenCV code if you would like to submit a support case: https://community.safe.com/s/submit-case

 

From previous replies I believe Dmitri is happy to provide direct support if necessary as well.

That is the blogpost that actually put me on tgrack for trying this. The project I started is much more simple. I used a clearer example than the stop sign (white painted arrows on a black road, alle the same size), I used a very simple path (c:\\opencv\\), I copy pasted from Dimitri's blogpost and spend many, many hours of my spare time just trying anything I could think of.

  • I never even gotten the samplepreparer to work, not even once. It always has a rejected feature as output with no error message.
  • All other tranformers were unreliable, sometimes they worked, sometimes they didin't. Sometimes a restard of the PC helped (just clearing the cache was never enough), sometimes it didn't.
  • Even with generating 1000 samples the modeltrainer never went past stage 3
  • Infomration was very, very, very hard to find

 

I am using FME desktop 2022.1.0.0, but I also tryed it before in 2019.1.0, similar result.

 

I will submit a case. I am of the opinion that if the case will not be picked up, the transformers should be removed.

Badge +3

OK, I got one step further: I did get the samplepreparer to (seemingly) work. For that I had to install FME in a new directory, I think the space in the normal path (c:\\program files\\fme) doesn't really help. Another thing I noticed: I need to enter less positives then I actualy have. For instance: For a quick trial I used 125 samples, but it crashes with any entry over 100.

 

The final results still don't make any sense though, just random parts of the photo. Might be because of the smal test sample size I am using.

Badge +3

Update:

  • It only 'works' after I reinstalled FME into a folder without any spaces in the path (e.g. not in the suggested program files folder)
  • Use relative paths for everything
  • Whenever you change a setting you need to delete data like your .vec file and background file, files do net get overwritten
  • If you change/play around too much you will need to restart you computer, purgeing the temp files is not enough
  • You might want to use a lower number of possible samples as input that you actually have. For instance: I had 186 positives, 174 were kept (It generates a annotations_kept file which you can use as input), it kept crashing intull I lowered the number I used as input to about 150

 

Now: The results were bad. I tried using road markings (an arrow for tiruning right) for testing. This should be easy: They are always exactly the same size and have a very high contrast (white on a blak background). I admittetly used a small numner (150 in the end), but I used a large number of negtaives (1850). the results were very poor, though all results ended up being a part of the road (in lower numbers of negatives some results were just random areas, including yards and houses), it missed about 80% of the arrows and the positives were mostly random looking parts of the road surface.

 

Some observations:

  • I might have used the worng with and height settings in several transformers. the documentation on this is very, very unclear. They mean different things in different transformers and playing around with the numbers yielded wildly different results
  • The minimal number of neignors in the objectdetector transformer seems to go wring somehow, I could still find results with a minimal number of 1500...?

Reply