xingyizhou / ExtremeNet

Bottom-up Object Detection by Grouping Extreme and Center Points
BSD 3-Clause "New" or "Revised" License
1.03k stars 174 forks source link

in random_crop_pts image_height, image_width = image.shape[0:2] AttributeError: 'NoneType' object has no attribute 'shape' #3

Open lucasjinreal opened 5 years ago

lucasjinreal commented 5 years ago

I think the code has some error:

def prefetch_data(db, queue, sample_data, data_aug, debug=False):
    ind = 0
    print("start prefetching data...")
    np.random.seed(os.getpid())
    while True:
        try:
            data, ind = sample_data(db, ind, data_aug=data_aug, debug=debug)
            queue.put(data)
        except Exception as e:
            traceback.print_exc()
            raise e

this function called sample_data which take db as argument, but the sample data implementation :+1:

def sample_data(db, k_ind, data_aug=True, debug=False):
    print('calling sample data....')
    print('db: {}, k_ind: {}'.format(db, k_ind))
    return globals()[system_configs.sampling_function](db, k_ind, data_aug, debug)

Which calls a sampling function, in this case it is random_crop, but random_crop take a image as first argument..

Why opensource codes with errors............

xingyizhou commented 5 years ago

Hi, Thanks for taking a close look at the code. Actually the sampling function is kp_detection, https://github.com/xingyizhou/ExtremeNet/blob/master/config/ExtremeNet.json#L5 . And it calls random_crop_pts with proper args https://github.com/xingyizhou/ExtremeNet/blob/master/sample/coco_extreme.py#L97 . The error you occurred might due to that you haven't set the image path correctly so cv2.imread returns None. Can you add print('image_file', image_file) before https://github.com/xingyizhou/ExtremeNet/blob/master/sample/coco_extreme.py#L90 and check if the path exists on your machine?