Solved by ptrblck in post #7 
              
              
                You are reassigning and then slicing again the object: 
obj_ids = obj_ids[1:] # here it will only have a single element
        
print('obj_ids[1:] shape :', obj_ids[1:].shape)
print('obj_ids[1:] :', obj_ids[1:]) # is empty now