Open wendy7707 opened 7 years ago
I think you are using the old ROI coordinate system (prior to CNTK 2.1). Try to specify the ROI like 219 0 165 29 etc. - that is, not like 0.XX but just XX (X1 Y1 X2 Y2). I had the same problem as you and solved it that way :-)
Correct, roi pooling now takes absolute pixel coordinates (w.r.t. to the input image that is given to the network, i.e. if you apply scaling or padding you need to apply this to the roi candidates as well). The expected coordinates are (x_min, y_min, x_max, y_max)
@mortengryning sorry ,one more questions, 0.07 converts to 7?
Hi Wendy. Previously the coordinates for CNTK Fast R-CNN were (x, y, w, h)
all relative w.r.t. the input image dimension (see the tutorial). Now we use the same type of coordinates as other toolkits, e.g. Caffe. The are in absolute pixel coordinates w.r.t. the input image. Example: if your input image is scaled to 800x800 and your ROI coordinates were (0.1, 0.3, 0.2, 0.5) then the new coordinates are (0.1 800, 0.3 800, (01. + 0.2) 800, (0.3 + 0.5) 800) = (80, 240, 240, 640).
@pkranen thank you so much! I just follow your suggestion, and caculate like the following: 0.219 0.0 0.165 0.29 =(219,0,384,290), but the results is not very good, just output two rois have target, it is not the same good results as the test.z result by python. Would you please tell me why? thanks!
@mortengryning @pkranen thank you so much! I just follow your suggestion, and caculate like the following: 0.219 0.0 0.165 0.29 =(219,0,384,290), but the results is not good, I think after"outputs = model.Evaluate(inputs, outDims.First().Key);" the output should be same as "test.z" in python. But it is different, and the results are not same as too. would you please tell me how to solve this problem, did you have the same result? Thanks!
I have already done Making the model part, which also generates ROIs during A1. The only part that I'm still struggling is how to evaluate now that I have a trained model and the ROIs for an image.
Here's the C# code I'm using based on @pkranen branch, which doesn't actually give me any ROI labels besides 0 (ground). So I'm wondering if there's a mistake in the code, or at least an alternative way to do the evaluation for ROI labeling.
public static void EvaluateObjectDetectionModel() { try { // This example requires the Fast-RCNN_grocery100 model. // The model can be downloaded from
// The model is assumed to be located at: \Examples\Image\PretrainedModels\
// It further requires the grocery image data set.
// Please run 'python install_fastrcnn.py' from \Examples\Image\Detection\FastRCNN to get the data.
string imageDirectory = Path.Combine(initialDirectory, @"....\Examples\Image\DataSets\grocery\testImages");
string modelDirectory = Path.Combine(initialDirectory, @"....\Examples\Image\PretrainedModels");
Environment.CurrentDirectory = initialDirectory;