romroc / objdet_fizyr_colab Goto Github PK
View Code? Open in Web Editor NEWColab (Jupyter) notebook to train Object Detection model with custom dataset, based on Fizyr implementation of RetinaNet in Keras.
Colab (Jupyter) notebook to train Object Detection model with custom dataset, based on Fizyr implementation of RetinaNet in Keras.
/bin/bash: keras_retinanet/bin/train.py: Permission denied
Here are the steps I followed:
resnet50_coco_best_v2.1.0.h5
keras_retinanet/bin/train.py csv /path/to/csv/file/containing/annotations /path/to/csv/file/containing/classes
keras_retinanet/bin/convert_model.py snapshots/resnet50_csv_50.h5 /path/to/save/inference/model.h5
The thing is that I am not getting any bounding boxes on any image. Scores are an array of -1s and the boxes also have negative values. Did I have to mention something explicitly while training the resnet50_coco_best_v2.1.0.h5 on my dataset?
`
Im having trouble getting the relevant CSV's to generate correctly. When running the code, everything seems to work correctly however the labels I have generated are not being passed through to the inference section of the model despite the formatting being correct. On a whim I have tried running the code with the original google drive ID values and dataset and switched back to my own and tested images are still being labelled as goats.
I wanted to train the model for 100 epochs but when the training started after certain epochs the training gets stooped.Why is that happening ??
WARNING:tensorflow:From keras_retinanet/bin/train.py:542: Model.fit_generator (from tensorflow.python.keras.engine.training) is deprecated and will be removed in a future version.
Instructions for updating:
Please use Model.fit, which supports generators.
Epoch 1/100
2020-08-25 04:41:47.091716: I tensorflow/stream_executor/platform/default/dso_loader.cc:48] Successfully opened dynamic library libcudnn.so.7
2020-08-25 04:41:48.890281: I tensorflow/stream_executor/platform/default/dso_loader.cc:48] Successfully opened dynamic library libcublas.so.10
2020-08-25 04:41:49.682925: W tensorflow/core/common_runtime/bfc_allocator.cc:312] Garbage collection: deallocate free memory regions (i.e., allocations) so that we can re-allocate a larger region to avoid OOM due to memory fragmentation. If you see this message frequently, you are running near the threshold of the available device memory and re-allocation may incur great performance overhead. You may try smaller batch sizes to observe the performance impact. Set TF_ENABLE_GPU_GARBAGE_COLLECTION=false if you'd like to disable this feature.
28/50 [===============>..............] - ETA: 6s - loss: 1.7892 - regression_loss: 0.7126 - classification_loss: 1.0766WARNING:tensorflow:Your input ran out of data; interrupting training. Make sure that your dataset or generator can generate at least `steps_per_epoch * epochs` batches (in this case, 5000 batches). You may need to use the repeat() function when building your dataset.
Epoch 00001: saving model to ./snapshots/resnet50_csv_01.h5
28/50 [===============>..............] - 9s 315ms/step - loss: 1.7892 - regression_loss: 0.7126 - classification_loss: 1.0766
Hi RomRoc,
thank you for this script, it helps us a lot transforming annotation from labelImg xml to keras-retinanet csv fizyr/keras-retinanet#908
i have been thinking of doing the other way around, a semi-automatic annotation using a pre-trained model (predicted bounding boxes as annotation), save them to pandas dataframe and convert them to labelImg xml format, therefore we can load the xml and debug/fix/modify the incorrect annotation predicted by the pre-trained model
maybe you could help creating a python script also for this, i cant somehow wrap my head around the logic, greatly appreciate your help
I get the below error when running the line :
!keras_retinanet/bin/train.py --freeze-backbone --random-transform --weights {PRETRAINED_MODEL} --batch-size 8 --steps 500 --epochs 10 csv annotations.csv classes.csv
Traceback (most recent call last):
File "keras_retinanet/bin/train.py", line 547, in
main()
File "keras_retinanet/bin/train.py", line 507, in main
config=args.config
File "keras_retinanet/bin/train.py", line 117, in create_models
model = model_with_weights(backbone_retinanet(num_classes, num_anchors=num_anchors, modifier=modifier, pyramid_levels=pyramid_levels), weights=weights, skip_mismatch=True)
File "keras_retinanet/bin/../../keras_retinanet/models/resnet.py", line 38, in retinanet
return resnet_retinanet(*args, backbone=self.backbone, **kwargs)
File "keras_retinanet/bin/../../keras_retinanet/models/resnet.py", line 99, in resnet_retinanet
resnet = keras_resnet.models.ResNet50(inputs, include_top=False, freeze_bn=True)
File "/usr/local/lib/python3.6/dist-packages/keras_resnet/models/_2d.py", line 188, in ResNet50
return ResNet(inputs, blocks, numerical_names=numerical_names, block=keras_resnet.blocks.bottleneck_2d, include_top=include_top, classes=classes, *args, **kwargs)
File "/usr/local/lib/python3.6/dist-packages/keras_resnet/models/_2d.py", line 66, in ResNet
x = keras_resnet.layers.BatchNormalization(axis=axis, epsilon=1e-5, freeze=freeze_bn, name="bn_conv1")(x)
File "/usr/local/lib/python3.6/dist-packages/tensorflow/python/keras/engine/base_layer.py", line 926, in call
input_list)
File "/usr/local/lib/python3.6/dist-packages/tensorflow/python/keras/engine/base_layer.py", line 1117, in _functional_construction_call
outputs = call_fn(cast_inputs, *args, **kwargs)
File "/usr/local/lib/python3.6/dist-packages/tensorflow/python/autograph/impl/api.py", line 258, in wrapper
raise e.ag_error_metadata.to_exception(e)
TypeError: in user code:
/usr/local/lib/python3.6/dist-packages/keras_resnet/layers/_batch_normalization.py:17 call *
return super(BatchNormalization, self).call(training=(not self.freeze), *args, **kwargs)
TypeError: type object got multiple values for keyword argument 'training'
Any thoughts ?
Hi,
The notebook is really interesting and helpful, however when I try to train the model with your dataset an error pops up as follows.
Creating model, this may take a second...
Traceback (most recent call last):
File "keras_retinanet/bin/train.py", line 514, in
main()
File "keras_retinanet/bin/train.py", line 464, in main
num_classes=train_generator.num_classes(),
File "keras_retinanet/bin/../../keras_retinanet/preprocessing/csv_generator.py", line 170, in num_classes
return max(self.classes.values()) + 1
ValueError: max() arg is an empty sequence
Hope you can help
Cheers
Tarek
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.