Open kitlien opened 6 years ago
@kitlien please specify exactly what you do and what output you get, i am not able to understand the question
@GustavZ I run the object detection python file "object_detection.py" with split_model. When the program run into the function:def detection(detection_graph, category_index, score, expand), the function g = gpu_worker.get_result_queue() and c = cpu_worker.get_result_queue(), alway return 'None'.
Then there is no results for boxes, scores, classes, num, image.
Here is the code for this problem:
if split_model:
# split model in seperate gpu and cpu session threads
if gpu_worker.is_sess_empty():
# read video frame, expand dimensions and convert to rgb
image = cv2.imread(images[i])
image_expanded = np.expand_dims(cv2.cvtColor(image, cv2.COLOR_BGR2RGB), axis=0)
# put new queue
gpu_feeds = {image_tensor: image_expanded}
if visualize:
gpu_extras = image # for visualization frame
else:
gpu_extras = None
gpu_worker.put_sess_queue(gpu_opts,gpu_feeds,gpu_extras)
g = gpu_worker.get_result_queue()
if g is None:
# gpu thread has no output queue. ok skip, let's check cpu thread.
gpu_counter += 1
else:
# gpu thread has output queue.
gpu_counter = 0
score,expand,image = g["results"][0],g["results"][1],g["extras"]
if cpu_worker.is_sess_empty():
# When cpu thread has no next queue, put new queue.
# else, drop gpu queue.
cpu_feeds = {score_in: score, expand_in: expand}
cpu_extras = image
cpu_worker.put_sess_queue(cpu_opts,cpu_feeds,cpu_extras)
c = cpu_worker.get_result_queue()
if c is None:
# cpu thread has no output queue. ok, nothing to do. continue
cpu_counter += 1
time.sleep(0.005)
continue # If CPU RESULT has not been set yet, no fps update
else:
cpu_counter = 0
boxes, scores, classes, num, image = c["results"][0],c["results"][1],c["results"][2],c["results"][3],c["extras"]
Wish your help,Thanks~
I dont know where you got this code from, but this is totally messed up. If you want to use my inital release, make sure to checkout branch r1.0 Or better use my new release, so checkout master or r2.0.
This part here is strange:
image = cv2.imread(images[i])
image_expanded = np.expand_dims(cv2.cvtColor(image, cv2.COLOR_BGR2RGB), axis=0)
So you wrote your own code / modified the original one. Furthermore this is an Indentation Error. So probably you made some mistakes here... As i said, pull my newest version or checkout to one of the two releases and you should be fine
@GustavZ Hey, When I implement the ' object_detection.py' on Tx2, I Always got 'None' using g = gpu_worker.get_result_queue(). And no detection results comes out, what's the reason of this problem?