tensorflow object detection API on Colab2019 Community Moderator ElectionTensorflow: how to save/restore a model?TensorFlow not found using pipSimple Feedforward Neural Network with TensorFlow won't learntensorflow object detection API(Calculate Car speeds.)Tensorflow object detection API test errorTensorflow object detection gives No module named 'deployment'Tensorflow Object Detection API ValueError: No variables to saveTensorflow Object-detection apiTensorflow: Does object detection API returns detected object idtensorflow object detection in google colab

Make a transparent 448*448 image

What exactly is the purpose of connection links straped between the rocket and the launch pad

If the Captain's screens are out, does he switch seats with the co-pilot?

When two POV characters meet

What does it mean when multiple 々 marks follow a 、?

"However" used in a conditional clause?

Potentiometer like component

Is going from continuous data to categorical always wrong?

Sword in the Stone story where the sword was held in place by electromagnets

What is the blue range indicating on this manifold pressure gauge?

Time travel short story where dinosaur doesn't taste like chicken

Unreachable code, but reachable with exception

Latest web browser compatible with Windows 98

Why does Deadpool say "You're welcome, Canada," after shooting Ryan Reynolds in the end credits?

Should we release the security issues we found in our product as CVE or we can just update those on weekly release notes?

How to deal with a cynical class?

Ban on all campaign finance?

redhat 7 + How to stop systemctl service permanent

What has been your most complicated TikZ drawing?

Extension of Splitting Fields over An Arbitrary Field

It's a yearly task, alright

When were linguistics departments first established

Do I need to leave some extra space available on the disk which my database log files reside, for log backup operations to successfully occur?

Deleting missing values from a dataset



tensorflow object detection API on Colab



2019 Community Moderator ElectionTensorflow: how to save/restore a model?TensorFlow not found using pipSimple Feedforward Neural Network with TensorFlow won't learntensorflow object detection API(Calculate Car speeds.)Tensorflow object detection API test errorTensorflow object detection gives No module named 'deployment'Tensorflow Object Detection API ValueError: No variables to saveTensorflow Object-detection apiTensorflow: Does object detection API returns detected object idtensorflow object detection in google colab










0















I tried running tensorflow object detection API on Colab according to here.



However, such an error occurred How can I solve it?



I tried step1.2.3.4.
They maybe run.



 with detection_graph.as_default():
with tf.Session(graph=detection_graph) as sess:
# Definite input and output Tensors for detection_graph
image_tensor = detection_graph.get_tensor_by_name('image_tensor:0')
# Each box represents a part of the image where a particular object was detected.
detection_boxes = detection_graph.get_tensor_by_name('detection_boxes:0')
# Each score represent how level of confidence for each of the objects.
# Score is shown on the result image, together with the class label.
detection_scores = detection_graph.get_tensor_by_name('detection_scores:0')
detection_classes = detection_graph.get_tensor_by_name('detection_classes:0')
num_detections = detection_graph.get_tensor_by_name('num_detections:0')
for image_path in TEST_IMAGE_PATHS:
image = Image.open(image_path)
# the array based representation of the image will be used later in order to prepare the
# result image with boxes and labels on it.
image_np = load_image_into_numpy_array(image)
# Expand dimensions since the model expects images to have shape: [1, None, None, 3]
image_np_expanded = np.expand_dims(image_np, axis=0)
# Actual detection.
(boxes, scores, classes, num) = sess.run(
[detection_boxes, detection_scores, detection_classes, num_detections],
feed_dict=image_tensor: image_np_expanded)
# Visualization of the results of a detection.
vis_util.visualize_boxes_and_labels_on_image_array(
image_np,
np.squeeze(boxes),
np.squeeze(classes).astype(np.int32),
np.squeeze(scores),
category_index,
use_normalized_coordinates=True,
line_thickness=8)
plt.figure(figsize=IMAGE_SIZE)
plt.imshow(image_np)


The error I receive is:



NameError 
Traceback (most recent call last)
<ipython-input-24-7493eea60222> in <module>()
10 detection_classes =
detection_graph.get_tensor_by_name('detection_classes:0')
11 num_detections =
detection_graph.get_tensor_by_name('num_detections:0')
---> 12 for image_path in TEST_IMAGE_PATHS:
13 image = Image.open(image_path)
14 # the array based representation of the image will be used later in order to prepare the

NameError: name 'TEST_IMAGE_PATHS' is not defined









share|improve this question
























  • Please let me know if there is a way to easily perform object detection with google colab.

    – R type
    Dec 20 '18 at 5:02











  • The NameError is being raised for TEST_IMAGE_PATHS which is defined in Step 4 of the notebook linked from the medium post you linked to. If the notebook doesn't run for you unmodified top-to-bottom you might want to ask on the blog post. If you've modified it and now it doesn't run, sharing your notebook (view-only) publicly and including its URL in your question may help people help you.

    – Ami F
    Dec 21 '18 at 21:25















0















I tried running tensorflow object detection API on Colab according to here.



However, such an error occurred How can I solve it?



I tried step1.2.3.4.
They maybe run.



 with detection_graph.as_default():
with tf.Session(graph=detection_graph) as sess:
# Definite input and output Tensors for detection_graph
image_tensor = detection_graph.get_tensor_by_name('image_tensor:0')
# Each box represents a part of the image where a particular object was detected.
detection_boxes = detection_graph.get_tensor_by_name('detection_boxes:0')
# Each score represent how level of confidence for each of the objects.
# Score is shown on the result image, together with the class label.
detection_scores = detection_graph.get_tensor_by_name('detection_scores:0')
detection_classes = detection_graph.get_tensor_by_name('detection_classes:0')
num_detections = detection_graph.get_tensor_by_name('num_detections:0')
for image_path in TEST_IMAGE_PATHS:
image = Image.open(image_path)
# the array based representation of the image will be used later in order to prepare the
# result image with boxes and labels on it.
image_np = load_image_into_numpy_array(image)
# Expand dimensions since the model expects images to have shape: [1, None, None, 3]
image_np_expanded = np.expand_dims(image_np, axis=0)
# Actual detection.
(boxes, scores, classes, num) = sess.run(
[detection_boxes, detection_scores, detection_classes, num_detections],
feed_dict=image_tensor: image_np_expanded)
# Visualization of the results of a detection.
vis_util.visualize_boxes_and_labels_on_image_array(
image_np,
np.squeeze(boxes),
np.squeeze(classes).astype(np.int32),
np.squeeze(scores),
category_index,
use_normalized_coordinates=True,
line_thickness=8)
plt.figure(figsize=IMAGE_SIZE)
plt.imshow(image_np)


The error I receive is:



NameError 
Traceback (most recent call last)
<ipython-input-24-7493eea60222> in <module>()
10 detection_classes =
detection_graph.get_tensor_by_name('detection_classes:0')
11 num_detections =
detection_graph.get_tensor_by_name('num_detections:0')
---> 12 for image_path in TEST_IMAGE_PATHS:
13 image = Image.open(image_path)
14 # the array based representation of the image will be used later in order to prepare the

NameError: name 'TEST_IMAGE_PATHS' is not defined









share|improve this question
























  • Please let me know if there is a way to easily perform object detection with google colab.

    – R type
    Dec 20 '18 at 5:02











  • The NameError is being raised for TEST_IMAGE_PATHS which is defined in Step 4 of the notebook linked from the medium post you linked to. If the notebook doesn't run for you unmodified top-to-bottom you might want to ask on the blog post. If you've modified it and now it doesn't run, sharing your notebook (view-only) publicly and including its URL in your question may help people help you.

    – Ami F
    Dec 21 '18 at 21:25













0












0








0








I tried running tensorflow object detection API on Colab according to here.



However, such an error occurred How can I solve it?



I tried step1.2.3.4.
They maybe run.



 with detection_graph.as_default():
with tf.Session(graph=detection_graph) as sess:
# Definite input and output Tensors for detection_graph
image_tensor = detection_graph.get_tensor_by_name('image_tensor:0')
# Each box represents a part of the image where a particular object was detected.
detection_boxes = detection_graph.get_tensor_by_name('detection_boxes:0')
# Each score represent how level of confidence for each of the objects.
# Score is shown on the result image, together with the class label.
detection_scores = detection_graph.get_tensor_by_name('detection_scores:0')
detection_classes = detection_graph.get_tensor_by_name('detection_classes:0')
num_detections = detection_graph.get_tensor_by_name('num_detections:0')
for image_path in TEST_IMAGE_PATHS:
image = Image.open(image_path)
# the array based representation of the image will be used later in order to prepare the
# result image with boxes and labels on it.
image_np = load_image_into_numpy_array(image)
# Expand dimensions since the model expects images to have shape: [1, None, None, 3]
image_np_expanded = np.expand_dims(image_np, axis=0)
# Actual detection.
(boxes, scores, classes, num) = sess.run(
[detection_boxes, detection_scores, detection_classes, num_detections],
feed_dict=image_tensor: image_np_expanded)
# Visualization of the results of a detection.
vis_util.visualize_boxes_and_labels_on_image_array(
image_np,
np.squeeze(boxes),
np.squeeze(classes).astype(np.int32),
np.squeeze(scores),
category_index,
use_normalized_coordinates=True,
line_thickness=8)
plt.figure(figsize=IMAGE_SIZE)
plt.imshow(image_np)


The error I receive is:



NameError 
Traceback (most recent call last)
<ipython-input-24-7493eea60222> in <module>()
10 detection_classes =
detection_graph.get_tensor_by_name('detection_classes:0')
11 num_detections =
detection_graph.get_tensor_by_name('num_detections:0')
---> 12 for image_path in TEST_IMAGE_PATHS:
13 image = Image.open(image_path)
14 # the array based representation of the image will be used later in order to prepare the

NameError: name 'TEST_IMAGE_PATHS' is not defined









share|improve this question
















I tried running tensorflow object detection API on Colab according to here.



However, such an error occurred How can I solve it?



I tried step1.2.3.4.
They maybe run.



 with detection_graph.as_default():
with tf.Session(graph=detection_graph) as sess:
# Definite input and output Tensors for detection_graph
image_tensor = detection_graph.get_tensor_by_name('image_tensor:0')
# Each box represents a part of the image where a particular object was detected.
detection_boxes = detection_graph.get_tensor_by_name('detection_boxes:0')
# Each score represent how level of confidence for each of the objects.
# Score is shown on the result image, together with the class label.
detection_scores = detection_graph.get_tensor_by_name('detection_scores:0')
detection_classes = detection_graph.get_tensor_by_name('detection_classes:0')
num_detections = detection_graph.get_tensor_by_name('num_detections:0')
for image_path in TEST_IMAGE_PATHS:
image = Image.open(image_path)
# the array based representation of the image will be used later in order to prepare the
# result image with boxes and labels on it.
image_np = load_image_into_numpy_array(image)
# Expand dimensions since the model expects images to have shape: [1, None, None, 3]
image_np_expanded = np.expand_dims(image_np, axis=0)
# Actual detection.
(boxes, scores, classes, num) = sess.run(
[detection_boxes, detection_scores, detection_classes, num_detections],
feed_dict=image_tensor: image_np_expanded)
# Visualization of the results of a detection.
vis_util.visualize_boxes_and_labels_on_image_array(
image_np,
np.squeeze(boxes),
np.squeeze(classes).astype(np.int32),
np.squeeze(scores),
category_index,
use_normalized_coordinates=True,
line_thickness=8)
plt.figure(figsize=IMAGE_SIZE)
plt.imshow(image_np)


The error I receive is:



NameError 
Traceback (most recent call last)
<ipython-input-24-7493eea60222> in <module>()
10 detection_classes =
detection_graph.get_tensor_by_name('detection_classes:0')
11 num_detections =
detection_graph.get_tensor_by_name('num_detections:0')
---> 12 for image_path in TEST_IMAGE_PATHS:
13 image = Image.open(image_path)
14 # the array based representation of the image will be used later in order to prepare the

NameError: name 'TEST_IMAGE_PATHS' is not defined






tensorflow google-colaboratory object-detection-api






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Dec 20 '18 at 7:18









Ankur Aggarwal

1,64922631




1,64922631










asked Dec 20 '18 at 4:54









R typeR type

14




14












  • Please let me know if there is a way to easily perform object detection with google colab.

    – R type
    Dec 20 '18 at 5:02











  • The NameError is being raised for TEST_IMAGE_PATHS which is defined in Step 4 of the notebook linked from the medium post you linked to. If the notebook doesn't run for you unmodified top-to-bottom you might want to ask on the blog post. If you've modified it and now it doesn't run, sharing your notebook (view-only) publicly and including its URL in your question may help people help you.

    – Ami F
    Dec 21 '18 at 21:25

















  • Please let me know if there is a way to easily perform object detection with google colab.

    – R type
    Dec 20 '18 at 5:02











  • The NameError is being raised for TEST_IMAGE_PATHS which is defined in Step 4 of the notebook linked from the medium post you linked to. If the notebook doesn't run for you unmodified top-to-bottom you might want to ask on the blog post. If you've modified it and now it doesn't run, sharing your notebook (view-only) publicly and including its URL in your question may help people help you.

    – Ami F
    Dec 21 '18 at 21:25
















Please let me know if there is a way to easily perform object detection with google colab.

– R type
Dec 20 '18 at 5:02





Please let me know if there is a way to easily perform object detection with google colab.

– R type
Dec 20 '18 at 5:02













The NameError is being raised for TEST_IMAGE_PATHS which is defined in Step 4 of the notebook linked from the medium post you linked to. If the notebook doesn't run for you unmodified top-to-bottom you might want to ask on the blog post. If you've modified it and now it doesn't run, sharing your notebook (view-only) publicly and including its URL in your question may help people help you.

– Ami F
Dec 21 '18 at 21:25





The NameError is being raised for TEST_IMAGE_PATHS which is defined in Step 4 of the notebook linked from the medium post you linked to. If the notebook doesn't run for you unmodified top-to-bottom you might want to ask on the blog post. If you've modified it and now it doesn't run, sharing your notebook (view-only) publicly and including its URL in your question may help people help you.

– Ami F
Dec 21 '18 at 21:25












1 Answer
1






active

oldest

votes


















0














On Analysing your code,it shows you are not running it in Colab.



The error occurs just because you are not initialising the path of test images directory.



while the for loop searches for images in path it throws the error.
so please initialise the path like the blow mentioned code.



PATH_TO_TEST_IMAGES_DIR = 'test_images'
TEST_IMAGE_PATHS = [ os.path.join(PATH_TO_TEST_IMAGES_DIR, 'image-.jpg'.format(i)) for i in range(1, 4) ]


Try this..






share|improve this answer






















    Your Answer






    StackExchange.ifUsing("editor", function ()
    StackExchange.using("externalEditor", function ()
    StackExchange.using("snippets", function ()
    StackExchange.snippets.init();
    );
    );
    , "code-snippets");

    StackExchange.ready(function()
    var channelOptions =
    tags: "".split(" "),
    id: "1"
    ;
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function()
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled)
    StackExchange.using("snippets", function()
    createEditor();
    );

    else
    createEditor();

    );

    function createEditor()
    StackExchange.prepareEditor(
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader:
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    ,
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    );



    );













    draft saved

    draft discarded


















    StackExchange.ready(
    function ()
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53862587%2ftensorflow-object-detection-api-on-colab%23new-answer', 'question_page');

    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    0














    On Analysing your code,it shows you are not running it in Colab.



    The error occurs just because you are not initialising the path of test images directory.



    while the for loop searches for images in path it throws the error.
    so please initialise the path like the blow mentioned code.



    PATH_TO_TEST_IMAGES_DIR = 'test_images'
    TEST_IMAGE_PATHS = [ os.path.join(PATH_TO_TEST_IMAGES_DIR, 'image-.jpg'.format(i)) for i in range(1, 4) ]


    Try this..






    share|improve this answer



























      0














      On Analysing your code,it shows you are not running it in Colab.



      The error occurs just because you are not initialising the path of test images directory.



      while the for loop searches for images in path it throws the error.
      so please initialise the path like the blow mentioned code.



      PATH_TO_TEST_IMAGES_DIR = 'test_images'
      TEST_IMAGE_PATHS = [ os.path.join(PATH_TO_TEST_IMAGES_DIR, 'image-.jpg'.format(i)) for i in range(1, 4) ]


      Try this..






      share|improve this answer

























        0












        0








        0







        On Analysing your code,it shows you are not running it in Colab.



        The error occurs just because you are not initialising the path of test images directory.



        while the for loop searches for images in path it throws the error.
        so please initialise the path like the blow mentioned code.



        PATH_TO_TEST_IMAGES_DIR = 'test_images'
        TEST_IMAGE_PATHS = [ os.path.join(PATH_TO_TEST_IMAGES_DIR, 'image-.jpg'.format(i)) for i in range(1, 4) ]


        Try this..






        share|improve this answer













        On Analysing your code,it shows you are not running it in Colab.



        The error occurs just because you are not initialising the path of test images directory.



        while the for loop searches for images in path it throws the error.
        so please initialise the path like the blow mentioned code.



        PATH_TO_TEST_IMAGES_DIR = 'test_images'
        TEST_IMAGE_PATHS = [ os.path.join(PATH_TO_TEST_IMAGES_DIR, 'image-.jpg'.format(i)) for i in range(1, 4) ]


        Try this..







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Mar 7 at 10:58









        Tamil Selvan STamil Selvan S

        3817




        3817





























            draft saved

            draft discarded
















































            Thanks for contributing an answer to Stack Overflow!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid


            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.

            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53862587%2ftensorflow-object-detection-api-on-colab%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            Can't initialize raids on a new ASUS Prime B360M-A motherboard2019 Community Moderator ElectionSimilar to RAID config yet more like mirroring solution?Can't get motherboard serial numberWhy does the BIOS entry point start with a WBINVD instruction?UEFI performance Asus Maximus V Extreme

            Identity Server 4 is not redirecting to Angular app after login2019 Community Moderator ElectionIdentity Server 4 and dockerIdentityserver implicit flow unauthorized_clientIdentityServer Hybrid Flow - Access Token is null after user successful loginIdentity Server to MVC client : Page Redirect After loginLogin with Steam OpenId(oidc-client-js)Identity Server 4+.NET Core 2.0 + IdentityIdentityServer4 post-login redirect not working in Edge browserCall to IdentityServer4 generates System.NullReferenceException: Object reference not set to an instance of an objectIdentityServer4 without HTTPS not workingHow to get Authorization code from identity server without login form

            2005 Ahvaz unrest Contents Background Causes Casualties Aftermath See also References Navigation menue"At Least 10 Are Killed by Bombs in Iran""Iran"Archived"Arab-Iranians in Iran to make April 15 'Day of Fury'"State of Mind, State of Order: Reactions to Ethnic Unrest in the Islamic Republic of Iran.10.1111/j.1754-9469.2008.00028.x"Iran hangs Arab separatists"Iran Overview from ArchivedConstitution of the Islamic Republic of Iran"Tehran puzzled by forged 'riots' letter""Iran and its minorities: Down in the second class""Iran: Handling Of Ahvaz Unrest Could End With Televised Confessions""Bombings Rock Iran Ahead of Election""Five die in Iran ethnic clashes""Iran: Need for restraint as anniversary of unrest in Khuzestan approaches"Archived"Iranian Sunni protesters killed in clashes with security forces"Archived