Hi, my notes on lesson 8. Hope it can help new fastai fellows
Hey guys, check out my new blog on Introduction to Object Detection. Hope you enjoy it and feel free to comment in case of any queries or suggestions.
I’m trying to extend the bounding boxes in lesson 8 by ‘rotated bounding boxes’. I’m doing this by passing in four coordinates top-right(x,y), bottom-right(x,y, bottom-left(x,y) and top-left(x,y).
By using the same code, only the first four values get passed through the different datasets and loaders:
tfms = tfms_from_model(f_model, sz, crop_type=CropType.NO, tfm_y=tfm_y, aug_tfms=augs)
md = ImageClassifierData.from_csv(PATH, JPEGS, BB_CSV, tfms=tfms, continuous=True, bs=4)
bbox = to_np(y)
[194. 368. 217. 400. 0. 0. 0. 0.]
How come? I’m trying to understand but I can’t figure it out. Hints are very appreciated, thanks in advance!
I was starting with lecture 8 today and I guess it only needs 2x x,y = 4 coordinates for the box to be sufficiently defined.
Do you use training data with rotated bounding boxes?
With the Pascal dataset I would guess that it will learn the “aligned” bounding boxes.
Hi @MicPie, thanks for your reply. Yes I know the bounding boxes in the lecture only use two coordinates (top-left and bottom-right). But I’m trying to extend this for a different dataset that is using rotated bounding boxes. It’s defined by 8 values, the csv looks like ImageId, y1 x1 y2 x2 y3 x3 y4 x4
I am currently watching lesson 9 and there Jeremy talks about the transformations in the “Bbox only” section in the jupyter notebook. As you can see at the transformed/rotated pictures of the woman the bounding box is not rotated and is only resized (and still aligned vertically and horizontally).
I guess to rotate the bounding box you have to adapt the class “CoordTransform”.
In addition, you have to use “tfm_y=TfmType.COORD” to transform the coordinates of the bounding box too.
However, maybe the pixel transformation can be of use with TfmType.PIXEL (see class “TfmType”, should be covered in later lessons on image segmentation).
Hi @MicPie, Yes indeed, class "CoordTransform’ is the part of the code which is replacing the values by zero’s. That’s what I was looking for, thanks for your help. I’m trying to add a new TfmType to handle rotated boxes. Maybe in the end it’s better to use the PIXEL type, but in this way I’m getting to understand the fast.ai frame more.
Nice work, looks very nice!
Do you also were able to train the neural network?
I would be interested if you use the coordinates of the four corners or maybe the two corners with a angle.
Not yet, but Ill continue next weekend. Ill keep you updated.
By the way, eventually I’m trying to solve the Kaggle airbus challenge (https://www.kaggle.com/c/airbus-ship-detection), interested in teaming up?
I am interested
Thanks for your response. Interested in the code and/or teaming up?
Would be interested in teaming up too!
Great, I added you to the conversation, did you get that message?
…I did not…
I have been playing with a kernel to detect ship presence first.
It seems there is no alias to data folder in the dl2 folder (contrary to dl1).
I just figured out how to create one on linux terminal to make the notebook work.
cd into dl2 folder, then :
“ln -s ~/data”
At the end of the pascal notebook, Jeremy unfreezes to layergroup -2. Then does lr find with the following result
From this graph, he chooses for the next iterations lr=5*10^-3
Can anyone explain to me wy he chooses such value ? (The graph doesn’t look like the usual “decrease then increase” graph…)
Thanks a lot !
Hi I had the same question. that, will rotating the input image, will rotate bounding box co-ordinates.
CoordTransform achieve this?
CoordTransform increases accuracy?
Pay attention to which cells are actually run. He got me too! These commands are not supposed to be run in succession, just skip the second sched.plot. I believe that is used earlier to test which values would work better when unfreezing last two layers!
No need really for a second lr_find here, or you can try it with lr_find(lrs) instead of lrs/1000.