question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Support]: Shape mismatch with custom Tensorflow model

See original GitHub issue

Describe the problem you are having

The model has a size of 420x280, widthxheight.

CPU model Labels

Swapping model width and height swaps error.

ValueError: could not broadcast input array from shape (1,280,420,3)
into shape (1,420,280,3)

Version

0.9.1-800f33e

Frigate config file

model:
  width: 420
  height: 280

cameras:
  back:
    ffmpeg:
      inputs:
        - path: "rtsp://"
          roles:
            - rtmp
            - detect
    detect:
      fps: 1
      width: 640
      height: 450
    motion:

Relevant log output

frigate      | Process camera_processor:back:                                      
frigate      | Traceback (most recent call last):                                  
frigate      |   File "/usr/lib/python3.8/multiprocessing/process.py", line 315, in
_bootstrap
frigate      |     self.run()
frigate      |   File "/usr/lib/python3.8/multiprocessing/process.py", line 108, in
run
frigate      |     self._target(*self._args, **self._kwargs)                       
frigate      |   File "/opt/frigate/frigate/video.py", line 362, in track_camera   
frigate      |     process_frames(
frigate      |   File "/opt/frigate/frigate/video.py", line 519, in process_frames 
frigate      |     detect(
frigate      |   File "/opt/frigate/frigate/video.py", line 410, in detect         
frigate      |     region_detections = object_detector.detect(tensor_input)        
frigate      |   File "/opt/frigate/frigate/edgetpu.py", line 264, in detect       
frigate      |     self.np_shm[:] = tensor_input[:]                                
frigate      | ValueError: could not broadcast input array from shape (1,420,280,3)
into shape (1,280,420,3)

FFprobe output from your camera

Duration: N/A, start: -0.693696, bitrate: N/A
  Stream #0:0: Video: h264 (High), yuv420p(progressive), 650x450 [SAR 1:1 DAR 13:9], 20 fps, 20 tbr, 90k tbn
  Stream #0:1: Audio: aac (LC), 44100 Hz, stereo, fltp

Frigate stats

No response

Operating system

Other Linux

Install method

Docker Compose

Coral version

CPU (no coral)

Network connection

Wired

Camera make and model

local test feed.

Any other information that may be helpful

No response

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
blakeblackshearcommented, Dec 3, 2021

That’s fine. I don’t have any intention of stopping others from developing models that work with Frigate.

0reactions
Curidcommented, Dec 3, 2021

@blakeblackshear Just released a new custom model. Do you mind if I post about it in Custom Models #1043?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Shapes mismatch in Tensorflow model - python - Stack Overflow
When trying to fit my model, I get the following error: model.fit(train_x, train_y, epochs=300, batch_size=500, validation_data=(val_x, val_y)) ...
Read more >
Data shape mismatch in custom training with 'train_step' and ...
I am developing a custom model training by overriding train_step inherited from tf.keras.Model and __getitem__ of my data generator ...
Read more >
tf.keras.layers.Layer | TensorFlow v2.11.0
__init__() : Defines custom layer attributes, and creates layer weights that do ... on a Functional Model, as shown in the example below,...
Read more >
Keras load pre-trained weights. Shape mismatch
Apparently, there is a mismatch in architecture between model and the original model which was used to generate my_weights.h5 . Compare summary ...
Read more >
Model saving & serialization APIs - Keras
Only topological loading is supported for weight files in TensorFlow format. skip_mismatch: Boolean, whether to skip loading of layers where there is a...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found