dronefreak / dji-tello-object-detection-segmentation

This Git repo allows to implement the state-of-the-art MaskRCNN algorithm for instance segmentation on the video feed from DJI-Tello drone.
MIT License
48 stars 14 forks source link

hi project you done is perfect but some errors adressed for me #1

Open vishnuproject opened 5 years ago

vishnuproject commented 5 years ago

project you done is excellent can you help me with issues i was facing during execution Screenshot from 2019-10-28 19-45-57

dronefreak commented 5 years ago

Hi,

Thanks for your comment. I think that this a typo, you need to put Tracker instead of tracker. So you new command shall be:

self.tracker = Tracker(self.vid_stream.height,
                               self.vid_stream.width,
                               green_lower, green_upper)

You could also remove this entire line, I was using it to create a tracking algorithm initially.

vishnuproject commented 4 years ago

hi the i was getting image and it is getting stuck no video feed is recieving but a new tab is opening and drone is not flying i have done upto here because of you please help me with the issues i was facing and i have to say your code was solid

dronefreak commented 4 years ago

Hi,

Thanks a lot for appreciating this work. I am not sure why there is a lag in your video feed. I personally almost never faced this 'getting stuck' issue. I did face certain lag, but it was not this bad.

I would like to investigate more before commenting anything. To begin with, could you please share with me the specifications of your machine. I just want to confirm whether the profile matches with the requirements, because Mask RCNN is a very computationally expensive process and requires large GPU memories to run smoothly. After this we can move on to code investigation.

vishnuproject commented 4 years ago

hi yeah thanks for response i was using i5 9300h laptop with nvidia gtx 1650 grphics it belong to lenovo gaming series i.e legion 540

vishnuproject commented 4 years ago

Screenshot from 2019-11-11 22-44-44

Hi i am getting some errors while executing code i have given a screenshot please help me with this and drone is not flying or take off by pressing tab and i am not getting video feed but only one image after it segments object

dronefreak commented 4 years ago

Hi,

So seems like there might be a version mismatch of av. Please execute sudo pip install av --upgrade from your terminal. Also, I hope you have compiled and installed TelloPy. If not, then please do that as well from https://github.com/hanyazou/TelloPy.

After all this try executing your code and even then if does not work, please try modifying your tr.py with the following.

def main():
    drone = tellopy.Tello()
    tellotrack = TelloCV()

    try:
        drone.connect()
        drone.wait_for_connection(60.0)

        retry = 3
        container = None
        while container is None and 0 < retry:
            retry -= 1
            try:
                container = av.open(drone.get_video_stream())
            except av.AVError as ave:
                print(ave)
                print('retry...')

        # skip first 300 frames
        frame_skip = 300
        while True:
            for frame in container.decode(video=0):
                if 0 < frame_skip:
                    frame_skip = frame_skip - 1
                    continue
                start_time = time.time()
                image = tellotrack.process_frame(frame)
                results = model.detect([image], verbose=0)
                r = results[0]
                image = display_instances(
                image, r['rois'], r['masks'], r['class_ids'], class_names, r['scores'])
                cv2.imshow('tello', image)
                _ = cv2.waitKey(1) & 0xFF
                cv2.waitKey(1)
                if frame.time_base < 1.0/60:
                    time_base = 1.0/60
                else:
                    time_base = frame.time_base
                frame_skip = int((time.time() - start_time)/time_base)

    except Exception as ex:
        exc_type, exc_value, exc_traceback = sys.exc_info()
        traceback.print_exception(exc_type, exc_value, exc_traceback)
        print(ex)
    finally:
        drone.quit()
        cv2.destroyAllWindows()
vishnuproject commented 4 years ago

hi thanks for help but i got some errors i modified the code as per your instructions but getting some 3 errors so please check the screenshot attached below and please help me and thanks for the reply and the instructions [image: Screenshot from 2019-11-12 23-57-09.png]

On Mon, Nov 11, 2019 at 11:30 PM Saumya Kumaar notifications@github.com wrote:

Hi,

So seems like there might be a version mismatch of av. Please execute sudo pip install av --upgrade from your terminal. Also, I hope you have compiled and installed TelloPy. If not, then please do that as well from [ https://github.com/hanyazou/TelloPy] (here).

After all this try executing your code and even then if does not work, please try modifying your tr.py with the following.

def main(): drone = tellopy.Tello() tellotrack = TelloCV()

try:
    drone.connect()
    drone.wait_for_connection(60.0)

    retry = 3
    container = None
    while container is None and 0 < retry:
        retry -= 1
        try:
            container = av.open(drone.get_video_stream())
        except av.AVError as ave:
            print(ave)
            print('retry...')

    # skip first 300 frames
    frame_skip = 300
    while True:
        for frame in container.decode(video=0):
            if 0 < frame_skip:
                frame_skip = frame_skip - 1
                continue
            start_time = time.time()
            image = tellotrack.process_frame(frame)
            results = model.detect([image], verbose=0)
            r = results[0]
            image = display_instances(
            image, r['rois'], r['masks'], r['class_ids'], class_names, r['scores'])
            cv2.imshow('tello', image)
            _ = cv2.waitKey(1) & 0xFF
            cv2.waitKey(1)
            if frame.time_base < 1.0/60:
                time_base = 1.0/60
            else:
                time_base = frame.time_base
            frame_skip = int((time.time() - start_time)/time_base)

except Exception as ex:
    exc_type, exc_value, exc_traceback = sys.exc_info()
    traceback.print_exception(exc_type, exc_value, exc_traceback)
    print(ex)
finally:
    drone.quit()
    cv2.destroyAllWindows()

— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub https://github.com/dronefreak/dji-tello-object-detection-segmentation/issues/1?email_source=notifications&email_token=ANTU2KXFDGHEC4G2RN2M4JTQTGMVFA5CNFSM4JF22DTKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEDXTTOQ#issuecomment-552548794, or unsubscribe https://github.com/notifications/unsubscribe-auth/ANTU2KSFTRZPCHBLS2ZM5ATQTGMVFANCNFSM4JF22DTA .

vishnuproject commented 4 years ago

hi these are the latest errors that are received after modifying the code please help me please check the screenshot below i hope it shows Screenshot from 2019-11-13 00-55-30

dronefreak commented 4 years ago

Hi,

I am not sure why this error drone not defined persists, as drone = tellopy.Tello() is already defined above. You could try drone.connect() again. However, in your modifiedtr.py, you can just use print() instead of print_execption(), so your new command could be:

print(exc_type, exc_value, exc_traceback)

vishnuproject commented 4 years ago

hi i tried the latest suggestions but video feed is getting stuck and segmentation getting done for the first image or frame .modified code and regular code i have mailed please check your gmail my account will be vishnu as first name of my gmail in your inbox

wxbs commented 2 years ago

hi i tried the latest suggestions but video feed is getting stuck and segmentation getting done for the first image or frame .modified code and regular code i have mailed please check your gmail my account will be vishnu as first name of my gmail in your inbox

Hi, has the problem "video feed is getting stuck and segmentation getting done for the first image or frame" been solved? I met this problem,too

wxbs commented 2 years ago

I found that if I use "ctrl" I can't click into the "open" of av.open(). Does anyone know why?