stevGates
stevGates

Reputation: 952

How to resolved indentationError: unexpected indent?

How do I rectify this error "unexpected indent" in python?

from fast_rcnn.config import cfg
from nms.cpu_nms import cpu_nms

def nms(dets, thresh, force_cpu=False):
    """Dispatch to either CPU or GPU NMS implementations."""

    if (dets.shape[0]) == 0:
     return []

    return cpu_nms(dets, thresh)

Upvotes: 0

Views: 2459

Answers (1)

Chuck
Chuck

Reputation: 3852

Assuming this is not a copy and paste error when copying into SE, you need to change the indentation for your first return:

from fast_rcnn.config import cfg
from nms.cpu_nms import cpu_nms

def nms(dets, thresh, force_cpu=False):
    """Dispatch to either CPU or GPU NMS implementations."""

    if (dets.shape[0]) == 0:
        # Note the changed indentation here
        return []

    return cpu_nms(dets, thresh)

Upvotes: 1

Related Questions