-
Notifications
You must be signed in to change notification settings - Fork 903
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Using custom Darknet network with rectangular input #105
Comments
@kylemcdonald Thanks for sharing. Also we have to tailor the def yolo_loss(y_true, y_pred):
# 3. inverting the pred box equations
grid_size = tf.cast(tf.shape(y_true)[1:3][::-1], tf.float32)
grid = tf.meshgrid(tf.range(grid_size[0]), tf.range(grid_size[1]))
# (Optional) if you have normalized your anchors by `height/width`, this step is not necessary
true_wh = tf.math.log(true_wh / anchors * grid / grid_size[0]) However, if a priori anchors have been normalized by def yolo_boxes(pred, anchors, classes):
# (Optional) if you have normalized your anchors by `height/width`, this step is not necessary
box_wh = tf.exp(box_wh) * anchors * (grid_size[0] / grid_size) |
Hi, when you train on rectangular images, don't you also need to modify the code here (dataset.py):
and here:
And finally, you will have to adjust your model to take a custom input size of (width x height) in models.py:
|
Hello, and thanks for your work.
I would like to use a network I trained using https://github.com/AlexeyAB/darknet/ It accepts 576x320x3 input and predicts 4 classes.
I started by converting the network:
Then I ran my code (note: I had to hardcode
yolo_iou_threshold
andyolo_iou_score
for this code to run):But I get an error. I also tried with
size=None
and got the same error. I think it's might be related to some way that the network is created under an assumption equal width and height? But I can't find where. How can I fix this? Note that I don't get the error on the 320x320 network. I can also pass other square sizes to the network like 160x160 or 640x640 without problems. I've pasted the error below. Thank you!Updates: it looks like the code that needs to be changed is inside
def yolo_boxes()
. I had to account for the fact thatgrid_size
is different in each axis. When porting models from Darknet, this also means scaling the anchors by the aspect ratio. Here's what I did to get it working:Note that I copied my anchors from the Darknet
yolov3.cfg
file and used them like this:The text was updated successfully, but these errors were encountered: