deephdc / image-classification-tf

Repository to perform image classification using tensorflow/keras.
Apache License 2.0
12 stars 5 forks source link

Crashing docker image deephdc/deep-oc-plants-classification-tf #13

Open Fristi opened 1 year ago

Fristi commented 1 year ago

Hey there!

I'm trying to use the docker image deephdc/deep-oc-plants-classification-tf:cpu

But it seems to crash on startup, any resolution?

2023-08-22T15:13:41.879019631Z 
2023-08-22T15:13:45.735634976Z 
2023-08-22T15:13:45.735700597Z          ##         ###
2023-08-22T15:13:45.735710976Z          ##       ######  ##
2023-08-22T15:13:45.735720328Z      .#####   #####   #######.  .#####.
2023-08-22T15:13:45.735729699Z     ##   ## ## //   ##  //  ##  ##   ##
2023-08-22T15:13:45.735739185Z     ##. .##  ###  ###   // ###  ##   ##
2023-08-22T15:13:45.735748512Z       ## ##    ####     ####    #####.
2023-08-22T15:13:45.735757763Z               Hybrid-DataCloud  ##
2023-08-22T15:13:45.735767110Z 
2023-08-22T15:13:45.735776209Z 
2023-08-22T15:13:45.735785376Z Welcome to the DEEPaaS API API endpoint. You can directly browse to the
2023-08-22T15:13:45.735794880Z API documentation endpoint to check the API using the builtint Swagger UI
2023-08-22T15:13:45.735804446Z or you can use any of our endpoints.
2023-08-22T15:13:45.735813963Z 
2023-08-22T15:13:45.735823063Z     API documentation: http://0.0.0.0:5000/ui
2023-08-22T15:13:45.735832430Z     API specification: http://0.0.0.0:5000/swagger.json
2023-08-22T15:13:45.735841752Z           V2 endpoint: http://0.0.0.0:5000/v2
2023-08-22T15:13:45.735851191Z 
2023-08-22T15:13:45.735860336Z -------------------------------------------------------------------------
2023-08-22T15:13:45.735869821Z 
2023-08-22T15:13:45.735878978Z 2023-08-22 15:13:45.733 1 INFO deepaas [-] Starting DEEPaaS version 1.3.0
2023-08-22T15:13:45.738203459Z 2023-08-22 15:13:45.736 1 WARNING py.warnings [-] /usr/local/lib/python3.6/dist-packages/deepaas/api/__init__.py:65: DeprecationWarning: debug argument is deprecated
2023-08-22T15:13:45.738238253Z   client_max_size=CONF.client_max_size
2023-08-22T15:13:45.738248710Z 
2023-08-22T15:13:45.926289171Z 2023-08-22 15:13:45.923 1 WARNING py.warnings [-] /usr/local/lib/python3.6/dist-packages/tensorflow/python/pywrap_tensorflow_internal.py:15: DeprecationWarning: the imp module is deprecated in favour of importlib; see the module's documentation for alternative uses
2023-08-22T15:13:45.926336391Z   import imp
2023-08-22T15:13:45.926346848Z 
IgnacioHeredia commented 1 year ago

Hi @Fristi , I see a warning message, not a crash/error one. Can you provide more info?

Fristi commented 1 year ago

It exits with exit code 132, which might be related to TF/Python version, did you pin that for the creation of the docker image?

https://saturncloud.io/blog/why-does-loading-tensorflow-on-mac-lead-to-process-finished-with-exit-code-132-interrupted-by-signal-4-sigill/

docker ps -a --filter "status=exited"
CONTAINER ID   IMAGE                                          COMMAND                  CREATED          STATUS                       PORTS     NAMES
82721cd225fb   deephdc/deep-oc-plants-classification-tf:cpu   "deepaas-run --openw…"   14 seconds ago   Exited (132) 7 seconds ago             srv-captain--plant-class.1.0spininne7drnmie9ft1tstht
29ed96c493d9   img-captain-plant-class:0                      "/docker-entrypoint.…"   48 seconds ago   Exited (0) 13 seconds ago              srv-captain--plant-class.1.zzi02x89iktzhwe1h3vwgftqe
IgnacioHeredia commented 1 year ago

Dockerfiles are located here: base image classifier, plant classifier. Tensorflow version is fixed to 1.14.

As far as I can tell, I can succesfully run it on my machine (Ubuntu 20.04): docker run -ti -p 5000:5000 -p 6006:6006 -p 8888:8888 deephdc/deep-oc-plants-classification-tf:cpu image

Fristi commented 1 year ago

The logs from above are from running it on my NUC which is x86_64 machine

I also tried it running on my MacBook Pro M1

 docker run -ti -p 5100:5000 -p 6006:6006 -p 8888:8888 deephdc/deep-oc-plants-classification-tf:cpu
WARNING: The requested image's platform (linux/amd64) does not match the detected host platform (linux/arm64/v8) and no specific platform was requested

         ##         ###
         ##       ######  ##
     .#####   #####   #######.  .#####.
    ##   ## ## //   ##  //  ##  ##   ##
    ##. .##  ###  ###   // ###  ##   ##
      ## ##    ####     ####    #####.
              Hybrid-DataCloud  ##

Welcome to the DEEPaaS API API endpoint. You can directly browse to the
API documentation endpoint to check the API using the builtint Swagger UI
or you can use any of our endpoints.

    API documentation: http://0.0.0.0:5000/ui
    API specification: http://0.0.0.0:5000/swagger.json
          V2 endpoint: http://0.0.0.0:5000/v2

-------------------------------------------------------------------------

2023-08-23 12:49:04.792 1 INFO deepaas [-] Starting DEEPaaS version 1.3.0
2023-08-23 12:49:04.808 1 WARNING py.warnings [-] /usr/local/lib/python3.6/dist-packages/deepaas/api/__init__.py:65: DeprecationWarning: debug argument is deprecated
  client_max_size=CONF.client_max_size

2023-08-23 12:49:05.426 1 WARNING py.warnings [-] /usr/local/lib/python3.6/dist-packages/tensorflow/python/pywrap_tensorflow_internal.py:15: DeprecationWarning: the imp module is deprecated in favour of importlib; see the module's documentation for alternative uses
  import imp

2023-08-23 12:49:05.639926: F tensorflow/core/lib/monitoring/sampler.cc:42] Check failed: bucket_limits_[i] > bucket_limits_[i - 1] (inf vs. inf)
qemu: uncaught target signal 6 (Aborted) - core dumped

When requesting at localhost:5100 it doesn't respond

I tried building the container as described here https://github.com/deephdc/DEEP-OC-plants-classification-tf#building-the-container

docker build -t deephdc/deep-oc-plants-classification-tf .
[+] Building 0.9s (6/7)                                                                                                                                                                                                   docker:desktop-linux
 => [internal] load build definition from Dockerfile                                                                                                                                                                                      0.0s
 => => transferring dockerfile: 1.18kB                                                                                                                                                                                                    0.0s
 => [internal] load .dockerignore                                                                                                                                                                                                         0.0s
 => => transferring context: 2B                                                                                                                                                                                                           0.0s
 => [internal] load metadata for docker.io/deephdc/deep-oc-image-classification-tf:cpu                                                                                                                                                    0.6s
 => [1/4] FROM docker.io/deephdc/deep-oc-image-classification-tf:cpu@sha256:e0ac7074e1e0333c09117fdfadf599c302645098cd89f90bd8aef9b1904fb623                                                                                              0.0s
 => CACHED [2/4] RUN rm -rf image-classification-tf/models/*                                                                                                                                                                              0.0s
 => ERROR [3/4] RUN curl --insecure -o ./image-classification-tf/models/inaturalist_plants.tar.xz     https://cephrgw01.ifca.es:8080/swift/v1/inaturalist_plants-tf/inaturalist_plants.tar.xz                                             0.3s
------
 > [3/4] RUN curl --insecure -o ./image-classification-tf/models/inaturalist_plants.tar.xz     https://cephrgw01.ifca.es:8080/swift/v1/inaturalist_plants-tf/inaturalist_plants.tar.xz:
0.227   % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
0.228                                  Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0curl: (6) Could not resolve host: cephrgw01.ifca.es
------
Dockerfile:25
--------------------
  24 |
  25 | >>> RUN curl --insecure -o ./image-classification-tf/models/${MODEL_TAR} \
  26 | >>>     ${SWIFT_CONTAINER}${MODEL_TAR}
  27 |
--------------------
ERROR: failed to solve: process "/bin/sh -c curl --insecure -o ./image-classification-tf/models/${MODEL_TAR}     ${SWIFT_CONTAINER}${MODEL_TAR}" did not complete successfully: exit code: 6

But that seems to fail due an host I cannot access :)

IgnacioHeredia commented 1 year ago

But that seems to fail due an host I cannot access :)

This Dockerfile should have the proper link. Let me know if that works!

Fristi commented 1 year ago

I tried to make it work on my arm64 machine, but it seems there are specific amd64 dependencies being pulled in.

Aside from that I've got it up and running now on fly.io! plant

I tried classifying the species of this plant, but it could only label it with a plant and such, should I train the network still?

IgnacioHeredia commented 1 year ago

I tried classifying the species of this plant, but it could only label it with a plant and such, should I train the network still?

Make sure you are using the plant classifier (deep-oc-plants-classification-tf) and not the generic image classifier (deep-oc-image-classification-tf).

Fristi commented 1 year ago

That works, thank you ! :) I'll see if I can get a arm64 version working for the docker images to aid development