exadel-inc / CompreFace

Leading free and open-source face recognition system
https://exadel.com/accelerator-showcase/compreface/
Apache License 2.0
5.69k stars 775 forks source link

ArrayIndexOutOfBoundsException #1159

Closed jurgenweber closed 1 year ago

jurgenweber commented 1 year ago

Describe the bug

all images submitted return the following stack trace

java.lang.ArrayIndexOutOfBoundsException: arraycopy: last destination index 100224 out of bounds for double[100096]
    at java.base/java.lang.System.arraycopy(Native Method)
    at org.nd4j.common.util.ArrayUtil.flatten(ArrayUtil.java:2374)
    at org.nd4j.linalg.api.ndarray.BaseNDArray.<init>(BaseNDArray.java:249)
    at org.nd4j.linalg.api.ndarray.BaseNDArray.<init>(BaseNDArray.java:240)
    at org.nd4j.linalg.cpu.nativecpu.NDArray.<init>(NDArray.java:103)
    at org.nd4j.linalg.cpu.nativecpu.CpuNDArrayFactory.create(CpuNDArrayFactory.java:182)
    at org.nd4j.linalg.factory.Nd4j.create(Nd4j.java:3444)
    at com.exadel.frs.core.trainservice.cache.EmbeddingCollection.from(EmbeddingCollection.java:48)
    at com.exadel.frs.core.trainservice.service.EmbeddingService.doWithEnhancedEmbeddingProjectionStream(EmbeddingService.java:38)
    at com.exadel.frs.core.trainservice.service.EmbeddingService$$FastClassBySpringCGLIB$$e0813ef4.invoke(<generated>)
    at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:218)
    at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:793)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:163)
    at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.proceed(CglibAopProxy.java:763)
    at org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:123)
    at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:388)
    at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:119)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)
    at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.proceed(CglibAopProxy.java:763)
    at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:708)
    at com.exadel.frs.core.trainservice.service.EmbeddingService$$EnhancerBySpringCGLIB$$f2b2d56d.doWithEnhancedEmbeddingProjectionStream(<generated>)
    at com.exadel.frs.core.trainservice.cache.EmbeddingCacheProvider.getOrLoad(EmbeddingCacheProvider.java:41)
    at com.exadel.frs.core.trainservice.component.classifiers.EuclideanDistanceClassifier.predict(EuclideanDistanceClassifier.java:53)
    at com.exadel.frs.core.trainservice.component.FaceClassifierPredictor.predict(FaceClassifierPredictor.java:34)
    at com.exadel.frs.core.trainservice.service.FaceRecognizeProcessServiceImpl.processFaceResult(FaceRecognizeProcessServiceImpl.java:82)
    at com.exadel.frs.core.trainservice.service.FaceRecognizeProcessServiceImpl.processImage(FaceRecognizeProcessServiceImpl.java:72)
    at com.exadel.frs.core.trainservice.service.FaceRecognizeProcessServiceImpl.processImage(FaceRecognizeProcessServiceImpl.java:25)
    at com.exadel.frs.core.trainservice.controller.RecognizeController.recognize(RecognizeController.java:113)
    at com.exadel.frs.core.trainservice.controller.RecognizeController$$FastClassBySpringCGLIB$$52b4c4f5.invoke(<generated>)
    at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:218)
    at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:793)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:163)
    at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.proceed(CglibAopProxy.java:763)
    at org.springframework.validation.beanvalidation.MethodValidationInterceptor.invoke(MethodValidationInterceptor.java:123)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)
    at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.proceed(CglibAopProxy.java:763)
    at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:708)
    at com.exadel.frs.core.trainservice.controller.RecognizeController$$EnhancerBySpringCGLIB$$74d4317e.recognize(<generated>)
    at jdk.internal.reflect.GeneratedMethodAccessor147.invoke(Unknown Source)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.base/java.lang.reflect.Method.invoke(Unknown Source)
    at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:205)
    at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:150)
    at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:117)
    at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:895)
    at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:808)
    at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:87)
    at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:1067)
    at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:963)
    at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:1006)
    at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:909)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:681)
    at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:883)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:764)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:227)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162)
    at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162)
    at com.exadel.frs.core.trainservice.filter.SecurityValidationFilter.doFilter(SecurityValidationFilter.java:134)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162)
    at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:100)
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:117)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162)
    at org.springframework.web.filter.FormContentFilter.doFilterInternal(FormContentFilter.java:93)
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:117)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162)
    at org.springframework.boot.actuate.metrics.web.servlet.WebMvcMetricsFilter.doFilterInternal(WebMvcMetricsFilter.java:96)
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:117)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162)
    at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:201)
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:117)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:197)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:97)
    at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:541)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:135)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:78)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:360)
    at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:399)
    at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:65)
    at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:890)
    at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1743)
    at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
    at org.apache.tomcat.util.threads.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1191)
    at org.apache.tomcat.util.threads.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:659)
    at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
    at java.base/java.lang.Thread.run(Unknown Source)

To Reproduce

I recently updated with master, it was working fine. I have core on a jetson nano. I use double take, so any image double take is sending to it is failing with this and core returns a 400 no faces found.

Expected behavior

I expected faces to be found.

Screenshots

If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

Logs

Run those commands and attach result to the ticket:

docker ps

# docker ps
CONTAINER ID   IMAGE                                             COMMAND                  CREATED      STATUS      PORTS                                       NAMES
8b7bb2344306   compreface-fe:latest                              "/docker-entrypoint.…"   4 days ago   Up 4 days   0.0.0.0:8000->80/tcp, :::8000->80/tcp       compreface-ui
15fb94664c78   compreface-admin:latest                           "sh -c 'java $ADMIN_…"   4 days ago   Up 4 days   0.0.0.0:8081->8080/tcp, :::8081->8080/tcp   compreface-admin
0fa854b91a38   compreface-api:latest                             "sh -c 'java $API_JA…"   4 days ago   Up 4 days   0.0.0.0:8082->8080/tcp, :::8082->8080/tcp   compreface-api
c192e5c60d48   compreface-postgres-db:latest                     "docker-entrypoint.s…"   4 days ago   Up 4 days   0.0.0.0:6432->5432/tcp, :::6432->5432/tcp   compreface-postgres-db
0192b32f20a6   whitepail/compreface-core:arm64-arcface-r50-gpu   "uwsgi --ini uwsgi.i…"   4 days ago   Up 4 days   3000/tcp                                    compreface-core

docker-compose logs as above

Additional context

Was working fine, but then I updated with master.

jurgenweber commented 1 year ago

testing if this is the fix? https://github.com/exadel-inc/CompreFace/commit/01b6eaa2043b7e4366772419afc51a9d687d2376

jurgenweber commented 1 year ago

no, still getting the same error. :\

2023-08-19 03:39:10.043 ERROR 7 --- [io-8080-exec-11] c.e.f.c.h.ResponseExceptionHandler : Undefined exception occurred java.lang.ArrayIndexOutOfBoundsException: arraycopy: last destination index 100224 out of bounds for double[100096]

jurgenweber commented 1 year ago

Not sure what was going on here butg I started a new database.