Giter Club home page Giter Club logo

mobilenetv2-ssd's People

Contributors

saunack avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

mobilenetv2-ssd's Issues

Logic error

Hi!

On this line of code hw[ pos : pos + numBox , :] = np.multiply(gridSize*scale, np.squeeze(np.dstack([asp1,asp2]),axis=0))[:numBox,:], I think gridSize*scale need to be replaced with IMG_SIZE/gridSize*scale. The gridSize is the number of layers, but the width and height of each layer is IMG_SIZE/gridSize. Am I right?

Thank you!

anchor code error

for gridSize, numBox, scale in zip(layerWidths,numBoxes,scales):
step_size = IMG_SIZE1.0/gridSize
for i in range(gridSize):
for j in range(gridSize):
pos = idx + (i
gridSize+j) * numBox
# centre is the same for all aspect ratios(=numBox)
centres[ pos : pos + numBox , :] = istep_size + step_size/2, jstep_size + step_size/2
# height and width vary according to the scale and aspect ratio
# zip asepct ratios and then scale them by the scaling factor
hw[ pos : pos + numBox , :] = np.multiply(gridSize*scale, np.squeeze(np.dstack([asp1,asp2]),axis=0))[:numBox,:]

idx += gridSizegridSizenumBox

in code:
hw[ pos : pos + numBox , :] = np.multiply(gridSize*scale, np.squeeze(np.dstack([asp1,asp2]),axis=0))[:numBox,:]

gridSize is wrong, if gridesize is 1 then only one centre exist ,which is the center of the image, the w&h became 1*scale,however the sacle is 0.1. hence the w&h became 0.1.

i suppose the code should change to :
hw[ pos : pos + numBox , :] = np.multiply(step_size*scale, np.squeeze(np.dstack([asp1,asp2]),axis=0))[:numBox,:]

mobile_netv2/Bottleneck_B5_3/Bottleneck_B5_3_conv/depthwise_kernel has 'None' for gradient

Hi @saunack! I'm trying to reproduce your code locally in my machine.
SO: Ubuntu 20.04.3
Python: 3.8.2
TensorFlow: 2.6.0
Keras: 2.6.0

I've just copied your code in a .py file (I'm copying it at the end of the issue)
First, I had this error when executing model.model().summary():

The graph tensor has name: mobile_netv2/Bottleneck_B5_3/Bottleneck_B5_3_expand_ReLU/Relu6:0

Which I solved adding this line:
tf.compat.v1.disable_eager_execution()
as suggested here: https://stackoverflow.com/questions/60551145/tensorflow-2-1-0-an-op-outside-of-the-function-building-code-is-being-passed-a

Then, I'm stuck with this error when executing model.fit(...:

Traceback (most recent call last):
File "ssd_mobilenet_train.py", line 493, in
history = model.fit(train_dataset,
File "/home/aisoy/.local/lib/python3.8/site-packages/keras/engine/training_v1.py", line 777, in fit
return func.fit(
File "/home/aisoy/.local/lib/python3.8/site-packages/keras/engine/training_arrays_v1.py", line 640, in fit
return fit_loop(
File "/home/aisoy/.local/lib/python3.8/site-packages/keras/engine/training_arrays_v1.py", line 177, in model_iteration
f = _make_execution_function(model, mode)
File "/home/aisoy/.local/lib/python3.8/site-packages/keras/engine/training_arrays_v1.py", line 547, in _make_execution_function
return model._make_execution_function(mode)
File "/home/aisoy/.local/lib/python3.8/site-packages/keras/engine/training_v1.py", line 2079, in _make_execution_function
self._make_train_function()
File "/home/aisoy/.local/lib/python3.8/site-packages/keras/engine/training_v1.py", line 2010, in _make_train_function
updates = self.optimizer.get_updates(
File "/home/aisoy/.local/lib/python3.8/site-packages/keras/optimizer_v2/optimizer_v2.py", line 759, in get_updates
grads = self.get_gradients(loss, params)
File "/home/aisoy/.local/lib/python3.8/site-packages/keras/optimizer_v2/optimizer_v2.py", line 751, in get_gradients
raise ValueError("Variable {} has None for gradient. "
ValueError: Variable <tf.Variable 'mobile_netv2/Bottleneck_B5_3/Bottleneck_B5_3_conv/depthwise_kernel:0' shape=(3, 3, 576, 1) dtype=float32> has None for gradient. Please make sure that all of your ops have a gradient defined (i.e. are differentiable). Common ops without gradient: K.argmax, K.round, K.eval.

Here, they suggest that there are unused weights and gradient can't be computed:
keras-team/keras#12521

My code:
ssd_mobilenet_train.txt

'mobile_netv2_1/Bottleneck_B5_3/Bottleneck_B5_3_expand_ReLU/Relu6:0' is out of scope and cannot be used here.

Hi.

I tried to run the code but failed on running

model = SSD(numBoxes=numBoxes, layerWidth=layerWidths, k = outputChannels)
model.model().summary()

The error says:

The tensor <tf.Tensor 'mobile_netv2_1/Bottleneck_B5_3/Bottleneck_B5_3_expand_ReLU/Relu6:0' shape=(None, 14, 14, 576) dtype=float32> cannot be accessed from here, because it was defined in FuncGraph(name=mobile_netv2_1_scratch_graph, id=2772620844720), which is out of scope.

Call arguments received:
  • inputs=tf.Tensor(shape=(None, 14, 14, 576), dtype=float32)

I'm using

Python: 3.8
TF + Keras : v2.8.0

Implementation for quantized training

Hello,

I would like to know if you have implemented an implementation for quantised training of the specific model: ssd mobilenet v2 in your Object Detection API (https://github.com/tensorflow/models/tree/master/research/object_detection) like the TensorFlow team. From my research in the code it doesn't look like it, it is trained with float32 values. As we know, direct quantised training is better than quantising the model afterwards.

So the question would be how to implement this, are there already ready functions to quantise the model during training? I would appreciate a detailed and insightful answer.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.