Objects Expression recognition
This notebooks shows some preliminary work on detecting objects expressions with cvlib. It is mainly meant to explore its capabilities and to decide on future research directions. We package our code into a misinformation package that is imported here:
[1]:
import misinformation
from misinformation import utils as mutils
from misinformation import display as mdisplay
import misinformation.objects as ob
Set an image path as input file path.
[2]:
images = mutils.find_files(
path="data/",
limit=10,
)
[3]:
mydict = mutils.initialize_dict(images)
Manually inspect what was detected
To check the analysis, you can inspect the analyzed elements here. Loading the results takes a moment, so please be patient. If you are sure of what you are doing.
[4]:
mdisplay.explore_analysis(mydict, identify="objects")
[4]:
Detect objects and directly write to csv
[5]:
for key in mydict:
mydict[key] = ob.ObjectDetector(mydict[key]).analyse_image()
Convert the dictionary of dictionarys into a dictionary with lists:
[6]:
outdict = mutils.append_data_to_dict(mydict)
df = mutils.dump_df(outdict)
Check the dataframe:
[7]:
df.head(10)
[7]:
| filename | person | bicycle | car | motorcycle | airplane | bus | train | truck | boat | traffic light | cell phone | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 0 | data/102730_eng.png | yes | no | no | no | no | no | no | yes | no | no | no |
| 1 | data/102141_2_eng.png | yes | no | no | no | no | no | no | no | no | no | no |
| 2 | data/106349S_por.png | yes | no | no | no | no | no | no | no | no | no | yes |
Write the csv file:
[8]:
df.to_csv("./data_out.csv")